new keys?

Post your scripting questions / solutions here

Moderator: Moderators

lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

new keys?

Post 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?
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Aliases + setting cvars, which are read by the script.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post 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)
{

// ...

}
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post 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
}
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post 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 :)
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Exactly. Note that this will work only for SP.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

alright, that's all i want it for. thanks Rookie (Pro) :mrgreen:
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post 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.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post 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:
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post 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
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post 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
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

wacko youre thinknig sound aliases :P...
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post 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.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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 .
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post 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.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Post Reply