Using the "toggle" command


(Codman) #1

Heya,

can anybody out there help me to configure my mouse?
I want to switch between weaponbank 5 & weaponbank 6 with MOUSE5.
I tried "bind MOUSE5 “toggle weaponbank 5; weaponbank 6” but that didn’t work
Anybody ideas?

Thx in advance.

Codman


(Kendle) #2

set weap5 "weaponbank 5; set weaptog vstr weap6"
set weap6 "weaponbank 6; set weaptog vstr weap5"
set weaptog "vstr weap5"
bind MOUSE5 "vstr weaptog"


(Codman) #3

Thank you very much - this is WAY more complicated to make than I thought :slight_smile: :drink:


(Kendle) #4

The toggle command is used for swapping a variable between binary values (i.e. 0 and 1). You might use it with drawgun for instance:-

bind MOUSE5 “toggle cg_drawgun”

This would hide and unhide your gun by pressing MOUSE5.

There is however a cycle command in ET that may work. Try this:-

bind MOUSE5 “cycle weaponbank 5 6”

I only use the example I gave earlier cos a) I know it works and b) I’m too lazy to convert all my RTCW scripts to ET alternative formats.


(Codman) #5

Got another issue;

I copy & paste your script into my cfg, save it properly, and it works.
If I start the game later, it isn’t working - and the code is gone from the cfg.
wtf is happening?

thx


(Bludd) #6

Create a file called autoexec.cfg in etmain/ and put the code in there.


(Codman) #7

Thanx, did that too - still having trouble, sometimes it just switches to ammo packs, but don’t swith farther to the airstrike-grenade.
why?
I’ve copied the autoexec into etpro and etmain, still dunno whats wrong …


(Kendle) #8

The problem is there are separate configs for each mod (etmain / etpro, etc.).

autoexec.cfg only needs go in etmain. However, if the etpro folder already existed when you created / last amended autoexec.cfg the amendments won’t have been added to the ETPro “copy” of your config.

Delete the file etpro\profiles[i]yourname[/i]\etconfig.cfg and it should re-copy (the uptodate version of) your etmain config to the etpro folder.


(Codman) #9

Done - hope it works, anyway, thank you very much for the patience with me :slight_smile:

Another question (yes, my scripting skills suck :smiley: ) how do I bind that when I throw a grenade there’s a “fireinthehole” message to my team?
Must be something like “weaponbank 3” “vsay fireinthehole” but how in the hell do I combine them?

Thx again :slight_smile:


(Kendle) #10

You could add the vsay to the key that you use to select the Grenade, like so:-

bind x “weaponbank 4; wait 100; vsay_team FireInTheHole”

but what if you select it then don’t throw it? To make it so it happens when you throw it you’d need to bind it to your attack key (MOUSE1?), but then you’d need to unbind the vsay for all other weapons.

The wait 100 by the way instructs your PC to wait 100 “frames”, which is not a precise period of time and will vary from PC to PC. You may need to adjust the number up or down until it works.


(Codman) #11

Thank you again. :drink:

Hm, you are right, I think I’ll use the “fireinthehole”-command seperately.


(Bludd) #12

The problem with an automated nade script is cooking. You want to be able to cook your nades before throwing. For a Field Ops though, the airstrike canister is good for using an automated script. Here’s a commonly used scipt for Field Ops:

bind x “weaponbank 5; +attack; wait 90; -attack; vsay_team FireInTheHole; weaponbank 3”

Change “x” to whatever key you like, then when pressed you will equip the smoke canister, throw it, say “Fire In The Hole!”, then switch back to the SMG.


(Ifurita) #13

set prime “weaponbank 4; wait 10; +attack”
set release “-attack; weaponbank 3; wait 10; vsay_team fireinthehole”
bind x"+vstr prime release"


(askin'george) #14

Thanx, did that too - still having trouble, sometimes it just switches to ammo packs, but don’t swith farther to the airstrike-grenade.
why?
I’ve copied the autoexec into etpro and etmain, still dunno whats wrong …[/quote]

If u set ur own variables…and u want them to stay…use: seta

seta weap5 “weaponbank 5; set weaptog vstr weap6”
seta weap6 “weaponbank 6; set weaptog vstr weap5”
seta weaptog “vstr weap5”
bind MOUSE5 “vstr weaptog”

anyways, I personally have a setup file…that i can exec by bind…and then i always got it right…

i use this single setup file to set all binds and “activate” for an example toggle scripts…at the end of that setupfile…it execs other cfg’s (spawn/classscript etcetc).


(Codman) #15

That’s a nice one, thank you!


(Kendle) #16

Not necessary, seta is broken in ET.

cg_drawgun 1
set cg_drawgun 1
seta cg_drawgun 1

all do the same thing.

If a seta cg_drawgun line already exists in etconfig.cfg ALL of the above will save the new value.

If a seta cg_drawgun line does NOT already exist in etconfig.cfg NONE of the above will save the new value.