Tremulous Forum

General => Troubleshooting => Topic started by: Roanoke on November 26, 2008, 03:26:57 am

Title: Binds. And vars.
Post by: Roanoke on November 26, 2008, 03:26:57 am
To save typing on my binds, I used seta to make variables through which I buy stuff I always do. Here is a specific problem.
Code: [Select]
//Buying vars
seta arm "buy bsuit; buy larmour; buy helmet;" //Choose armor
seta weapons "buy rifle;" //Weapon failsafe
seta def "sell weapons; sell upgrades;" //Reset everything

//Buying Binds
bind f3    "res; arm; weapons; echo Rifle loaded." //Offensive
It tells me that 'You can't carry multiple items of the same type' or something. Yes, bsuit does not work with larmour, but neither the bsuit nor the larmour is bought. Ideally, the bsuit would be bought if possible, otherwise a larmour and helmet.
Title: Re: Binds. And vars.
Post by: Superpie on November 26, 2008, 04:24:56 am
Code: [Select]
//Buying vars
seta arm "buy bsuit;wait;buy larmour;buy helmet;" //Choose armor
seta weapons "buy rifle;" //Weapon failsafe
seta def "sell weapons; sell upgrades;" //Reset everything

//Buying Binds
bind f3    "vstr res;vstr arm;vstr weapons; echo Rifle loaded. Superpie rocks." //Offensive
Title: Re: Binds. And vars.
Post by: Roanoke on November 26, 2008, 04:29:01 am
Hm, thanks, I'll try that out.
Edit: Works, but I get several lines of 'Must be near a powered armory' when I exec the file because of the seta lines.
Title: Re: Binds. And vars.
Post by: Superpie on November 26, 2008, 04:41:49 am
I wasn't quite sure why you used seta, I haven't had to find a use for it. Replace 'seta' with 'set' and it should work fine, I just didn't mess with it because I thought you had used it for a reason.
Title: Re: Binds. And vars.
Post by: Roanoke on November 26, 2008, 04:48:28 am
Now it's changed to 'must be living to use this command.'
Title: Re: Binds. And vars.
Post by: Bissig on November 26, 2008, 08:37:24 pm
Typical spelling error (no semicolon at the end of vstrs please(!) and mixed up variable names):

Quote
//Buying vars
seta arm "buy bsuit;wait;buy larmour;buy helmet"   //Choose armor
seta weapons "buy rifle;"            //Weapon failsafe
seta def "sell weapons; sell upgrades;"      //Reset everything

//Buying Binds
bind f3    "vstr res;vstr arm;vstr weapons; echo Rifle loaded. Superpie rocks."   //Offensive

It is either "res" or "def". Seemed as if you changed your mind inbetween writing those two vstrs.

Also, the vstr "weapons" makes no sense at all.

My suggestion:

bind f7 "vstr choosearmor"
set choosearmor "vstr armor1"
set armor1 "sell upgrades; buy bsuit; echo Battlesuit bought; set choosearmor vstr armor2"
set armor2 "sell upgrades; buy larmor; buy helmet; echo Light armor set bought; set choosearmor vstr armor1"
Title: Re: Binds. And vars.
Post by: Roanoke on November 26, 2008, 11:56:22 pm
That's old code, so res and def are one in my current code.
I think I can live with errors.