Difference between revisions of "CommandMode"

From The Battle for Wesnoth Wiki
(Extra Debugging Commands: Add :unit status=)
(removed old version information, added a new item)
Line 5: Line 5:
  
 
If typing a colon is not feasible in your keyboard layout, you can reassign the hotkey in Preferences, or edit ''game.cfg''.
 
If typing a colon is not feasible in your keyboard layout, you can reassign the hotkey in Preferences, or edit ''game.cfg''.
 
''Note: In Battle for Wesnoth versions prior to version 1.1.1, one needed to type Shift-; (Shift-semicolon).''
 
  
 
''Note: It is possible to highlight, copy, and paste text in the command entry field.''
 
''Note: It is possible to highlight, copy, and paste text in the command entry field.''
  
Several vi-like commands are available in command mode. They are defined in ''menu_events.cpp''. In Battle for Wesnoth version 1.5 and in later versions, there is a ''':help''' command that lists all available commands, and ''':help ''foo''''' displays more information about command ''foo''. This is more reliable than the list that follows here:
+
Several vi-like commands are available in command mode. They are defined in ''menu_events.cpp''. There is a ''':help''' command that lists all available commands, and ''':help ''foo''''' displays more information about command ''foo''. This is more reliable than the list that follows here:
  
 
;<nowiki>:q!</nowiki>
 
;<nowiki>:q!</nowiki>
Line 43: Line 41:
 
:launch a friendly gui to assist with assigning control of sides to players
 
:launch a friendly gui to assist with assigning control of sides to players
 
;<nowiki>:clear</nowiki>
 
;<nowiki>:clear</nowiki>
:clear chat messages
+
:clear chat messages. Also possible with ctrl+x
 
;<nowiki>:debug</nowiki>
 
;<nowiki>:debug</nowiki>
 
:switch debug mode on (does not work in multiplayer). Debug mode is turned off by quitting the game or using the :nodebug command.
 
:switch debug mode on (does not work in multiplayer). Debug mode is turned off by quitting the game or using the :nodebug command.
Line 51: Line 49:
 
:turns off the autosave function
 
:turns off the autosave function
 
;<nowiki>:show_coordinates (or :sc)</nowiki>
 
;<nowiki>:show_coordinates (or :sc)</nowiki>
:Overlay x,y coordinates on map tiles. 1.5.5 onwards
+
:Overlay x,y coordinates on map tiles.
 
;<nowiki>:show_terrain_codes (or :tc)</nowiki>
 
;<nowiki>:show_terrain_codes (or :tc)</nowiki>
:Overlay terrain codes on visible map tiles. 1.5.5 onwards
+
:Overlay terrain codes on visible map tiles.
 
;<nowiki>:discover</nowiki>
 
;<nowiki>:discover</nowiki>
:Show all hidden unit descriptions in the in-game Help. 1.7.0 onwards
+
:Show all hidden unit descriptions in the in-game Help.
  
 
===Extra Debugging Commands===
 
===Extra Debugging Commands===
Line 67: Line 65:
 
:skip to next scenario by triggering a win event
 
:skip to next scenario by triggering a win event
 
;<nowiki>:shroud</nowiki>
 
;<nowiki>:shroud</nowiki>
:toggles shroud on/off (implemented since 1.3.10)
+
:toggles shroud on/off
 
;<nowiki>:fog</nowiki>
 
;<nowiki>:fog</nowiki>
:toggles fog on/off (implemented since 1.3.10)
+
:toggles fog on/off
 
;<nowiki>:gold</nowiki> ''amount''
 
;<nowiki>:gold</nowiki> ''amount''
 
:add ''amount'' gold to the current player's side
 
:add ''amount'' gold to the current player's side
Line 84: Line 82:
 
;<nowiki>:unit</nowiki> ''status=petrified,-slow''
 
;<nowiki>:unit</nowiki> ''status=petrified,-slow''
 
: {{DevFeature1.13|2}} sets or unsets statuses on a unit; put a - in front of the status to unset it.
 
: {{DevFeature1.13|2}} sets or unsets statuses on a unit; put a - in front of the status to unset it.
 +
;<nowiki>:unit</nowiki> ''invulnerable=yes''
 +
: {{DevFeature1.13|6}} makes the selected unit invulnerable.
 
;<nowiki>:set_var</nowiki> ''attribute=value''
 
;<nowiki>:set_var</nowiki> ''attribute=value''
 
:this will set a WML variable to a given value
 
:this will set a WML variable to a given value
Line 89: Line 89:
 
