This reference describes the commands and variables available in AssaultCube.
This section describes identifiers that are closely related to the CubeScript language. Performs an addition. Example: echo the sum of x and y is (+ $x $y) Performs a subtraction. Performs a multiplication. Performs a division. Performs a modulo operation. Determines if two values are equal. Determines if a value is smaller than a second value. Determines if a value is bigger than a second value. Determines if two strings are equal. Controls the script flow based on a boolean expression. $x 10) [ echo x is bigger than 10 ] [ else x too small ] ]]> Loops the specified body. This command sets the alias "i" from 0 to N-1 for every iteration. Loops the specified body while the condition evaluates to true. This command sets the alias "i" from 0 to N-1 for every iteration. Note that the condition here has to have [], otherwise it would only be evaluated once. Concatenates multiple strings with spaces inbetween. The newly created string is saved to the alias 's'. output: hello world Concatenates multiple strings. The newly created string is saved to the alias 's'. output: CubeScript Grabs a word out of a string. The word is saved to the alias 's'. output: two Executes a command after specified time period. Prints 'foo' to the screen after 1 second.
This section describes gameplay related identifiers. Sets the nick name for the local player. Outputs text to other players. If the text begins with an percent character (%), only team mates will receive the message. Puts a prompt on screen. this puts a prompt on screen where you can type stuff into, which will capture all keystrokes until you press return (or esc to cancel). If what you typed started with a "/", the rest of it will be executed as a command, otherwise its something you "say" to all players. Connects to a server. If the server name ist omitted, the client will try to connect to an available server in the LAN. If the port is omitted or set to 0, the default port will be used. connect 127.0.0.1 555 myServerPassword Connects to a server and tries to claim admin state. This command will connect to a server just like the command 'connect' and try to claim admin state. If the specified password is correct, the admin will be able to connect even if he is locked out by ban, private master mode or taken client slots. If successfully connected, bans assigned to the admin's host will be removed automatically. If all client slots are taken a random client will be kicked to let the admin in. If the server name ist omitted, the client will try to connect to an available server in the LAN. connect 127.0.0.1 myAdminPassword Leaves a server. Sets the team for the local player. team CLA Shows or hides the scores. Changes the weapon. Returns contents of current magazine. Returns contents of magazine reserve. Set gameplay mode to N for the next game played (next map load). Sends the current map to the server and sends other players a message about it. If the map argument is specified, the map is first saved and then reloaded before sending it. Note its always required to be on the map one wants to send before issuing this command! Retrieves the last map that was sent to the server using 'sendmap'. Starts recording of a demo. This works for any multiplayer mode, including the default "ffa" mode you are in when you load up a map locally. The file is saved to demos/S.cdgz. Stops any demo recording or playback. Plays a recorded demo. Playback is interpolated for the player whose perspective you view. Shifts the camera to an other demo player Indicates if the footsteps sound should be played Maximum time span between player animation and the playback of the footstep sound If the footstep sound would be played immediately when entering the radius of the other player, it would not be synchronous to the player model animation. Turns on/off display of fps/rendering stats on the HUD. Sets the playback speed for a demo. To see the effect, the variable must be set before playing a demo. Changes the demo playback delay. Only touch if you know what you are doing: changes the delay in msec with which the demo is played back to allow for interpolation. Default is 100, if you decrease it you will most likely just get choppier (it will obstruct the spline interpolation) for an unnoticable bit less lag. Increase it if you notice choppyness in playback, should not be needed in general, but may help if you insist on playing back demos at very low demoplaybackspeed. Specifies if particles should be emitted on demo players position. When demotracking is on (B = 1), the camera will create a red particle every frame where it moves, creating a trail. This can be used to inspect someone's movement in a game. It will only show the last N particles according to the maxparticles variable, which you may want to increase to 10000. The particles will remain even after you stop the demo, so you can use edit mode to look at it from all angles. Sets the gamespeed in percent. This does not work in multiplayer. For entertainment purposes only :)
This section describes general identifiers. Claims or drops master status. Claiming master status is only possible if no other player is already master. In the scoreboard, the master is marked green. Claims or drops admin status. Successfully claiming admin status revokes other players master or admin state automatically. Failed logins result in an auto kick. The admin is granted the right to kick, ban, remove bans, set autoteam and change the mastermode. In the scoreboard, the admin is marked red. Kicks a specified player from the server. Requires master or admin state. Bans a specified player from the server. Requires master or admin state. The ban duration is fixed to 20 minutes. Removes all bans on the server. Requires master or admin state. Sets the automated team assignement. Requires master or admin state. Sets the mastermode for the server. Requires master or admin state. If the mastermode is set to 'private', no more clients can join the server. Default is 'open' that allows anyone to join the server. Forces a specified player to join the enemy team. Requires master or admin state. Gives the master state to specified player. Requires admin state. The admin will lose his admin state after successfully issuing this command. Adds a new section to the ingame documentation. Adds a new identifier documentation to the last added section. An identifier represents a command or variable. The new identifier The name may countain spaces to create a "multipart" identifier documentation that can be used to describe a complex argument as a single pseudo identifier, look at the examples. docident fov "Sets the field of view." docident "newent light" "Adds a new light entitiy." Adds a new argument documentation to the last added identifier. An argument represents either a command argument or a variable value. The last argument of an identifier can be flagged as variable-length to indicate that it represents an unknown number of arguments. Adds a new documentation remark to the last added identifier. Adds an example to the last added identifier. Adds a new documentation reference to an identifier. The new reference is added to the last added identifier documentation. Outputs a list of yet undocumented identifiers (commands,variables, etc) If the one argument is omitted, only the builtin identifiers will be listed. Therefore specify the argument other identifers like aliases should be included too. Note that the list also includes identifiers that contain the substrings "TODO" or "UNDONE" in their documentation. Outputs a list of identifer documentations that do not match any existing identifer. Multipart identifiers are not included in this list, see 'docident'. Searches the ingame docs for identifier documentations matching the specified search string. The name, description and remarks are included in the search. Writes out a base XML documentation reference containing templates for the builtin identifiers. The generated reference is written to "config/autogenerated_base_reference.xml" by default. The three arguments can be changed later on in the generated XML document. Loads up a map in the gamemode set previously by the 'mode' command. If connected to a multiplayer server, votes to load this map (others will have to type "map M" as well to agree with loading this map). To vote for a map with a specific mode, set the mode before you issue the map command (see multiplayer menu). A map given as "blah" refers to "packages/base/blah.cgz", "mypackage/blah" refers to "packages/mypackage/blah.cgz". At every map load, "config/default_map_settings.cfg" is loaded which sets up all texture definitions, etc. Everything defined in there can be overridden per package or per map by creating a "package.cfg" or "mapname.cfg" which contains whatever you want to do differently from the default. When the map finishes it will load the next map when one is defined, otherwise reloads the current map. You can define what map follows a particular map by making an alias like (in the map script): alias nextmap_blah1 blah2 (loads "blah2" after "blah1"). TODO: multiplayer voting Triggers a jump. default keys: space and right mouse. Contacts the masterserver and adds any new servers to the server list. The servers are written to the config/servers.cfg file. This menu can be reached through the Multiplayer menu. Allows to browse through the console history by offsetting the console output. Returns the number of milliseconds since engine start. echo (millis) Binds a key to a command. To find out what key names and their default bindings are, look at config/keymap.cfg, then add bind commands to your autoexec.cfg. Executes a command on the release of a key/button. This command must be placed in an action in a bind or in an alias in a bind. bind CTRL [ echo "key pressed"; onrelease [ echo "key released" ] ] Binds a name to commands. It is possible to re-bind an alias, even during its evaluation. Example: alias myalias [ echo "hello world"; alias myalias [ echo "I already said hello" ] ] Quits the game without asking. Moves the player forward. default keys: W and Up Arrow Moves the player backward. default keys: S and Down Arrow Moves the player left. default keys: A and Left Arrow Moves the player right. default keys: D and Right Arrow Fires the current weapon. default: left mouse button Sets mouse to "flight sim" mode. Sets the field of view (fov). Sets the minimum number of milliseconds a frame should take. This is for very fast machines that run Cube at hundreds of fps. Default is 5, i.e. try to stay close to 200fps. This command is not exact, i.e. the precise delay it generates depends on OS and other factors... experiment with your ideal setting. Sets the fog distance. You can do this for tweaking the visual effect of the fog, or if you are on a slow machine, setting the fog to a low value can also be a very effective way to increase fps (if you are geometry limited). Try out different values on big maps / maps which give you low fps. Sets fog and clearing colour. This and the fog variable can be set in the map config file. Takes a screenshot. Screenshots are saved to "screenshots/screenshotN.bmp", where N is the number of milliseconds since the game was launched. Sets the music volume. Executes all commands in a specified config file. Creates a new menu. Creates a new menuitem. If the action argument is omitted, then it will be set to the same value as the description. Upon pressing return, the associated action will be executed. See config/menus.cfg for examples. Displays the specified menu. The menu allows the user to pick an item with the cursor keys. Upon pressing return, the associated action will be executed. Pressing ESC will cancel the menu. Executes the specified command in the command line history. For example, binding "history 0" to a key allows to quickly repeat the last command typed in (useful for placing many identical entities etc.) Sets up the keymap for the specified key. You should never have to use this command manually, use "bind" instead. Sets the mouse sensitivity. With 'sensitivityscale' you can specify a number that the sensitivity is divided by. Adds a server to the list of server to query in the server list menu. Specifies a model to render while displaying the last added menu. Changes the menu model of a specified menu. Clears the list of secured maps. Adds a map to the list of secured maps. Secured maps can not be overwritten by the commands sendmap and getmap. Recreates the minimap for the current map. Sets the team display mode. In mode 1 players will be rendered with a colored vest to make the teams distinguishable. In mode 2 almost the whole suit of the players will be colored. These display modes are only applied in team gamemodes. Sets the size/resolution of the dynamic shadow data. Sets the display size of the dynamic shadows. Sets if dynamic shadows should be saved to disk. Sets the alpha value (transparency) for dynamic shadows. Holds the current game mode. Enables or disables fullscreen. Not supported on Windows and Mac. Sets the level of fullscreen antialiasing (FSAA). Sets the screen width. Sets the screen height. Sets the bits per pixel value. Sets the bits for the depth buffer. Enables or disables vsync. Sets the resolution for the minimap. Indicates if a connection to a server exists. Sets the size of your crosshair. The crosshair is turned off entirely if the size is set to 0. Turns on or off crosshair effects. When on, the crosshair will go grey when the weapon is reloading, orange when health se 50 or red when se 25. Sets the maximum value the display will roll on strafing. Allows to finetune the amount of "error" the mipmapper/stripifier allow themselves for changing lightlevels. If this variable is changed this during play, a "recalc" is needed to see the effect. Indicates if the weapons should be reloaded automatically. Determines wether dynamic shadows and lights are rendered, providedjust incase they slow your fps down too much. With radius you can specify the radius of a dynamic light, smaller to maybe gain some speed (0 is off entirely), or bigger to see the effect of dynamic shadows more dramatically (try shooting it past some pillars that have a dark area on the other side... or use the "gamespeed" variable). Determines the subdivision of the water surface in maps. Must be a power of 2: 4 is the default, 8 is recommended for people on slow machines, 2 is nice for fast machines, and 1 is quite OTT. See "waterlevel" (edit reference) on how to add water to your own levels. Sets the sound volume. Sets the clients maximum downstream bandwidth. Leaving it at 0 (the default) means the server will dynamically try to do the best thing, this is recommended for players who don't have a clue what their bandwidth is (setting your rate unoptimally is worse than not setting it all). Modem players (56k) could try rate 4000 and tweak from there, dsl players can try rate 6000-10000. Note that the more players on a server, the more critical the effect of your rate. If you are tweak addicted, you can try playing with the variables throttle_decel (how quickly to start dropping packets when your connection becomes bandwidth limited) throttle_accel (how quickly to recover once bandwidth becomes available again) and throttle_interval (how quickly to reestimate the situation). Change the defaults at your own risk. Sets the sound buffer length. Tweak this if you experience stuttering or lagging sound. Sets the hardware gamma value. May not work if your card/driver doesn't support it. Used to finetune the "overbright lighting" rendering feature when enabled. After changing this value, a "recalc" is needed to see the differences. Scales all particles. Sets the time available for interpolation between model animations.
In map edit mode you can select bits of the map by clicking or dragging your crosshair on the floor or ceiling (using the "attack" identifier, normally MOUSE1), then use the identifiers below to modify the selection. While in edit mode, physics and collision don't apply (noclip), and key repeat is ON. Note that if you fly outside the map, cube still renders the world as if you were standing on the floor directly below the camera. Hotkey E Default keys are the six keys above the cursor keys, which each 2 of them cycle one type (and numpad 7/4 for upper). The way this works is slightly strange at first, but allows for very fast texture assignment. All textures are in 3 individual lists for each type (both wall kinds treated the same), and each time a texture is used, it is moved to the top of the list. So after a bit of editing, all your most frequently used textures will come first when pressing these keys, and the most recently used texture is set immediately when you press the forward key for the type. These lists are saved with the map. make a selection (including wall bits) and press these keys to get a feel for what they do. Default keys are [ and ] for floor level, and o/p for ceiling. makes the current selection all solid (i.e. wall) or all non-solid. This operation retains floor/ceiling heights/textures while swapping between the two. Default keys f and g respectively. Levels the floor/ceiling of the selection. default keys , and . Marks the current selection as a heightfield. marks the current selection as a heightfield, with T being floor or ceiling, as above. A surface marked as heightfield will use the vdelta values (see below) of its 4 corners to create a sloped surface. To mark a heightfield as normal again (ignoring vdelta values, set or not) use "solid 0". Default keys are h (floor) and i (ceiling). Heightfields should be made the exact size that is needed, not more not less. The most important reason for this is that cube automatically generates "caps" (side-faces for heightfields) only on the borders of the heighfield. This also means if you have 2 independant heightfields accidentally touch eachother, you will not get correct caps. Also, a heighfield is slightly slower to render than a non-heighfield floor or ceiling. Last but not least, a heightfield should have all the same baseheight (i.e. the height determined by a normal editheight operation) to get correct results. changes the vdelta value of the current selection Note that unlike all other editing functions, this function doesn't affect a cube, but its top-left vertex (market by the dot in the editing cursor). So to edit a N * M heightfield, you will likely have to edit the vdelta of (N+1) * (M+1) cubes, i.e. you have to select 1 row and 1 column more in the opposite direction of the red dot to affect all the vertices of a heightfield of a given size (try it, it makes sense :) A floor delta offsets vertices to beneath the level set by editheight (and a ceil delta to above). Delta offsets have a precision of a quarter of a unit, however you should use non-unitsize vertices only to touch other such vertices. Default keys are 8 and 9 to decrease/increase the vdelta. Makes the current selection into a "corner". Currently there is only one type of corner (a 45 degree one), only works on a single unit (cube) at a time. It can be positioned either next to 2 solid walls or in the middle of 2 higher floorlevels and 2 lower ones forming a diagonal (and similar with ceiling). In both cases, the corner will orient itself automatically depending on its neighbours, behaviour with other configurations than the 2 above is unspecified. Since the latter configuration generates possibly 2 floor and 2 ceiling levels, up to 4 textures are used: for example for the 2 floors the higher one will of the cube itself, and the lower one of a neighbouring low cube. You can make bigger corners at once by issuing "corner" on grid aligned 2x2/4x4/8x8 selections, with equal size solid blocks next to them. Multi-level undo of any of the changes caused by editing operations hotkey u Sets the number of megabytes used for the undo buffer. undo's work for any size areas, so the amount of undo steps per megabyte is more for small areas than for big ones (a megabyte fits 280 undo steps on a 16x16 area, but only 4 steps on a 128x128 area). Copies the current selection into a buffer. hotkey c Pastes a previously copied selection. To paste a selection back requires a same size selection at the destination location. If it is not the same size the selection will be resized automatically prior to the paste operation (with the red dot as anchor), which is easier for large selections. hotkey v Repeats the last texture edit thruout the map. The way it works is intuitive: simply edit any texture anywhere, then using "replace" will replace all textures thruout the map in the same way (taking into account wether it was a floor/wall/ceil/upper too). If the there was more than one "old" texture in your selection, the one nearest to the red dot is used. This operation can't be undone. Adds a new entity (x,y) is determined by the current selection (the red dot corner) and z by the camera height, of said type. Type is a string giving the type of entity, such as "light", and may optionally take values (depending on the entity). Adds a new light entity if only argument R is specified, it is interpreted as brightness for white light. Adds a new spawn spot. The yaw is taken from the current camera yaw. Adds a new ammo box item. Adds a new clip item. Adds a new grenades item. Adds a new health item. Adds a new armour item. Adds a new armour item. Adds a new akimbo item. Adds a map model, i.e. an object rendered as md2/md3 which you collide against but has no behaviour or movement The mapmodel identifier is the desired map model which is defined by the 'mapmodel' command. The map texture refers to a texture which is defined by the 'texture' command, if omitted the models default skin will be used. The 'mapmodel' and 'texture' commands are placed in the map config normally. Mapmodels are more expensive than normal map geometry, do not use insane amounts of them to replace normal geometry. Adds a CTF flag entity. Note that this entity is only rendered as flag if the current game mode is CTF. Adds a ladder entity. Note that this entity is used for physics only, to create a visual ladder you will need to add a mapmodel entity too. Adds a sound entity. Will play map-specific sound so long as the player is within the radius. However, only up to the max uses allowed for N (specified in the mapsound command) will play, even if the player is within the radius of more N sounds than the max. By default (size 0), the sound is a point source. Its volume is maximal at the entity's location, and tapers off to 0 at the radius. If size is specified, the volume is maximal within the specified size, and only starts tapering once outside this distance. Radius is always defined as distance from the entity's location, so a size greater than or equal to the radius will just make a sound that is always max volume within the radius, and off outside. Deletes the entity closest to the player hotkey x Changes property of the closest entity. For example 'entproperty 0 2' when executed near a lightsource would increase its radius by 2. Deletes all entities of said type. Recomputes all there is to recompute about a map, currently only lighting. hotkey R Saves the current map. savemap makes a versioned backup (mapname_N.BAK) if a map by that name already exists. If the name argument is omitted, it is saved under the current map name. Where you store a map depends on the complexity of what you are creating: if its a single map (maybe with its own .cfg) then the "base" package is the best place. If its multiple maps or a map with new media (textures etc.) its better to store it in its own package (a directory under "packages"), which makes distributing it less messy. Creates a new map. The new map has 2^S cubes. For S, 6 is small, 7 medium, 8 large. Enlarges the current map. This command will make the current map 1 power of two bigger. So a 6 size map (64x64 units) it will become a 7 map (128x128), with the old map in the middle (from 32-96) and the new areas solid. Sets the map message, which will be displayed when the map loads. For example: mapmsg "Map By Author". Sets the global water level for the map. Every cube that has a lower floor than the water level will be rendered with a nice wavy water alpha texture. Water physics will be applied to any entity located below it. Performance notes: water is rendered for a whole square encapsulating all visible water areas in the map (try flying above the map in edit mode to see how). So the most efficient water is a single body of water, or multiple water areas that are mostly not visible from eachother. Players can influence how accurate the water is rendered using the "watersubdiv" command (map config). Sets all light values to fullbright. Will be reset when you issue a 'recalc'. Only works in edit mode. Toggles between showing what parts of the scenery are rendered. Shows hat parts of the scenery are rendered using what size cubes, and outputs some stats too. This can give mappers hints as to what architecture to align / textures to change etc. Turns occlusion culling on and off. The reason one may want to turn it off is to get an overview of the map from above, without having all occluded bits stripped out. Sets the texture slot to 0 for the subsequent "texture" commands. Binds a texture to the current texture slot. Binds the texture indicated in filename to the current texture slot, then increments the slot number. This is for use in map configs only. A secondary textures can be specified for a single texture slot, for use in shaders and other features (unused for now, should be set to 0 to indicate primary texture). Makes a slope out of the current selection. The selection must be a heighfield before this command can be used. The steps specify the slope with the red vertex as left-top, i.e. "slope 1 2" will make a slope that increases just 1 step from left to right, and is slightly steeper from top to bottom. "slope -6 0" decreases steeply from left to right, and does not slope at all from top to bottom. Note that like the vdelta command, an increasing vdelta goes further away from the player, regardless of floor or ceiling. Makes an arch out of the current selection. The selection must be a heighfield before this command can be used. Will make the arch in the long direction, i.e when you have 6x2 cubes selected, the arch will span 7 vertices. Optionally, sidedelta specifies the delta to add to the outer rows of vertices in the other direction, i.e. give the impression of an arch that bends 2 ways (try "arch 2" on an selection of atleast 2 thick to see the effect). Not all arch sizes are necessarily available, see config/prefabs.cfg. Defines a vertex delta for a specific arch span prefab, used by the 'arch' command. See config/prefabs.cfg for an example on usage. Generates a perlin noise landscape in the current selection. Keep the seed the same to create multiple perlin areas which fit with eachother, or use different numbers if to create alternative random generations. Selects the given area, as if dragged with the mouse. This command is useful for making complex geometry-generating scripts. The current dimensions of the selection (either created by the user or this command) are in the variables selx, sely, selxs and selys and can also be read/modified. Coordinates are as follows: after a "newmap 6" the top-left corner (the one where the red dot points) are (8,8), the opposite corner is (56,56) (or (120,120) on a "newmap 7" etc.). Registers a sound. This command returns the sound number, which is assigned from 0 onwards, and which can be used with "sound" command. If the sound was already registered, its existing index is returned. registersound does not actually load the sound, this is done on first play. See for example config/sounds.cfg. Plays the specified sound. See config/sounds.cfg for default sounds, and use registersound to register your own. For example, sound 0 and sound (registersound "aard/jump") both play the standard jump sound. Defines a mapsound. Registers the sound as a map-specific sounds. These map-specific sounds may currently only be used with "sound" entities within a map. The first map sound registered in a map has index 0, and increases afterwards. Resets the mapmodel slots/indices to 0. Each subsequent mapmodel command increases it again. See config/default_map_settings.cfg for an example. Registers a mapmodel that can be placed in maps. A map model registered with this command can be placed in a map using the 'newent mapmodel' command. All of these values are used for collision as well as rendering. Specifying a snap can be useful for architectural mapmodels, as the md2 format doesn't provide exact vertex coordinates. Example: mapmodel 4 2 4 2 this map model is 8x8x2 in size (x,y,z), by default hovers 4 units above ground, and has all coordinates snapped to the nearest even number. See data/models.cfg. Scales all lights in the map. This command is useful if a map is too dark or bright but you want to keep the light entities where they are. A variable indicating if the game is in editmode. A variable indicating if the player looks at the floor or at the ceiling.