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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...