:this will display a popup with the content of the variable
 
:this will display a popup with the content of the variable
 
;<nowiki>:throw/fire</nowiki> ''event_name''
 
;<nowiki>:throw/fire</nowiki> ''event_name''
:throw an event by name, like ''time over'' or ''enemies defeated''. (Only available in 1.3.5 or later.)
+
:throw an event by name, like ''time over'' or ''enemies defeated''.
 
;<nowiki>:inspect</nowiki>
 
;<nowiki>:inspect</nowiki>
 
: show a gamestate inspector dialog which allows to see variable info, team info, ai info.
 
: show a gamestate inspector dialog which allows to see variable info, team info, ai info.

Revision as of 21:21, 21 November 2016

Template:CommandMode/Translations

Command Mode

You can access command mode by typing : (colon) in a single-player or multiplayer scenario.

If typing a colon is not feasible in your keyboard layout, you can reassign the hotkey in Preferences, or edit game.cfg.

Note: It is possible to highlight, copy, and paste text in the command entry field.

Several vi-like commands are available in command mode. They are defined in menu_events.cpp. There is a :help command that lists all available commands, and :help foo displays more information about command foo. This is more reliable than the list that follows here:

:q!
quit the scenario (without prompting)
:w
save the game (without prompting)
:wq
save the game and quit the scenario (without prompting)
:refresh
redraw the screen
:droid [side] [on|off]
toggle player on side between human and AI player. The player/client who controls that side needs to issue this command. If you don't provide side, the current side is assumed.
:idle [side] [on|off]
toggle player side between idle mode and not. This command should normally be needed only for debugging purposes.
:controller [side]
debugging command which displays the current controller type of a side.
:muteall
toggles muting/silencing of all observers on/off
:mute [username]
mute a specific observer. If no username is supplied the muted usernames are displayed.
:unmute [username]
unmute a specific observer. If no username is given everyone is unmuted. (Doesn't effect the muteall setting.)
:kick username
kick a user in multiplayer. They will be able to rejoin the game. Generally a friendly way to remove someone who is having connection or other difficulties.
:ban username
kick and ban a user in multiplayer by the IP address used by that username. Can be used on users not in the game but on the server. (Of course they won't be kicked then.)
:unban username
unban a user by the IP address used by that username. Can be used on users not in the game but on the server.
:control side username
change the controller for side (write here the number of the side, the side must be controlled by you) to username (write here the nick of the player or observer)
:give_control
launch a friendly gui to assist with assigning control of sides to players
:clear
clear chat messages. Also possible with ctrl+x
:debug
switch debug mode on (does not work in multiplayer). Debug mode is turned off by quitting the game or using the :nodebug command.
:theme
bring up theme selection menu
:nosaves
turns off the autosave function
:show_coordinates (or :sc)
Overlay x,y coordinates on map tiles.
:show_terrain_codes (or :tc)
Overlay terrain codes on visible map tiles.
:discover
Show all hidden unit descriptions in the in-game Help.

Extra Debugging Commands

DebugMode (:debug) enables additional commands in command mode:

:lua statement
execute a Lua statement
:nodebug
disables debug-mode commands
:n
skip to next scenario by triggering a win event
:shroud
toggles shroud on/off
:fog
toggles fog on/off
:gold amount
add amount gold to the current player's side
:create unit_type
create a unit of type specified at last selected hex
:unit hitpoints=amount
edit units hitpoints
:unit experience=amount
edit units experience
:unit attribute=value
when a unit is selected, this will set the unit's attribute to value. See SingleUnitWML for possible values.
:unit advances=N
when a unit is selected, this will advance (level up) the unit N times.
:unit status=petrified,-slow
(Version 1.13.2 and later only) sets or unsets statuses on a unit; put a - in front of the status to unset it.
:unit invulnerable=yes
(Version 1.13.6 and later only) makes the selected unit invulnerable.
:set_var attribute=value
this will set a WML variable to a given value
:show_var attribute
this will display a popup with the content of the variable
:throw/fire event_name
throw an event by name, like time over or enemies defeated.
:inspect
show a gamestate inspector dialog which allows to see variable info, team info, ai info.
:cl
pops up a menu that allows you to move directly to a specified scenario.
:turn [number]
change the current turn to the specified number. If no number is provided, the turn number is increased by one.
:turn_limit [number]
change the turn limit for the current scenario to the specified number. If no number is provided, or it is -1, the turn limit is switched off.
:version
Report the release version and repository revision level.

See Also