Creating custom keybinds

From Unvanquished
Jump to: navigation, search

Usage

Some simple bindings can be made via the configuration menus.

For more complicated bindings and for team bindings, you need to use the console. For example, you could bind commands to set a team and to spawn:

bind F9 "team a"
bind F10 "team h"

// attacking players
teambind aliens F5 "class level0"
teambind humans F5 "class rifle"

// builders
teambind aliens F6 "class builderupg builder"
teambind humans F6 "class ckit"

Differences from Tremulous

A number of commands for keybinds have changed since Tremulous, so keybind configurations cannot be directly copied from Tremulous to Unvanquished.

Tremulous Unvanquished Used for…
+button2 +useitem Using an item; granger spit; dragoon barb
+button3 +taunt “Come on!” etc.
+button5 +attack2 Secondary attack
+button6 +dodge Dodging. NB, this feature has been removed
+button7 +activate Using a structure; evolving
+button8 +sprint Sprinting

As of alpha 3, the +buttonN commands are no longer present.

You may want to bind the new vsays to different keys.

Gameplay commands

This is a partial list of commands added, using Tremulous GPP r2259 as a reference point. Not everything listed is actually useful.

Information 48x48.png

Note

The game handles +commands specially, in a way which has implications concerning usage.

There is one way to use them in bindings which works properly, and that's to use the command on its own.

It is possible to have other commands following one of these but this is not well handled – the game appends information about when the key was pressed but, at present, assumes that there's just one command present in the binding. It also causes problems on key-up when the +command is the first command since, while the it will (correctly) be converted to a -command, any following commands will be executed unmodifed, except for the last one (which gets the timing information).

If you need to use a binding which contains one of these with other commands then use something like “wait; +taunt; wait; -taunt”. Timing information will not be added; the server has information which allows it to calculate ‘close enough’ timing information, and there may be a knock-on effect on an immediately-following action.

+activate

Access an armoury; evolve.

+attack2

Secondary attack.

+dodge

Low jump sideways or backwards for humans. This feature has been removed.

+rally

“Come on!” etc., as in ‘follow me’.

+sprint

Run. (Humans only.)

+taunt

“Come on!” etc., as in ‘bring it on!’.

+useitem

Use the highlighted item; tertiary attack (granger spit, dragoon snipe).

buy

(Changed in Alpha 18.) This command can take multiple parameters. It can also be used to sell items.

+item Sell all which conflicts, then buy item.
-item or type Sell item, or all items of the given type. (See sell.)
?item Try to buy item, failing quietly.

For example, if you want a sell-all bind, you would use “buy -all rifle” – this will get rid of all equipment and re-equip you with a rifle (though if you're building something, you won't lose your construction kit and consequently will not acquire a rifle).

say_area_team

Talk to all teammates within a server-set range.

sell

(Changed in Alpha 15.) This command can take multiple parameters.

Special item names:

weapon Your current weapon (not blaster)
weapons All weapons
upgrades All upgrades
armour or armor All armour items
all Everything

class

This command behaves differently depending on which team you are on.

  • As a human or alien, when dead, this command will cause you to spawn with the desired class or weapon, respectively.
  • As an alien, this command will cause you to evolve to the class specified. You may not "evolve" into lower-level classes.

Note that regardless of when you invoke this command, an argument must be supplied or no result will occur.

The following arguments may be used:

Team Argument Spawnable? Availability Description
Aliens builder Yes Stage 1 Granger
level0 Dretch
level1 No Basilisk
level2 Marauder
level3 Dragoon
builderupg Yes Stage 2 Advanced Granger
level1upg No Advanced Basilisk
level2upg Advanced Marauder
level3upg Advanced Dragoon
level4 Stage 3 Tyrant
Humans rifle Yes Stage 1 Rifle
ckit Construction Kit

Information 48x48.png

Note

For the aliens, when at a higher stage, you may still spawn as a non-advanced variant of any particular class. For example, if you type

\class builder

you will spawn as a normal Granger even when the Advanced Granger is available.

Configuration commands

alias

alias NAME COMMAND [PARAMETERS…]

Create an alias for the given command. The alias is then useable as a command in its own right.

aliaslist

Lists available command aliases.

bind

bind KEY [COMMAND…] Binds a command (or sequence of commands) to the given key, or lists the bindings for that key.

All existing bindings on that key are lost.

clearaliases

Clears all command aliases.

