Engine:CCMD bind: Difference between revisions

143 bytes removed ,  15 October 2023
no edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 8: Line 8:


== Associations ==
== Associations ==
*Key bindings are global, and not a part of any context.
* Key bindings are global, and not a part of any context.


== Details ==
== Details ==
Line 39: Line 39:


=== Key states ===
=== Key states ===
* 'bob' called without a value. No command, variable or alias named 'bob' exist.
* '+zoom' called without a value. No command, variable or alias named '+zoom' exist.
<kua>
<kua>
> bob
> +zoom
Unknown: bob
Unknown: +zoom
</kua>
</kua>
* Create an alias 'bob' and set to 'fred'.  
* Create an alias for '+zoom' and '-zoom'.  
<kua>
<kua>
> alias bob fred
> alias +zoom "set fov 45; print 'zoom is 45'"
> alias -zoom "set fov 90; print 'zoom is 90'"
</kua>
</kua>
* Same as the first example, but now alias 'bob' exists. The 'fred' command in the 'bob' alias script runs, and 'fred' doesn't exist.
* Create a binding for the 'Z' key.
<kua>
<kua>
> bob
> bind Z +zoom
Unknown: fred
</kua>
</kua>
* Create variable 'fred'.
* Close console and press and release the 'Z' key. Zooms in and out and prints zoom messages.
<kua>
<kua>
> var fred james
zoom is 45
</kua>
zoom is 90
* Run 'bob'
<kua>
> bob
'fred' is 'james'
</kua>
* Try to set 'fred' through 'bob'. Value remains the same because 'bob' is only the statement "fred".
<kua>
> bob alan
> bob
'fred' is 'james'
</kua>
</kua>


== Notes ==
== Notes ==
*
*