Debugging bind scripts
#1
I have this seemingly simple script that I made to rebind some keys to some sounds. For some reason, it is consistently giving me errors.

Errors;
  1. All binds execute at game startup.
  2. It says that there is an unregistered sound number 44
  3. The keys get unbound. Like, they dont work anymore.
This is my script;
bind A (crouch) (say D)
bind S (voicecom stayhere G)
bind D (voicecom sorry A)
bind F (if (=f curweapon 2) (weapon (rnd 1)) (weapon 2)) (say B)
bind G (voicecom niceshot C)
bind H (jump) (say D)
bind RETURN (suicide)

This code may seem a little random to you, but dont worry. You may think that my binds are going to stay that way, dont worry, I know.

Additional information, I did use a mod package to replace some of the sounds, I'm keeping the same names, and they are in the right place, I dont think they are the problem. I'll run a test soon to figure out.


Am I using totally different command than I should?
Thanks given by:
#2
I doubt the ( ) symbols aren't the problem. Plus some other keys should probably be added. It doesn't look right.
Thanks given by:
#3
What do you mean other keys should be added? I'm not quite catching your drift. I think it should be a pretty small script, its not fully reprogramming the keyboard.
Quote:I doubt the ( ) symbols aren't the problem.
aren't? or are?
Thanks given by:
#4
I know nothing of making script. Though I've used plenty scripts in my life to tell that all those parentheses you are using aren't right. Parentheses are used, but not that way.
Thanks given by:
#5
I used them to separate the commands, for instance, "bind A (crouch) (say D)" I didn't want it to confuse say D with the command crouch.
Thanks given by:
#6
I've never seen a script where everything is parentheses. That's all.
Thanks given by:
#7
I'll try it without as many tomorrow.
Thanks given by:
#8
bind A [crouch; say D]
bind S [voicecom stayhere G]
bind D [voicecom sorry A]
bind F [if (= (curweapon) 2) [weapon 1] [weapon 2]; say B]
bind G [voicecom niceshot C]
bind H [jump; say D]
bind RETURN suicide

this should be right.. thought i didnt test it in game
Thanks given by:
#9
Thing inside parenthesis are executed - this is why they do it automatically. Square brackets and often apostrophes are to hold command inside them (sorry can't think how to explain that). Semi-colons separate commands.

Kirin's should work.
Thanks given by:
#10
Oh, now I see the difference between them. This I think will make my life a whole lot easier knowing this. I think you are saying that the parenthesis execute as their own command, and thats why the binds where getting unbound is because of them being different commands. Brackets are part of the command already stated
Thanks you guys, and Kirin's script did work, at least to the extent of the point where I think I can debug it.
Kirin, I dont blame you for not wanting to test it, as it would screw up your binds.
Thanks given by:
#11
Kirin fixed it.
Remember: Parentheses mean "Calculate this as soon as you see it."
Square brackets mean "Make this into one chunk, to consider as a group."
Also certain idents need parentheses around them to act validly in script blocks (such as curweapon).
Thanks given by: