ET scripting limitations?


(d34dm34+) #1

Hi there,

I hope someone can help me out with my ET script (autoexec.cfg). I’m trying to code a menu behind keys 0 to 9 but it doesn’t work. I think the reason is that I’m running into limitations in ET script parsing & execution, but I’m no expert so I can’t tell. My scipt is here:

http://users.telenet.be/aitsjoe/ET/

It consists of 6 files, one of them being d34-menu.cfg. That is the script that defines the menu. The variables are bound to keys 0 to 9 in d34-keybinds.cfg. Those are the only binds that do not work, they don’t have any effect in-game (the other binds work without a problem).

You’ll see that the menu script code is a bit complex. The reason is that I’m trying to annotate certain vsays (like FTDestroyObjective) with an object or a place (like BRIDGE or TANK) from the menu. The objects or places should also be possible to select standalone (without saying something along with it).

The vstr’s that do the plumbing work are globalmenu, altcmd and voicecmdstub.

  • globalmenu restores the default menu binds, and restores altcmd to default behaviour
  • altcmd executes globalmenu, and if in annotation mode also executes voicecmdstub
  • voicecmdstub is the voice say stored when selecting some vsay to annotate.

The menu definitions are in mmenu, fmenu, emenu, cmenu, smenu (voices per class), and alt1menu … alt5menu (objects/places).

Any insight appreciated…

PS: No, I didn’t forget /exec-ing the config :banana:
PS2: If this isn’t the right place to post such problems, please guide me

Kind regards,
d34dm34+


(d34dm34+) #2

Guess this isn’t the place to ask for these kind of questions…


(EB) #3

TBH…I don’t want to go through all of your ‘plumbing’.

You may find someone with more patience @ www.map-center.com


(Ifurita) #4

as EB said, there is an awful lot of plumbing. However, your configs might be too big. I think if it’s > 16 Kb, it won’t exec. Also, some any specific line of script cannot have more than x characters in it, like 235 or so. In fact, your first menu line has 262 characters in it, 309 if you include spaces. Try that and play around with it some.

For what it’s worth, my menu based scripts work fine, but it took a lot of tinkering. I also broke up the equivalents to your long lines into two pieces:


//RTCW Class selection script v7 by Ifurita with input on key variables from lots of people
//Updated for Enemy Territory and, in conjunction with et-spawn-select-v3.cfg, allows for scripted spawn point selection

//README!===============================================================

//This script is set up to use 6 keys (7, 8, 9, 0, -, and =) to control spawnpoint, team, and class selection
//My script is also set up to exec class-specific configs for each class, delete the exec *.cfg lines if you don't want this
//In order for the spawn point selection to work, you must also use et-spawn-select.cfg

//add the following line to your autoexec, "exec class-select-v7.cfg" and it should automatically load with the rest of your settings

//The first key press should always be =, that sets the main menu
//7 = spawnpoint select
//8 = team select and sets up the class and weapon selects - once you are on a team, you shouldn't have to touch this unless you change sides
//9, 0, and - class and weapon select a class

//Edited with secondary weapons of akimbo pistols and SMG, for soldiers

//1. Main Menu===============================================================

//Referee whistle sounds if you choose Team

set classmenu1 "echo ^1[=: Reset]^2[7: Spawn]^3[8: Team]^4[9: Soldier]^5[0: Support]^6[-: Covert]; vstr classmenu2"

set classmenu2 "bind 7 vstr mapmenu; bind 8 vstr teamselect1; bind 9 vstr soldiermenu; bind 0 vstr supportmenu; bind - vstr covertmenu"

bind = "vstr classmenu1"

//2. Spawn selection===========================================================

//handled in et-spawn-select-v2.cfg

//3. Team selection============================================================

//Sets the appropriate class and weapon select binds
//Team selection WILL NOT TAKE EFFECT until you select a class and weapon

set teamselect1 "echo ^1[=: Reset]^2[7: Axis Team]^3[8: Allied Team]^4[9: Spectator]^5[0: Disconnect]^6[-: Quit Game]; vstr teamselect2; play sound/misc/referee"