cycle

editbind

editbind [TEAM] KEY

This inserts a /bind or /teambind command into the in-game console, ready for editing. The console is opened if needed.

TEAM is default, spectators, humans, or aliens. (Initial substrings are accepted.)

irc_connect

Start the ingame IRC client

irc_quit

Stop the ingame IRC client

irc_say

Say something in the desired IRC channel if connected to a server

listrotation

Lists the current map rotation. The current map is highlighted.

loadgame

messagemode1

This command opens a general chat prompt.

messagemode2

This command opens a team-chat prompt.

messagemode3

This command opens an admin chat prompt.

messagemode4

This command opens a chat prompt for the built-in IRC client.

messagemodec

This command opens a command prompt.

modelist

teambind

teambind TEAM KEY [COMMAND…] Binds a command (or sequence of commands) to the given key for use when on the given team, or lists the binding for that key/team.

TEAM is default, spectators, humans, or aliens. (Initial substrings are accepted.)

toggleConsole

Opens or closes the in-game console.

ui_restart

Reloads UI files.

unalias

unalias NAME

Removes the named alias.

unbind

unbind [TEAM] KEY Removes either all bindings for the given key, or the binding for the given team on that key.

TEAM is default, spectators, humans, or aliens. (Initial substrings are accepted.)

undelay

undelayAll

unregister

Removes registration of your GUID and name.

Condition handling

if

if VALUE CONDITION VALUE THEN [ELSE]

if MODIFIERS THEN [ELSE]

VALUE 
a variable or number
CONDITION 
comparison operator
MODIFIERS 
comma-separated list of keyboard modifiers: Shift, Ctrl, Alt, Command (or Cmd), Mode, Super. Prefix any which must not be pressed with !.
THEN and ELSE 
either a variable name or, if prefixed with / or \, a command string.

Recognised numeric comparison operators:
= != < <= > >= !=

Recognised string comparison operators:
eq ne in !in

Either the THEN clause or the ELSE clause (if present) will be executed. If it is a variable name, its content will be executed.

For example:

/if shift "/echo Hello" "/echo Goodbye"
/bind j "if \$team\$ eq aliens \"/class level1upg level1\""

(Note the escaping of the cvar team.)

modcase

modcase MODIFIERS THEN [MODIFIERS THEN]* [ELSE]

This works like if. The leftmost most-specific THEN whose modifier list matches is the one which is executed; if none match, then ELSE is executed if it is present.

For example:

/modcase shift "/echo 1" ctrl "/echo 2" shift,ctrl "/echo 3" shift,!alt "/echo 4"

works as follows:

  1. if Shift and Alt (due to clause 4) but not Ctrl (due to clause 3) are pressed;
  2. if Ctrl but not Shift (due to clause 3);
  3. if Shift and Ctrl;
  4. if Shift but neither Alt nor Ctrl.

strcmp

Compare the string values of two cvars. Obsolete.

Admin commands

allready

Quickly move to the next map. Used only during the intermission.

speclock

Prevents a player from joining a team for a given time or until the end of the current game. If necessary, the player is moved to spectators.

specunlock

Allows a player, previously locked, to join a team.

Utility commands

calc

Do math calculations on cvars. Store the value to a cvar Useful in making scripts.

concat

Concatenate 2 cvars into a third.

delay

glsl_restart

Development use. For recompiling the GLSL shader code.

grep

grep TEXT

Searches the in-game console for occurrences of TEXT. Matching lines are reprinted.

help

math

Do math on cvars. Useful for scripts.

random

Generate a random number

reloadhud

Reload the HUD without a vid_restart

screenshotPNG

Saves a screenshot in the PNG format.

search

search TEXT

Searches back through the in-game console for TEXT and scrolls to it.

searchDown

searchDown TEXT

Searches forward through the in-game console for TEXT and scrolls to it.

snd_reload

Reload sounds (includes a vid_restart

wav_record

wav_stoprecord

Special uses

For commands relevant to development and testing purposes, please see the Testing page.

buildcubemaps

cache_endgather

cache_mapchange

cache_setindex

cache_startgather

cache_usedfile

fieldinfo

gameCompleteStatus

openurl

Open a URL inside the OS's default browser.

pubkey

Internal use.

pubkey_identify

Internal use.

setRecommended

shaderexp

spdevmap

Does nothing.

spmap

Does nothing.

updatehunkusage

updatescreen