Navigation

How can i make a vstr code that changes what my mouse do when i press an diffident button?

xanrer

Member

This is what i tried but it doesn't seem to work :/

bind KP_1"setmode1"
bind KP_2"setmode2"

seta setmode1 "vstr mode1m1; vstr mode1m2"
seta mode1m1 "bind MOUSE1"+speed_throw;attack""
seta mode1m2 "bind MOUSE2"+speed_throw;attack"" //dont mind this one
seta setmode2 "vstr mode2m1; mode2m2"
seta mode2m1 "bind Mouse1"+attack;+reload;-reload;weapnext;wait 5;weapprev;+attack;wait 5;-attack;wait 1""
seta mode2m2 "bind MOUSE2"+speed_throw;weapnext; wait 2; weapnext""



Posted on 27.12.2018 / 21:53 - Edited by xanrer on 27.12.2018 / 21:54

REPLIES

T-Max

Member

vstr executes dvar value as sequence of console commands.
bind f1 "vstr setmode1" will make F1 execute setmode1 dvar value.
You can add "vstr setmode2" in your setmode1 dvar which means if you execute setmode1 - it'll execute setmode2 too.
Schematic:
bind f1 "vstr A1"
seta A1 "vstr AA1; bind f1 \"vstr A2\";A1" // last command just to echo what has been done. (unknown cmd: A1)
seta A2 "vstrAA2; bind f1 \"vstr A1\";I_can_write_here_anything" // last command just to echo what has been done. (unknown cmd: I_can_write_here_anything)
seta AA1 "bind mouse1 BLABLABLA; bind mouse2 BLABLABLA"
seta AA2 "bind mouse1 bla-bla-more; bind mouse2 bla-bla-more"


#MakeCFGFactoryGreatAgain

Posted on 28.12.2018 / 13:40

xanrer

Member

pardon me if im doing anything wrong but after changing blabla with the commands its not working (it was working with just blabah)

here is the code


bind F2 "vstr A1\""
seta A1 "vstr AA1; bind f2 vstr A2"
seta A2 "vstr AA2; bind f2 vstr A1"
seta AA1 "bind mouse1 +attack; bind MOUSE2 +speed_throw;weapnext; wait 2; weapnext"
seta AA2 "bind mouse1 +attack;+reload;-reload;weapnext;wait 5;weapprev;+attack;wait 5;-attack;wait 1; bind MOUSE2 +speed_throw;"



Posted on 28.12.2018 / 22:22 - Edited by xanrer on 28.12.2018 / 22:23

T-Max

Member

You have to guard each bind command parameters with " symbol. Symbols " inside "s must be guarded with escape-sequence \":
bind f1 "command1; bind f1 \"command11; command12\"; command3"
So each command for f1 is separated by ;. First command is "command1", second is and third is "command3".
When you hit F1 for first time, it'll execute command1, command2 (bind one) and command3. When you again hit F1 it'll execute command11, command12.

Just read what you wrote:
bind F2 "vstr A1\""


#MakeCFGFactoryGreatAgain

Posted on 29.12.2018 / 15:45

xanrer

Member

I see, thank you very much!


Posted on 31.12.2018 / 1:19

Post reply

ONLY USERS CAN POST REPLIES.