set teamselect2 "bind 7 vstr axis; bind 8 vstr allied; bind 9 vstr spectator; bind 0 disconnect; bind - quit"

set axis "echo ^7Joining ^1Axis^7 team upon class selection; vstr axisteam; vstr axisspawnmenu"
set allied "echo ^7Joining ^4Allied^7 team upon class selection; vstr alliedteam; vstr alliedspawnmenu"
set spectator "team spectator; say ^7Going to ^3Spectate"

//4. Allied class selections======================================================

//4.1. Soldier selection ---------------------------------------------------------------------------------------------------------------

set a-soldierselect1 "echo ^1[=: Reset]^2[7: Panzer]^3[8: Flamer]^4[9: MG42]^5[0: Mortar]^6[-: SMG];exec soldier.cfg; vstr a-soldierselect2"

set a-soldierselect2 "bind 7 vstr a-panzer; bind 8 vstr a-flamer; bind 9 vstr a-mg42; bind 0 vstr a-mortar; bind - vstr a-smg"

set a-panzer "team b 0 5 8; say_teamnl ^7--Going ^4Panzer^7--" 
set a-flamer "team b 0 6 8; say_teamnl ^7--Going ^4Flamer^7--" 
set a-mg42 "team b 0 31 8; say_teamnl ^7--Going ^4Machinegunner^7--" 
set a-mortar "team b 0 35 8; say_teamnl ^7--Going ^4Mortar^7--" 
set a-smg "team b 0 8 8; say_teamnl ^7--Going ^4Soldier^7 with SMG^7--" 

//4.2. Support class selection (Medic, Engineer, Field Ops)------------------------------------------------------------

set a-supportselect1 "echo ^1[=: Reset]^2[7: Medic]^3[8: Eng-SMG]^4[9: Eng-Garand]^5[0: Field Ops]^6[-: Not Used]; vstr a-supportselect2"

set a-supportselect2 "bind 7 vstr a-medic; bind 8 vstr a-eng-smg; bind 9 vstr a-eng-garand; bind 0 vstr a-lt"

set a-medic "team b 1 8 37; exec medic.cfg; say_teamnl ^7--Going ^4Medic^7--" 

set a-eng-smg "team b 2 8 37; exec engineer.cfg; say_teamnl ^7--Going ^4Engineer^7 with SMG--" 
set a-eng-garand "team b 2 24 37; exec engineer.cfg; say_teamnl ^7--Going ^4Engineer^7 with Garand--" 
 
set a-lt "team b 3 8 37; exec lieutenant.cfg; say_teamnl ^7--Going ^4Field Ops^7--"

//4.3. Covert class selection-------------------------------------------------------------------------------------------------------

set a-covertselect1 "echo ^1[=: Reset]^2[7: Cov-Sten]^3[8: Cov-FG42]^4[9: Cov-Garand]^5[0: Not Used]^6[-: Not Used]; vstr a-covertselect2"

set a-covertselect2 "bind 7 vstr a-cov-sten; bind 8 vstr a-cov-fg42; bind 9 vstr a-cov-garand"

set a-cov-sten "team b 4 10 37; exec covert.cfg; say_teamnl ^7--Going ^4Covert^7 with Sten--" 
set a-cov-fg42 "team b 4 33 37; exec covert.cfg; say_teamnl ^7--Going ^4Covert^7 with FG42--" 
set a-cov-garand "team b 4 25 37; exec covert.cfg; say_teamnl ^7--Going ^4Covert^7 with Garand--" 

//5. Axis class selections=====================================================

//5.1 Soldier selection ---------------------------------------------------------------------------------------------------------------

set g-soldierselect1 "echo ^1[=: Reset]^2[7: Panzer]^3[8: Flamer]^4[9: MG42]^5[0: Mortar]^6[-: SMG];exec soldier.cfg; vstr g-soldierselect2"

set g-soldierselect2 "bind 7 vstr g-panzer; bind 8 vstr g-flamer; bind 9 vstr g-mg42; bind 0 vstr g-mortar; bind - vstr g-smg"

