Cubescript is a low-level language that can execute aliases and commands in AssaultCube. With it, is it possible to create strings from commands which already exist in the game - CubeScript modifies no code. It is very similar to the Quake console language and was designed to be largely backwards compatible to it; it has quite a number of enhancements though and it is a very powerful way to interact with the engine and tweak your personal gaming experience.
The most simple usage might just possibly be the binding of keys. But from there it is just a small step to some more interactive usage. This example of CubeScript announces a player's current weapon, as well as their ammo and ammo reserves, when the player presses 'HOME'.
alias gun_names "knife pistol carbine shotgun subgun sniper assault null grenade akimbo" alias my_gun_state [ concat I am carrying the (at $gun_names (curweapon)) with (magcontent (curweapon)) rounds loaded of (magreserve (curweapon)) total ] bind HOME [ say "%" (my_gun_state) ]
CubeScript can become very complex and be very handy if used correctly. For example, scripts exist from automatically changing weapons if out of ammo, to admin scripts which search a file for a password on a particular server.
Some more information can be found in the AssaultCube docs: http://assault.cubers.net/docs/cubescript.html
You'll need to use the control-character "\f" (form-feed). Since patch 1.0.1, AC supports escaping of control characters for certain commandline arguments. If you need to use it interactively (in-game), you'll want to know it has the ASCII-code of 12;
- on linux you should be able to create it with Ctrl + L (ingame or in an editor) or Ctrl + V and then L (on the shell)
- on windows you should be able to create it via Alt-Gr + 1 + 2 (NumKeyPad). The key combination Ctrl-Alt can be used instead of AltGr if you don't have that key.
- you can also use Media:Control_char_formfeed.txt (use "Save Link as..." from your browser!)
- an example is provided in Media:Example_coloured_motd.txt
Colourization (this also applies for CubeScript/ingame colours) works via the control-char followed by an indication character. Apart from the special cases of "\fs" and "\fr" for saving/restoring previously set colours in the current line of text, you can use the following numbers to set to the respective colour (see table).
From versions 1.1 and onward, there is an alternative way to colourize text. Prepend (c n) before strings in CubeScript, where n is the colour number. If you enter in an invalid number, it will revert back to the normal color. The following example will put out "This is green." in green text, the second one will print "This is not green." in white (default).
echo (c 0) "This is green." echo (c x) "This is not green."
- GeSHiCodeTag - how to syntax-highlight your CubeScript examples