Engine:CCMD bind: Difference between revisions

433 bytes removed ,  15 October 2023
no edit summary
No edit summary
No edit summary
Line 13: Line 13:
A 'bind' acts like a custom command for a key. It runs the assigned text as a script, which can contain a single-word command, statement, or script.
A 'bind' acts like a custom command for a key. It runs the assigned text as a script, which can contain a single-word command, statement, or script.


Aliases do not have any parameters and will run the command, statement, or script verbatim. If for example, an alias named 'bob' is set to 'echo', it will always run exactly 'echo' which will print nothing, even if you run 'bob "some text". Here the second parameter was ignored.
By default, binds do not work while input is in console or in text mode.  
 
Thus, aliases act like simple static macros. But when run they can do anything a script in the same context run by any other means could do. And because aliases are treated like commands, they can have direct key bindings.


== Examples ==
== Examples ==
Line 21: Line 19:
* Check alias 'bob' for script value. No alias exists named 'bob'.
* Check alias 'bob' for script value. No alias exists named 'bob'.
<kua>
<kua>
> alias bob
> bind Z
Unknown: bob
Unknown: bob
</kua>
</kua>