Scripting: Whats Wrong With What Ive Done?
Visser
Join Date: 2002-11-03 Member: 6613Members
<div class="IPBDescription">Need helping fixing com script.</div> What im attempting to write here is a little complx. Im aiming for two things: 1st, i am making the same 4 by 3 set of keys the buttons for ALL of the comm commands. By pressing f,g,h it unbinds the keys im using (i,o,p,[,j,k,l,;,n,m), switches to the right menu (basic advanced equipment), and rebinds all the keys to be the right item accoding to how they are placed in the grid square you click. (EG res node is top left on basic tab - i hit f for basic then press i (top left in my layout) and then place it down). Anyone who has played the RTS game strifeshadow knows what i mean. THe other thing i am aiming for (which is made a lot easier by this last part) is to not have to constantly switch cfgs - i have movment on the left half of keyboard, and radio, alien morphs/upgrades all around the side and on keypad.
The script is these lines pasted in the bottom of my config.cfg file. Note the enter bind (alias HP) is an emergancy medpack button. I press it and it switches to equip menu puts a medpack on my cursor.
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->alias HP "hotkey88;hotkey59"
alias basic "unbind i;unbind o;unbind p;unbind [;unbind j;unbind k;unbind l;unbind ,;unbind n;unbind m;hotkey86;bind i
hotkey41;bind k hotkey56;bind o hotkey40;bind p hotkey48;bind j hotkey43;bind l hotkey57;bind n hotkey58"
alias advanced "unbind i;unbind o;unbind p;unbind [;unbind j;unbind k;unbind l;unbind ,;unbind n;unbind m;hotkey87;bind i
hotkey51;bind o hotkey45;bind p hotkey46;bind [ hotkey55"
alias equip "unbind i;unbind o;unbind p;unbind [;unbind j;unbind k;unbind l;unbind ,;unbind n;unbind m;hotkey88;bind o
hotkey59;bind i hotkey60;bind p hotkey61;bind j hotkey62;bind k hotkey64;bind l hotkey65;bind , hotkey66;bind m hotkey39;bind
n hotkey38"
bind "enter" "HP"
bind f basic
bind g advanced
bind h equip<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
None of these work in a live game on the net. All my other things work except f2 bound to carapace doesnt work while f3 adren and f4 cloak work fine.
EDIT: replaced script with better version, (not really). When i press f or h, the console tells me basic/equip is an invalid command. The various keys are bound to the keys set out by the "advanced" alias
EDIT2:after redoing the way the script ran as told below, it works SLIGHTLY more. When i press f/g/h it tells me hotkey 87/8/9 is invalid. When i press enter for medkit it tells me hotkey59 is unknown.
The script is these lines pasted in the bottom of my config.cfg file. Note the enter bind (alias HP) is an emergancy medpack button. I press it and it switches to equip menu puts a medpack on my cursor.
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->alias HP "hotkey88;hotkey59"
alias basic "unbind i;unbind o;unbind p;unbind [;unbind j;unbind k;unbind l;unbind ,;unbind n;unbind m;hotkey86;bind i
hotkey41;bind k hotkey56;bind o hotkey40;bind p hotkey48;bind j hotkey43;bind l hotkey57;bind n hotkey58"
alias advanced "unbind i;unbind o;unbind p;unbind [;unbind j;unbind k;unbind l;unbind ,;unbind n;unbind m;hotkey87;bind i
hotkey51;bind o hotkey45;bind p hotkey46;bind [ hotkey55"
alias equip "unbind i;unbind o;unbind p;unbind [;unbind j;unbind k;unbind l;unbind ,;unbind n;unbind m;hotkey88;bind o
hotkey59;bind i hotkey60;bind p hotkey61;bind j hotkey62;bind k hotkey64;bind l hotkey65;bind , hotkey66;bind m hotkey39;bind
n hotkey38"
bind "enter" "HP"
bind f basic
bind g advanced
bind h equip<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
None of these work in a live game on the net. All my other things work except f2 bound to carapace doesnt work while f3 adren and f4 cloak work fine.
EDIT: replaced script with better version, (not really). When i press f or h, the console tells me basic/equip is an invalid command. The various keys are bound to the keys set out by the "advanced" alias
EDIT2:after redoing the way the script ran as told below, it works SLIGHTLY more. When i press f/g/h it tells me hotkey 87/8/9 is invalid. When i press enter for medkit it tells me hotkey59 is unknown.
Comments
Take a look what i've done in my little script, thou i aint got aliases for everything.. (in my sig)
Dauntl3ss there are many scripts like yours, i already have a few i could have used if i wanted. But i am trying to make my own more advanced thing.
BTW, you don't have to unbind the keys before you bind them to new ones, so you can take the unbinds out... they arn't really nessaserry...
I have noticed however that the hotkeys dont work on my machine at all... at least, the one's I've tried... they just say 'hotkey<#> is not a recognised command' or something like that, so maybe the NS team havn't impletemented these commands yet, just as they hadn't previously impletemented lastinv ect... <!--emo&???--><img src='http://www.unknownworlds.com/forums/html/emoticons/confused.gif' border='0' valign='absmiddle' alt='confused.gif'><!--endemo--> just a theory
you have to delete or rename the <b>'GameUI.dll'</b> in <b>'.../valve/cl_dlls'</b>
But really that has nothing to do with anything as neither F1 or F2 are being bound by this script...
Omg the spam <!--emo&:angry:--><img src='http://www.unknownworlds.com/forums/html/emoticons/mad.gif' border='0' valign='absmiddle' alt='mad.gif'><!--endemo-->
However i never got exactly what people mean to setup the push it twice thing.
Can someone do a quick example to show me
@whoever: the unbinds are there for tidyness as far as the end user is concerned. Pressing keys that are no longer valid for that command tab wont give you an error/that annoying beep kinda noise.
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->//..::This line below will not work, hotkeys only work if bound to a key::..
alias HP "hotkey88;hotkey59"
//..::The hit the button twice fix will work because with the first click it binds all the necessary keys, and with the second click it switches menus::..
alias basic "unbind i;unbind o;unbind p;unbind [;unbind j;unbind k;unbind l;unbind ,;unbind n;unbind m;bind f hotkey86;bind g advanced; bind h equip;bind i hotkey41;bind k hotkey56;bind o hotkey40;bind p hotkey48;bind j hotkey43;bind l hotkey57;bind n hotkey58"
alias advanced "unbind i;unbind o;unbind p;unbind [;unbind j;unbind k;unbind l;unbind ,;unbind n;unbind m;bind g hotkey87;bind f basic;bind h equip;bind i hotkey51;bind o hotkey45;bind p hotkey46;bind [ hotkey55"
alias equip "unbind i;unbind o;unbind p;unbind [;unbind j;unbind k;unbind l;unbind ,;unbind n;unbind m;bind h hotkey88;bind f basic; bind f advanced;bind o hotkey59;bind i hotkey60;bind p hotkey61;bind j hotkey62;bind k hotkey64;bind l hotkey65;bind , hotkey66;bind m hotkey39;bind n hotkey38"
bind "enter" "HP"
bind f basic
bind g advanced
bind h equip<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
oh, of course... good point... for like the advanced menu where there are only like 4 options?
One of the first things you learn in programming class is to use meaningful names....
1) they have to be bound to a key to work, you can't execute them from aliases or cfgs
and
2) you have to be in the right commander menu to place an item (Equip for Medpacks, for example)
those two combined mean that your commander script, while a great idea, simply won't work <!--emo&:(--><img src='http://www.unknownworlds.com/forums/html/emoticons/sad.gif' border='0' valign='absmiddle' alt='sad.gif'><!--endemo-->
bind <key> hotkey<##>
Can't get any more special than that with hotkeys.