Page 1 of 3

new keys?

Posted: Tue Mar 15, 2005 6:35 pm
by lizardkid
i must have asked this before but a search didnt find anything and i sure forgot whatever info i got from it.

i want to make a new control key, like +primaryfire and +moveleft, but i want it to be custom. such as !myKey

what i want:

i'm making a squad SP mod that's pretty simple atm, but i need to have the "floating keypad" (home end delete pageup pagedown) to control the squad in certain ways. but there are no spare controls like +use i can use effectively. so i want to make new controls like !squadAdvance and !squadMove, but i dont know how.

is this possible?

Posted: Tue Mar 15, 2005 7:14 pm
by Rookie One.pl
Aliases + setting cvars, which are read by the script.

Posted: Tue Mar 15, 2005 7:37 pm
by lizardkid
ok now we're getting somewhere...

how would i make an alias and a new cvar? then i suppose it's liek this to read the cvar

if(mycvar == something)
{

// ...

}

Posted: Tue Mar 15, 2005 8:46 pm
by Rookie One.pl
Let's say you want to use the "squadcommand" cvar for your squad commands. Now you can bind directly cvars to keys or make aliases from the console:

Code: Select all

alias squad_followme "set squadcommand followme"
alias squad_coveringfire "set squadcommand coveringfire"
bind PGUP squad_followme
bind PGDOWN squad_coveringfire
And then in the scr:

Code: Select all

while (1)
{
   if (getcvar(squadcommand) != "")
   {
      switch(getcvar(squadcommand))
      {
         case "follow"
//whatever
//etc. etc.
      }
   }
   waitframe
}

Posted: Tue Mar 15, 2005 10:37 pm
by lizardkid
so alias creates a new cvar, and the bound key calls the cvar, in the script i'd check the cvar itself every second (or whatever) for whatever the user's put into it?

just so i know whats happening :)

Posted: Wed Mar 16, 2005 5:26 pm
by Rookie One.pl
Exactly. Note that this will work only for SP.

Posted: Wed Mar 16, 2005 7:02 pm
by lizardkid
alright, that's all i want it for. thanks Rookie (Pro) :mrgreen:

Posted: Wed Mar 16, 2005 9:58 pm
by lizardkid
doesn't work. i used this in my script...

Code: Select all

alias squad_hold "set squadcommand hold"
alias squad_coveringFire "set squadcommand coveringFire"
alias squad_follow "set squadcommand followme" 
alias squad_advance "set squadcommand advance"
alias squad_regroup "set squadcommand regroup"
alias clear "set squadcommand  "
 
bind HOME squad_hold
bind END squad_coveringFire
bind DEL squad_follow
bind PGUP squad_advance
bind PGDN squad_regroup
bind INS clear
and all of them returned errors. bind and alias both. said something about ScriptMAster and not doing something.

Posted: Wed Mar 16, 2005 11:37 pm
by wacko
Maybe it's e.g. KP_HOME instead of HOME (like in my unnamedsoldier.cfg) and maybe the aliases need the local.master stuff?! No idea here, so sorry for talking nonsense :oops:

Posted: Wed Mar 16, 2005 11:58 pm
by Master-Of-Fungus-Foo-D
didnt rookie say put this in console?
Now you can bind directly cvars to keys or make aliases from the console
alias squad_hold "set squadcommand hold"
alias squad_coveringFire "set squadcommand coveringFire"
alias squad_follow "set squadcommand followme"
alias squad_advance "set squadcommand advance"
alias squad_regroup "set squadcommand regroup"
alias clear "set squadcommand "

bind HOME squad_hold
bind END squad_coveringFire
bind DEL squad_follow
bind PGUP squad_advance
bind PGDN squad_regroup
bind INS clear

Posted: Thu Mar 17, 2005 12:25 am
by lizardkid
anything you put in script OUGHT to work from console.

ok new approach, how do i write to unnamedsoldier.cfg and add the binds there... i can just make the aliases in the script later, or try writing them too.
Maybe it's e.g. KP_HOME instead of HOME (like in my unnamedsoldier.cfg) and maybe the aliases need the local.master stuff?! No idea here, so sorry for talking nonsense
no it's a problem with the command, not the key. ;)

local.master... hmm

Posted: Thu Mar 17, 2005 12:27 am
by Master-Of-Fungus-Foo-D
wacko youre thinknig sound aliases :P...

Posted: Thu Mar 17, 2005 12:32 am
by lizardkid
not sure alias is what i need.

Code: Select all

alias( String alias, String realPath, [ String arg1 ], [ String arg2 ], [ String arg3 ], [ String arg4 ], [ String arg5 ], [ String arg6 ] )


Create an alias to the specified path
and bind looks like it's trying to bind an entity to an entity.

so it looks like i'm back at square one.

Posted: Thu Mar 17, 2005 12:34 am
by bdbodger
I think you can add all that to a .cfg file and execute the cfg file from the console or just add it to your mohaa shortcut . If you have a custom.cfg it is automatically executed when you start mohaa that is how I do my custom binds .

Posted: Thu Mar 17, 2005 12:13 pm
by Rookie One.pl
Exactly, the alias and bind commands I wrote about are console ones.
And no, you cannot run stuff from .scr in console.