bind problems

Maybe someone can help me. So I got this two toggles in my cfg:


bind F4 "vstr classtoggle"
seta classtoggle "vstr c1"
seta c1 "set classtoggle vstr c2; class s 4; set rlds vstr rld1; set mps vstr mpl; play sound/menu/select; echo ^?.^zP^0a^zN^0z^zE^0r^?~"
seta c2 "set classtoggle vstr c1; class s 2; set rlds vstr rld1; set mps vstr mpl; play sound/menu/select; echo ^?.^zM^0g^z4^02^?~"

bind F6 "vstr xyz"
seta xyz "vstr x"
seta x "set classtoggle vstr y; class e 1; set rlds vstr rld0; set mps vstr mpl; play sound/menu/select; echo ^?.^zE^0n^zG^0i^zN^0e^zE^0r^?~"
seta y "set classtoggle vstr x; class e 2; set rlds vstr rld0; set mps vstr mpl; play sound/menu/select; echo ^?.^zR^0i^zF^0l^zE^?~"

i got them in this order in the cfg and now my problem is if i test my panzer,mg bind(F4) it works fine but if i try the rifle eng bind(F6) i can only get eng and if i push the panzer,mg bind(F4) again you now change the classes of the F6 key

maybe you can tell me what the fuck i got wrong

greetz oaG
Comments
12
// +Class-Script+ \\
----------------------

bind F3 "vstr class_engy"

seta class_engy "vstr engy_ns"

seta engy_smg "class e 1; echo ^0Engi^1. ; seta class_engy vstr engy_ns;cmd say_team ^3=bb^0NeXt Engineer ^7with ^0smg^1.; play sound/menu/filter"
seta engy_ns "class e 2; echo ^0Engi Rifle^1. ; seta class_engy vstr engy_smg;cmd say_team ^3=bb^0NeXt Engineer ^7with ^0Rifle^1.;play sound/chat/axis/63a"

bind F4 "class m 1; echo ^0Medic^1.; seta class_engy vstr engy_ns;cmd say_team ^3=bb^0NeXt Medic ^7with ^0smg^1.;play sound/chat/axis/62a"

bind F5 "class f 1; echo ^0FieldOps^1.; seta class_engy vstr engy_ns;cmd say_team ^3=bb^0NeXt Fdops ^7with ^0smg^1.;play sound/chat/axis/64a"

bind F6 "vstr class_cov"

seta class_cov "vstr cov_sniper"

seta cov_sniper "class c 3; echo ^0Covert Sniper^1.; seta class_cov vstr cov_fg;cmd say_team ^3=bb^0NeXt CovertOp ^7with ^0Sniper^1.;play sound/chat/axis/65a"
seta cov_fg "class c 2; echo ^0Covert FG42^1.; seta class_cov vstr cov_sten;cmd say_team ^3=bb^0NeXt CovertOp ^7with ^0FG42^1.; play sound/menu/filter"
seta cov_sten "class c 1; echo ^0Covert Sten^1.; seta class_cov vstr cov_sniper;cmd say_team ^3=bb^0NeXt CovertOp ^7with ^0Sten^1.;play sound/chat/axis/65a"

bind F7 "vstr class_sold"

seta class_sold "vstr sold_panz"

seta sold_panz "class s 4; echo ^0Panzer^1.; seta class_sold vstr sold_mg;cmd say_team ^3=bb^0NeXt Soldat ^7with ^0Panzer^1.;play sound/chat/axis/61a"
seta sold_mg "class s 2; echo ^0MG 42^1.; seta class_sold vstr sold_panz;cmd say_team ^3=bb^0NeXt Soldat ^7with ^0Mg42^1.; play sound/menu/filter"
(assuming rlds and mps are unrelated)

the problem is you bind F6 to "vstr xyz" (xyz=x) but in x you set classtoggle to "vstr y" so..
F4 = classtoggle = y
F6 = xyz = x

second time you press F6 (vstr xyz) it is still going to do "vstr x"

so change:
seta x "set classtoggle ..."
seta y "set classtoggle ..."

to "set xyz ..." instead

if you are never going to change the key from F6 then its more straightforward to not use the xyz variable at all

Quotebind F6 "vstr x"
set x "bind F6 vstr y; class e 1; ..."
set y "bind F6 vstr x; class e 2; ..."


and personally i would use set not seta
oh fuck
thank you i was blind
but thanks for unblinding me höhö
greetz oaG
Parent
What's the difference between set and seta? Seta is permanent right?
Parent
yeah so with set it gets lost when the game closes..

means if you forgot to use a variable in the right place or if you are trying to use something that hasn't been initialised as you expected the script will fall over instead of vstr'ing something which you seta'd before which is doing the wrong thing

that is particularly likely when using unhelpful names like x, y which would be 'poor practice' if it were a professional activity!
Parent
i used xyz only for testing xD
Parent
Quoteind F5 "class m 1;play sound/chat/axis/62a;say_team ^7Medic ^6<3"
bind F6 "class f 1;play sound/chat/axis/64a;say_team ^7Fieldops ^6<3"
bind F7 "class e 1;play sound/chat/axis/63a;say_team ^7Engineer SMG ^6<3"
bind F8 "class e 2;play sound/chat/axis/63a;say_team ^7Engineer Rifle ^6<3"
bind F9 "class c 1;play sound/chat/axis/65a;say_team ^7Sten ^6<3"
bind F10 "class c 3;play sound/chat/axis/65a;say_team ^7Garand Rifle ^6<3"
bind F11 "class s 4;play sound/chat/axis/61a;say_team ^7Winghaven Style ^6<3"
somone stole my script :D
Parent
No, I stole it from gamersfiles.net :E
Parent
have fun pressing around your toggle and missing the respawn with the right class
:DDDDDDDDDDDDDDDDDDDDDDDDD
you never think before you post right?
:DDDDDDDDDDDDDDDDDDDDDDDDD
Parent
Back to top