config scripting random numbers help please


(Buckshoe) #1

Right, so I’ve been making this config file thing, and it is meant to display a team message when I throw an airstrike or something. And it does, but it then puts in a bunch of random numbers after it. I dont know why it’s doing this (dont really know what I am doing tbh) but maybe someone here could help?

heres an example of part of the sort of script I have made

//ammodrop binds
bind MOUSE1 “+attack; say_team ^7–Dropping ^4Ammo^7–”

The message that comes up is like:

Dropping Ammo 1478298

or something

Also, it seems to send this message twice. Is this cause of the attack command being +/- maybe?
But I think I have worked out how to get round this so thats just a query


(Buckshoe) #2

So, actually that idea I had managed to fix my problems. I still dont know what they were tho.

So: I have finished my config scripting (for the mo) and I’m gonna post it so tell me what you think. Bear in mind that I only started with this whole scripting thing today so I dont really know what I’m doing. Maybe someone knows better ways of doing what I have done. But tbh I am fairly proud of it.

Basically, this script is a collection of class specific scripts such that when you go field ops, say, and switch to airstrikes, the first time(only) you press the attack button, it gives out a team message saying what you are doing. Its kinda helpful I think, to keep your teammates informed about what you are doing, and tell them when to move out the way. I havent done cvops/soldier yet, mainly cus I cba. I’d like to do a similar thing with grenades but am not sure how to get it to work(think I will leave that for a while).

Okay here goes:

Autoexec.cfg addition:
exec class.cfg

Class.cfg:

// Allied Classes
set b_medic “team b 1”
set b_engr “team b 2; set engr vstr b_engr”
set b_fieldops “team b 3”

// Axis Classes
set r_medic “team r 1”
set r_engr “team r 2; set engr vstr r_engr”
set r_fieldops “team r 3”

// The selection
set my_team_allied “echo Team set ^4Allies; set medic vstr b_medic; set engr vstr b_engr; set fieldops vstr b_fieldops; set team_swap vstr my_team_axis”
set my_team_axis “echo Team set ^2Axis; set medic vstr r_medic; set engr vstr r_engr; set fieldops vstr r_fieldops; set team_swap vstr my_team_allied”
set team_swap “vstr my_team_allied”

// and the binds
bind F9 “vstr team_swap”
bind F6 “vstr medic; exec Medic.cfg; say_team ^4–Going ^1Medic^4–”
bind F7 “vstr engr; exec Engineer.cfg; say_team ^4–Going ^1Engineer^4–”
bind F5 “vstr fieldops; exec Fieldops.cfg; say_team ^4–Going ^1Field Ops^4–”
bind F8 “exec reset.cfg”

And an example of one of the class specific config(the others are pretty much the same but with diff. messages).
Fieldops.cfg:
bind 1 “weaponbank 5; exec Airstrike.cfg”
bind 2 “weaponbank 6; exec Ammodrop.cfg”
bind CAPSLOCK “weaponbank 1; exec resetattack.cfg”
bind F “weaponbank 2; exec resetattack.cfg”
bind 3 “weaponbank 3; exec resetattack.cfg”
bind 4 “weaponbank 4; exec resetattack.cfg”
bind Z “weaponbank 7; exec resetattack.cfg”
bind MWHEELDOWN “weapprev; exec resetattack.cfg”
bind MWHEELUP “weapnext; exec resetattack.cfg”

resetattack.cfg:
bind MOUSE1 “+attack”

reset.cfg:
bind MOUSE1 “+attack”
bind 1 “weaponbank 5”
bind 2 “weaponbank 6”
bind CAPSLOCK “weaponbank 1”
bind F “weaponbank 2”
bind 3 “weaponbank 3”
bind 4 “weaponbank 4”
bind Z “weaponbank 7”
bind MWHEELDOWN “weapprev”
bind MWHEELUP “weapnext”

airstrike.cfg:
set doer “+attack; say_team ^4–Throwing ^1Airstrike^4–; -attack;exec resetattack.cfg”
bind MOUSE1 “vstr doer”

ammodrop.cfg:
set doer “+attack; say_team ^4–Dropping ^1Ammo^4–; -attack;exec resetattack.cfg”
bind MOUSE1 “vstr doer”

btw, thanks alot to the peeps who do that http://planetwolfenstein.com/4newbies/ site as it helped me alot and my class.cfg bit is basically an edited version of one from there


(Rain) #3

When you press a key bound to +something, the engine sends two additional numbers to the command: the key number (so that it can tell which one you released when you let go of the key, should you have multiple keys bound do the same +something) and the current time (so that the engine knows when you pressed the key if it manages to get the keypress during a time when it can’t do anything about it. (That’s actually fudged a little, but it’ll do well enough for a simple explanation…))
The best solution is…right about what you did. :slight_smile:


(squadjot) #4

the numbers…after: “reloading/whatever 8942854” …i also wondered what that might be, the numbers…and only seems to happen on mouse keys…


(pgh) #5

Mouse keys? :} Buttons.

Nah, I used to get it in ETMain with a bind x “+reload; say_team blalal; -reload”

Just randomly worked one day but you always end a command once its task is completed. So;

bind MOUSE1 "+attack; say_team ^7--Dropping ^4Ammo^7--"  should try..
bind MOUSE1 "+attack; wait 10; say_team ^7--Dropping ^4Ammo^7--; -attack"