Jump to content

Recommended Posts

Posted

The toggle

Very often you see scripts posted that come without a toggle, so you can't switch it on/off easily. Here I will show you how to make one yourself.

 

This script for example, it's a duck jump script. Code:

alias "+dJump" "+jump;+duck"

alias "-dJump" "-jump;-duck"

bind "space" "+dJump"

 

 

 

As it is now it's always on, which is in some cases inconvenient, so we add a toggle. There are two ways of doing it, rebinding and realiasing, the first one is very easy to do, the second one is more complex but more flexible for when you change binds.

 

Making the rebind toggle

This thing just toggles binds between +dJump and +jump. Code:

alias "dJumpOn" "bind space +dJump;alias dJumpToggle dJumpOff"

alias "dJumpOff" "bind space +jump;alias dJumpToggle dJumpOn"

alias "dJumpToggle" "dJumpOff" // Change it to on if duck jump is off by default

bind "home" "dJumpToggle"

 

 

 

It's as easy as that, but when you change your bind you have to change the script too, of course that isn't too much of a hassle in this example, but when it gets bigger it's better to use realiasing method (which is also better for script releases to improve usability).

 

Making the realias toggle

With this method we have an alias called +doJump, when you toggle you change his function, this alias will be bound to the jump key. So when you decide that your jump key will not be the space bar, you only have to change one bind. Marvelous, isn't it? Code:

alias "dJumpOn" "alias +doJump +dJump;alias -doJump -dJump;alias dJumpToggle dJumpOff"

alias "dJumpOff" "alias +doJump +jump;alias -doJump -jump;alias dJumpToggle dJumpOn"

alias "dJumpToggle" "dJumpOff" // Change it to on if duck jump is off by default

bind "space" "+doJump"

bind "home" "dJumpToggle"

 

 

 

NOTE: since it's a meta alias (+/-alias) you have to realias both the + and - alias.

 

I hope this helped you on the way.

Credits : ELX[Draco]

Posted

lol ? u are stupid???? what want i say?.pff

 

I deleted a lot of your messages with Good Job dude keep up i'm sick of your shits.

-1 Karma for insulting a mod&spamming.

0 TOLERANCE RULE: ON

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..