The
This twistbinds the Nunchuk button to executing the String value of "toggleInfiniteAmmo" which is "toggle player_sustainammo".
Note that the following does the same thing:
So why do we even need vstr?
It can be used to store and reuse certain commands or for toggling controls.
A "complex" example:
By default, twisting the Wii Remote and pressing toggles noclip. Twisting and pressing toggles god mode. Why? The new dvars aButton and minusButton are set to the "noclip" and "god" commands.
What happens though if we twist the Wii Remote and press ? The value of "toggleControls" is executed. That again executes "controlsTwo" which sets the "aButton" dvar to "notarget", "minusButton" dvar to "toggle timescale 1 2 0.2" and the "toggleControls" dvar to execute "controlsOne".
Now if we twist the Wii Remote again and press it will toggle notarget. will toggle the game speed through 3 different values.
When we twist the Wii Remote and press a 2nd time it will now execute the value of "controlsOne" which is sets the "aButton", "minusButton" and "toggleControls" dvar to their original values again.
Therefore, what this construct using vstr allowed us to do was making toggleable controls instead of being fixed to a certain command or sequence of commands.
I hope you learned something. Post if you have any questions about this.
Sources:
http://www.cfgmodding.com/tutorials/introtovstr.php
http://www.cfgmodding.com/tutorials/advancedvstr.php
- Code:
vstr
- Code:
twistbind WII_C "vstr toggleInfiniteAmmo"
set toggleInfiniteAmmo "toggle player_sustainammo"
This twistbinds the Nunchuk button to executing the String value of "toggleInfiniteAmmo" which is "toggle player_sustainammo".
Note that the following does the same thing:
- Code:
twistbind WII_C "toggle player_sustainammo"
So why do we even need vstr?
It can be used to store and reuse certain commands or for toggling controls.
A "complex" example:
- Code:
twistbind WII_A "vstr aButton"
twistbind WII_MINUS "vstr minusButton"
twistbind WII_PLUS "vstr toggleControls"
set aButton "noclip"
set minusButton "god"
set toggleControls "vstr controlsTwo"
set controlsTwo "set aButton notarget;set minusButton toggle timescale 1 2 0.2;set toggleControls vstr controlsOne"
set controlsOne "set aButton noclip;set minusButton god;set toggleControls vstr controlsTwo"
By default, twisting the Wii Remote and pressing toggles noclip. Twisting and pressing toggles god mode. Why? The new dvars aButton and minusButton are set to the "noclip" and "god" commands.
What happens though if we twist the Wii Remote and press ? The value of "toggleControls" is executed. That again executes "controlsTwo" which sets the "aButton" dvar to "notarget", "minusButton" dvar to "toggle timescale 1 2 0.2" and the "toggleControls" dvar to execute "controlsOne".
Now if we twist the Wii Remote again and press it will toggle notarget. will toggle the game speed through 3 different values.
When we twist the Wii Remote and press a 2nd time it will now execute the value of "controlsOne" which is sets the "aButton", "minusButton" and "toggleControls" dvar to their original values again.
Therefore, what this construct using vstr allowed us to do was making toggleable controls instead of being fixed to a certain command or sequence of commands.
I hope you learned something. Post if you have any questions about this.
Sources:
http://www.cfgmodding.com/tutorials/introtovstr.php
http://www.cfgmodding.com/tutorials/advancedvstr.php
Last edited by Bully@WiiPlaza on 10/31/2014, 12:27 am; edited 1 time in total