28 Mar 15, 08:08AM
How to use universal delta and domodifier (How to use your mouse scroll wheel in scripts without rebinding the scroll wheel itself. This is especially useful if you have more than one script that you want to use with the mouse scroll wheel):
Overview:
Usage:
Overview:
Step 1.) You have to define delta_[x]_[y] , where [x] is either "game", "spect", or "edit", and [y] is some number (Note, it is important to pick a number that isn't in use, otherwise you will overwrite things you may not want to). You may define the same delta number to do different things based on which mode you're in ("game" mode, spectate mode, or edit mode), or you may make them do the same regardless of what mode you are in.
Example:
Versus:
(This just copies delta game 77 to edit and spect modes)
Step 2.) Bind a "Do Modifier" command to a key. Make sure it's the same number as your previous aliases!
Example:
Step 3.) Hold the key you bound, and scroll!
Example:
[SELECT ALL] Code:
alias delta_game_77 [//Code set 1 goes here]
alias delta_edit_77 [//Code set 2 goes here]
alias delta_spect_77 [//Code set 3 goes here]
[SELECT ALL] Code:
alias delta_game_77 [//Code set goes here]
alias delta_edit_77 delta_game_77
alias delta_spect_77 delta_game_77
Step 2.) Bind a "Do Modifier" command to a key. Make sure it's the same number as your previous aliases!
Example:
[SELECT ALL] Code:
bind W [ domodifier 77 ]
Step 3.) Hold the key you bound, and scroll!
Usage:
When making the delta_[...] aliases, $arg1 will be the "input" (either 1 or -1 depending on which way you scroll the mouse wheel). For example
Will echo 1 or -1 when you hold E and scroll
Real world examples:
Note: As of the time of this writing, the X key is bound by default in this way:
which means that by default, the X key only does anything in edit mode. Also, by default (as of the time of this writing), there is only delta_edit_3 defined, not delta_game_3 nor delta_spect_3. This makes it a good choice for custom scripts that you want to use in game and spectate mode, but not in edit mode.
For example, a script I made to edit mouse sensitivity on-the-fly (Not that you'd necessarily want to do that):
This reads the 1 or -1 value from the scroll wheel ($arg1), multiplies it by 0.05, and then adds it to the current sensitivity (read from the $sensitivity variable), and then outputs the new sensitivity value. Note that I did not define delta_edit_3, as this is already bound by default. This adds functionality to the X key without interfering with it's useful functionality in edit mode
It is up to you whether you think it's best to add functionality to existing keys in this manner, or to instead bind things to unused keys
Note: At the time of this writing, the J key is not bound to anything by default.
Important! By default, only delta_spect_0 is defined; only delta_game_ 0 through 2 are defined; only delta_edit_ 0 through 11 are defined. delta_game_0 delta_edit_0 and delta_spect_0 are the functionalities used by the scroll wheel when no key is held down. If you overwrite these aliases, you will overwrite some default functionalities!
A script which allows you to scroll the console using the mousewheel:
[SELECT ALL] Code:
alias delta_game_20 [ echo $arg1 ]
bind E [ domodifier 20 ]
Real world examples:
Note: As of the time of this writing, the X key is bound by default in this way:
[SELECT ALL] Code:
editbind "X" " domodifier 3 "
For example, a script I made to edit mouse sensitivity on-the-fly (Not that you'd necessarily want to do that):
[SELECT ALL] Code:
alias delta_game_3 [
sensitivity (+f $sensitivity (*f 0.05 $arg1))
echo (concat "Sensitivity =" $sensitivity)
]
alias delta_spect_3 delta_game_3
bind X [ domodifier 3 ]
It is up to you whether you think it's best to add functionality to existing keys in this manner, or to instead bind things to unused keys
Note: At the time of this writing, the J key is not bound to anything by default.
Important! By default, only delta_spect_0 is defined; only delta_game_ 0 through 2 are defined; only delta_edit_ 0 through 11 are defined. delta_game_0 delta_edit_0 and delta_spect_0 are the functionalities used by the scroll wheel when no key is held down. If you overwrite these aliases, you will overwrite some default functionalities!
A script which allows you to scroll the console using the mousewheel:
[SELECT ALL] Code:
//You can change this to alter how quickly the mouse scrolls through the console
alias conskipmultiplier 3
alias delta_game_15 [ conskip (* $conskipmultiplier $arg1) ]
alias delta_spect_15 delta_game_15
alias delta_edit_15 delta_game 15
bind J [ domodifier 15 ]