Posts: 3,462
Threads: 72
Joined: Jun 2010
06 Jul 10, 07:54AM
(This post was last modified: 06 Jul 10, 07:55AM by Ronald_Reagan.)
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;
- All binds execute at game startup.
- It says that there is an unregistered sound number 44
- 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?
Posts: 2,841
Threads: 44
Joined: Jun 2010
I doubt the ( ) symbols aren't the problem. Plus some other keys should probably be added. It doesn't look right.
Posts: 3,462
Threads: 72
Joined: Jun 2010
06 Jul 10, 08:13AM
(This post was last modified: 06 Jul 10, 08:15AM by Ronald_Reagan.)
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?
Posts: 2,841
Threads: 44
Joined: Jun 2010
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.
Posts: 3,462
Threads: 72
Joined: Jun 2010
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.
Posts: 2,841
Threads: 44
Joined: Jun 2010
I've never seen a script where everything is parentheses. That's all.
Posts: 3,462
Threads: 72
Joined: Jun 2010
I'll try it without as many tomorrow.
Posts: 137
Threads: 2
Joined: Jun 2010
06 Jul 10, 08:51AM
(This post was last modified: 06 Jul 10, 08:52AM by Kirin.)
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
Posts: 100
Threads: 6
Joined: Jun 2010
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.
Posts: 3,462
Threads: 72
Joined: Jun 2010
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.
Posts: 3,780
Threads: 33
Joined: Jun 2010
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).