set g-panzer "team r 0 5 3; say_teamnl ^7--Going ^1Panzer^7--" 
set g-flamer "team r 0 6 3; say_teamnl ^7--Going ^1Flamer^7--" 
set g-mg42 "team r 0 31 3; say_teamnl ^7--Going ^1Machinegunner^7--" 
set g-mortar "team r 0 35 3; say_teamnl ^7--Going ^1Mortar^7--" 
set g-smg "team r 0 3 3; say_teamnl ^7--Going ^1Soldier^7 with SMG--" 

//5.2. Support class selection (Medic, Engineer, Field Ops)------------------------------------------------------------

set g-supportselect1 "echo ^1[=: Reset]^2[7: Medic]^3[8: Eng-SMG]^4[9: Eng-K43]^5[0: Field Ops]^6[-: Not Used]; vstr g-supportselect2"

set g-supportselect2 "bind 7 vstr g-medic; bind 8 vstr g-eng-smg; bind 9 vstr g-eng-garand; bind 0 vstr g-lt"

set g-medic "team r 1 3 38; exec medic.cfg; say_teamnl ^7--Going ^1Medic^7--" 

set g-eng-smg "team r 2 3 38; exec engineer.cfg; say_teamnl ^7--Going ^1Engineer ^7with SMG--" 
set g-eng-garand "team r 2 23 38; exec engineer.cfg; say_teamnl ^7--Going ^1Engineer^7 with K43--" 
 
set g-lt "team r 3 3 38; exec lieutenant.cfg; say_teamnl ^7--Going ^1Field Ops^7--"

//5.3. Covert class selection-------------------------------------------------------------------------------------------------------

set g-covertselect1 "echo ^1[=: Reset]^2[7: Cov-Sten]^3[8: Cov-FG42]^4[9: Cov-K43]^5[0: Not Used]^6[-: Not Used]; vstr g-covertselect2"

set g-covertselect2 "bind 7 vstr g-cov-sten; bind 8 vstr g-cov-fg42; bind 9 vstr g-cov-garand"

set g-cov-sten "team r 4 10 38; exec covert.cfg; say_teamnl ^7--Going ^1Covert^7 with Sten--" 
set g-cov-fg42 "team r 4 33 38; exec covert.cfg; say_teamnl ^7--Going ^1Covert with^7 FG42--" 
set g-cov-garand "team r 4 32 38; exec covert.cfg; say_teamnl ^7--Going ^1Covert^7 with K43--" 

//6. Set team specific menus=====================================================

set axisteam "set soldiermenu vstr g-soldierselect1; set supportmenu vstr g-supportselect1; set covertmenu vstr g-covertselect1; vstr axisspawnmenu"

set alliedteam "set soldiermenu vstr a-soldierselect1; set supportmenu vstr a-supportselect1; set covertmenu vstr a-covertselect1; vstr alliedspawnmenu"

//EOF


(Ragnar_40k) #5

The size limit for cfg files is 16k. But you can avoid it by splitting up the cfg and callthe parts via the exec command from a “master” cfg.


(d34dm34+) #6

Ifurita, that seems like very good advice (max line lenght)… On to trying that.
Thanks e1!


(Ifurita) #7

Ifurita, that seems like very good advice (max line lenght)… On to trying that.

  1. Make yourself a simple little config file with a simple bind x “say_team xxxx” and a really long message.
  2. Name it text.cfg.
  3. Inside, add the line, bind x “exec test.cfg”.
  4. Keep the config open and launch ET in windowed mode
  5. Test to see if the say_team bind works
  6. If not, ALT-TAB to your config file, edit, CTRL+S to save, then ALT-TAB back to ET, and hit your bind x “exec test.cfg” key
  7. Repeat until you have the longest say_team that works.
  8. Count up the number of characters, including spaces

(d34dm34+) #8

Hi, I’ve tried your suggestions, making the definitions shorter works ok. Only problem now is remembering the key combo in-fight :). They oughta have a command for making a menu like the quick chat menu. Anyway…
Thanks again Ifurita :drink:
d34dm34+
PS: I’ve updated the link with the changes, u never know if someone’s interested (using it isn’t that practical though)