Difference between revisions of "CommandMode"

From The Battle for Wesnoth Wiki
(See My Ass Also)
m (Mention possibility to make unit invulnerable by status.)
 
(46 intermediate revisions by 29 users not shown)
Line 1: Line 1:
 +
{{Translations}}
 +
__TOC__
 
== Command Mode ==
 
== Command Mode ==
  
You can access command mode by typing ' ''':''' ' in a single player or multiplayer scenario.
+
You can access command mode by typing ''':''' (colon) in a single-player or multiplayer scenario.
(Prior to version 1.1.1, you need to type shift - semicolon( ''';''' ). However this isn't possible on all keyboards; if your keyboard doesn't have ':' above ';' you can change the hotkey in the Preferences, or you could edit '''game.cfg''' by hand.')
 
  
Note: you can highlight, copy, and paste text in debug mode.
+
If typing a colon is not feasible in your keyboard layout, you can reassign the hotkey in Preferences, or edit ''game.cfg''.
  
Several vi-like commands are available in command mode. They are defined in ''playturn.cpp'' in the ''turn_info::do_command()'' function:
+
''Note: It is possible to highlight, copy, and paste text in the command entry field.''
;<nowiki>:q or :q!</nowiki>
+
 
 +
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>
 
:quit the scenario (without prompting)
 
:quit the scenario (without prompting)
 
;<nowiki>:w</nowiki>
 
;<nowiki>:w</nowiki>
Line 15: Line 19:
 
;<nowiki>:refresh</nowiki>
 
;<nowiki>:refresh</nowiki>
 
:redraw the screen
 
:redraw the screen
;<nowiki>:droid</nowiki> ''side''
+
;<nowiki>:droid</nowiki> ''side'' on|off|full
: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'', '1' is assumed.
+
:'''on''' lets the AI make moves for '''side'''. The player still sees the vision (fog of war and shroud) for '''side''' from the start of its turn until the start of the next turn for another side that the same player controls.
 +
:'''off''' lets the player make moves for '''side'''.
 +
:'''full''' lets the AI have full control of '''side''' {{DevFeature1.15|0}}. If the player controls another side then their vision does not switch to the droided side's vision.
 +
:The player/client who controls that side needs to issue this command.
 +
:'''NOTE:''' If the only surviving side of a campaign scenario has been given to the AI by the '''full''' option, the game will not advance to the next scenario of the campaign.
 +
;<nowiki>:idle</nowiki> [''side''] [on|off]
 +
:toggle player side between idle mode and not. This command should normally be needed only for debugging purposes.
 +
;<nowiki>:controller</nowiki> [''side'']
 +
:debugging command which displays the current controller type of a side.  
 
;<nowiki>:muteall</nowiki>
 
;<nowiki>:muteall</nowiki>
 
:toggles muting/silencing of all observers on/off
 
:toggles muting/silencing of all observers on/off
;<nowiki>:mute</nowiki> ''username''
+
;<nowiki>:mute</nowiki> [''username'']
 
:mute a specific observer. If no ''username'' is supplied the muted usernames are displayed.
 
:mute a specific observer. If no ''username'' is supplied the muted usernames are displayed.
 +
;<nowiki>:unmute</nowiki> [''username'']
 +
:unmute a specific observer. If no ''username'' is given everyone is unmuted. (Doesn't effect the muteall setting.)
 
;<nowiki>:kick</nowiki> ''username''
 
;<nowiki>:kick</nowiki> ''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.
 
: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.
 
;<nowiki>:ban</nowiki> ''username''
 
;<nowiki>:ban</nowiki> ''username''
:kick and ban a user in multiplayer, and the IP address used by that ''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.)
 +
;<nowiki>:unban</nowiki> ''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.
 
;<nowiki>:control</nowiki> ''side'' ''username''
 
;<nowiki>:control</nowiki> ''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)
 
: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)
 +
;<nowiki>:give_control</nowiki>
 +
: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.
+
:switch debug mode on (does not work in multiplayer). Debug mode is turned off by quitting the game or using the :nodebug command.
;<nowiki>:nodebug</nowiki>
 
:switch debug mode off.
 
 
;<nowiki>:theme</nowiki>
 
;<nowiki>:theme</nowiki>
 
:bring up theme selection menu
 
:bring up theme selection menu
 +
;<nowiki>:nosaves</nowiki>
 +
:turns off the autosave function
 +
;<nowiki>:show_coordinates (or :sc)</nowiki>
 +
:Overlay x,y coordinates on map tiles.
 +
;<nowiki>:show_terrain_codes (or :tc)</nowiki>
 +
:Overlay terrain codes on visible map tiles.
 +
;<nowiki>:discover/undiscover</nowiki>
 +
:Show all hidden unit descriptions in the in-game Help, or forget the known ones.
  
 
===Extra Debugging Commands===
 
===Extra Debugging Commands===
[[DebugMode]] enables additional commands in command mode:
+
[[DebugMode]] (:debug) enables additional commands in command mode:
  
;<nowiki>:n</nowiki>
+
;<nowiki>:lua</nowiki> ''statement''
 +
: execute a Lua statement
 +
;<nowiki>:nodebug</nowiki>
 +
:disables debug-mode commands
 +
;<nowiki>:n/next_level</nowiki>
 
:skip to next scenario by triggering a win event
 
:skip to next scenario by triggering a win event
 +
;<nowiki>:cl/choose_level</nowiki>
 +
:pops up a menu that allows you to move directly to a specified scenario.
 +
;<nowiki>:shroud</nowiki>
 +
:toggles shroud on/off
 +
;<nowiki>:fog</nowiki>
 +
: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
 
;<nowiki>:create</nowiki> ''unit_type''
 
;<nowiki>:create</nowiki> ''unit_type''
 
:create a unit of type specified at last selected hex
 
:create a unit of type specified at last selected hex
 +
;<nowiki>:unit hitpoints=</nowiki>''amount''
 +
:edit units hitpoints
 +
;<nowiki>:unit experience=</nowiki>''amount''
 +
:edit units experience
 
;<nowiki>:unit</nowiki> ''attribute=value''
 
;<nowiki>:unit</nowiki> ''attribute=value''
:when a unit is selected, this will set the unit's ''attribute'' to ''value''.   See [[SingleUnitWML]] for possible values.
+
:when a unit is selected, this will set the unit's ''attribute'' to ''value''. See [[SingleUnitWML]] for possible values.
 +
;<nowiki>:unit</nowiki> ''advances=N''
 +
: when a unit is selected, this will advance (level up) the unit N times.
 +
;<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.
 +
;<nowiki>:unit</nowiki> ''invulnerable=yes''
 +
: {{DevFeature1.13|6}} makes the selected unit invulnerable. Can also be done via <nowiki>:unit status=invulnerable</nowiki>
 
;<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
 
;<nowiki>:show_var</nowiki> ''attribute''
 
;<nowiki>:show_var</nowiki> ''attribute''
 
: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''
 +
:throw an event by name, like ''time over'' or ''enemies defeated''.
 +
;<nowiki>:inspect</nowiki>
 +
: show a gamestate inspector dialog which allows to see variable info, team info, ai info.
 +
;<nowiki>:turn</nowiki> [''number'']
 +
:change the current turn to the specified number. If no number is provided, the turn number is increased by one.
 +
;<nowiki>:turn_limit</nowiki> [''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.
 +
;<nowiki>:version</nowiki>
 +
:Report the release version and repository revision level.
  
 
== See Also ==
 
== See Also ==
  
 
* [[DebugMode]]
 
* [[DebugMode]]
 +
* [[ChatCommands]]
 +
* [[ServerAdministration]]
 
* [[DeveloperResources]]
 
* [[DeveloperResources]]
 +
 +
[[Category:Playing Wesnoth]]
 +
[[Category:Development]]

Latest revision as of 15:03, 10 May 2023

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|full
on lets the AI make moves for side. The player still sees the vision (fog of war and shroud) for side from the start of its turn until the start of the next turn for another side that the same player controls.
off lets the player make moves for side.
full lets the AI have full control of side (Version 1.15.0 and later only). If the player controls another side then their vision does not switch to the droided side's vision.
The player/client who controls that side needs to issue this command.
NOTE: If the only surviving side of a campaign scenario has been given to the AI by the full option, the game will not advance to the next scenario of the campaign.
: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/undiscover
Show all hidden unit descriptions in the in-game Help, or forget the known ones.

Extra Debugging Commands

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

:lua statement
execute a Lua statement
:nodebug
disables debug-mode commands
:n/next_level
skip to next scenario by triggering a win event
:cl/choose_level
pops up a menu that allows you to move directly to a specified scenario.
: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. Can also be done via :unit status=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.
: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

This page was last edited on 10 May 2023, at 15:03.