In other languages: Deutsch 日本語 한국어 Русский 中文

Console: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
m (removed comment)
(Added every ingame command)
Line 9: Line 9:
* Occasional status updates
* Occasional status updates


There are three types of command:
There are three types of commands:


* '''Multiplayer''' - message filtering, banning users, etc.
* '''[[#Normal commands|Normal]]''' - Display information about the game and customize your experience.
* '''Information''' - display various information about the game
* '''[[#Multiplayer commands|Multiplayer]]''' - Message filtering, banning users, etc.
* '''Scripting/Cheating''' - run small Lua scripts (but they <span style="color:#FF0000">disable achievements for the save game</span>)
* '''[[#Scripting and cheat commands|Scripting/Cheating]]''' - Run small Lua scripts (but they <span style="color:#FF0000">disable achievements for the save game</span>)


=== Using the console ===
=== Using the console ===
Line 41: Line 41:
The {{keybinding|Tab}} key will auto-complete commands and player ids.
The {{keybinding|Tab}} key will auto-complete commands and player ids.


== Multiplayer Chat ==
== Normal commands ==


Send private message to specific player with '''/whisper''' (or '''/w'''):
{| style="border-collapse:collapse; border-spacing:0"
<syntaxhighlight lang="lua">
|-
/whisper <playerId> <message>
! style="border:1px solid; padding:2px 5px; width:25%"| Command
</syntaxhighlight>
! style="border:1px solid; padding:2px 5px; width:25%"| Example
 
! style="border:1px solid; padding:2px 5px; width:50%"| Description
Reply to the most recently received private message with '''/reply''' (or '''/r'''):
|-
<syntaxhighlight lang="lua">
| style="border:1px solid; padding:2px 5px;"| /alerts <enable/disable/mute/unmute> <alert>
/reply <message>
| style="border:1px solid; padding:2px 5px;"| /alerts turret_fire disable
</syntaxhighlight>
| style="border:1px solid; padding:2px 5px;"| Enables, disables, mutes, or unmutes the given alert type. Available alerts: entity_destroyed, entity_under_attack, not_enough_construction_robots, no_material_for_construction, not_enough_repair packs, turret_fire, custom, no_storage.
 
|-
Group chat works like this:
| style="border:1px solid; padding:2px 5px;"| /clear
<syntaxhighlight lang="lua">
| style="border:1px solid; padding:2px 5px;"| /clear
hello my team!
| style="border:1px solid; padding:2px 5px;"| Clears the console.
</syntaxhighlight>
|-
<syntaxhighlight lang="lua">
| style="border:1px solid; padding:2px 5px;"| /color <color>
/s hello all players!
| style="border:1px solid; padding:2px 5px;"| /color 20 255 255 100
/shout same as /s
| style="border:1px solid; padding:2px 5px;"| Changes your color. Can either be one of the pre-defined colors or [[:Wikipedia:RGBA_color_space|RGBA value]] in the format of “# # # #”. Available colors: default, red, green, blue, orange, yellow, pink, purple, white, black, gray, brown, cyan, acid.
</syntaxhighlight>
|-
| style="border:1px solid; padding:2px 5px;"| /evolution
| style="border:1px solid; padding:2px 5px;"| /evolution
| style="border:1px solid; padding:2px 5px;"| Prints info about the alien evolution factor.
|-
| style="border:1px solid; padding:2px 5px;"| /help <command>
| style="border:1px solid; padding:2px 5px;"| /help
| style="border:1px solid; padding:2px 5px;"| Prints a list of available commands, the optional argument can specify the command that should be described.
|-
| style="border:1px solid; padding:2px 5px;"| /h <command>
| style="border:1px solid; padding:2px 5px;"| /h
| style="border:1px solid; padding:2px 5px;"| Same as /help.
|-
| style="border:1px solid; padding:2px 5px;"| /mute-programmable-speaker <mute/unmute> <local/everyone>
| style="border:1px solid; padding:2px 5px;"| /mute-programmable-speaker mute local
| style="border:1px solid; padding:2px 5px;"| Mutes or unmutes the global sounds created by the Programmable Speaker. Use “local” to mute just the local client. Admins can use “everyone” to mute the sounds for everyone on the server.
|-
| style="border:1px solid; padding:2px 5px;"| /perf-avg-frames <number>
| style="border:1px solid; padding:2px 5px;"| /perf-avg-frames 100
| style="border:1px solid; padding:2px 5px;"| Number of ticks/updates used to average performance counters. Default is 100. Value of 5-10 is recommended for fast convergence, but numbers will jitter more rapidly.
|-
| style="border:1px solid; padding:2px 5px;"| /permissions
| style="border:1px solid; padding:2px 5px;"| /permissions
| style="border:1px solid; padding:2px 5px;"| Opens the permissions GUI.
|-
| style="border:1px solid; padding:2px 5px;"| /screenshot <true/false>
| style="border:1px solid; padding:2px 5px;"| /screenshot
| style="border:1px solid; padding:2px 5px;"| Takes a screenshot with your current view settings. The optional argument is to specify the visibility of the GUI elements.
|-
| style="border:1px solid; padding:2px 5px;"| /seed
| style="border:1px solid; padding:2px 5px;"| /seed
| style="border:1px solid; padding:2px 5px;"| Prints the starting map seed.
|-
| style="border:1px solid; padding:2px 5px;"| /time
| style="border:1px solid; padding:2px 5px;"| /time
| style="border:1px solid; padding:2px 5px;"| Prints info about how old the map is.
|-
| style="border:1px solid; padding:2px 5px;"| /toggle-action-logging
| style="border:1px solid; padding:2px 5px;"| /toggle-action-logging
| style="border:1px solid; padding:2px 5px;"| Toggles logging all input actions performed by the game. This value isn’t persisted between game restarts and only affects your local game in multiplayer sessions.
|-
| style="border:1px solid; padding:2px 5px;"| /toggle-heavy-mode
| style="border:1px solid; padding:2px 5px;"| /toggle-heavy-mode
| style="border:1px solid; padding:2px 5px;"| Used to investigate desyncs. Will slow down the game and make multiplayer unplayable.
|-
| style="border:1px solid; padding:2px 5px;"| /toggle-rockets-sent-gui
| style="border:1px solid; padding:2px 5px;"| /toggle-rockets-sent-gui
| style="border:1px solid; padding:2px 5px;"| Toggles if the rockets sent button is shown in the upper left corner of the screen.
|-
| style="border:1px solid; padding:2px 5px;"| /version
| style="border:1px solid; padding:2px 5px;"| /version
| style="border:1px solid; padding:2px 5px;"| Prints the current game version.
|-
|}


These are just the main chat features - there are also options for banning, ignoring and muting players; see the console '''/help''' for a full list.
== Multiplayer commands ==


{| style="border-collapse:collapse; border-spacing:0"
|-
! style="border:1px solid; padding:2px 8px; width:25%"| Command
! style="border:1px solid; padding:2px 8px; width:25%"| Example
! style="border:1px solid; padding:2px 8px; width:50%"| Description
|-
| style="border:1px solid; padding:2px 8px;"| <message>
| style="border:1px solid; padding:2px 8px;"| Hello team!
| style="border:1px solid; padding:2px 8px;"| Console input that does not start with {{keybinding|/}} is shown as a chat message to your team.
|-
| style="border:1px solid; padding:2px 8px;"| /admins
| style="border:1px solid; padding:2px 8px;"| /admins
| style="border:1px solid; padding:2px 8px;"| Prints a list of game admins.
|-
| style="border:1px solid; padding:2px 8px;"| /ban <player> <reason>
| style="border:1px solid; padding:2px 8px;"| /ban xTROLLx Throwing grenades in base
| style="border:1px solid; padding:2px 8px;"| Bans the specified player.
|-
| style="border:1px solid; padding:2px 8px;"| /banlist <add/remove/get/clear> <player>
| style="border:1px solid; padding:2px 8px;"| /banlist get
| style="border:1px solid; padding:2px 8px;"| Adds or removes a player from the banlist. Same as /ban or /unban.
|-
| style="border:1px solid; padding:2px 8px;"| /config <get/set> <option> <value>
| style="border:1px solid; padding:2px 8px;"| /config set password hunter2
| style="border:1px solid; padding:2px 8px;"| Gets or sets various multiplayer game settings. Available configs are: afk-auto-kick, allow-commands, allow-debug-settings, autosave-interval, autosave-only-on-server, ignore-player-limit-for-returning-players, max-players, max-upload-speed, only-admins-can-pause, password, require-user-verification, visibility-lan, visibility-public.
|-
| style="border:1px solid; padding:2px 8px;"| /delete-blueprint-library <player>
| style="border:1px solid; padding:2px 8px;"| /delete-blueprint-library everybody confirm
| style="border:1px solid; padding:2px 8px;"| Deletes the blueprint library storage for the given offline player from the save file. Enter “everybody confirm” to delete the storage of all offline players.
|-
| style="border:1px solid; padding:2px 8px;"| /demote <player>
| style="border:1px solid; padding:2px 8px;"| /demote AzureDiamond
| style="border:1px solid; padding:2px 8px;"| Demotes the player from admin.
|-
| style="border:1px solid; padding:2px 8px;"| /ignore <player>
| style="border:1px solid; padding:2px 8px;"| /ignore Cthon98
| style="border:1px solid; padding:2px 8px;"| Prevents the chat from showing messages from this player. Admin messages are still shown.
|-
| style="border:1px solid; padding:2px 8px;"| /ignores
| style="border:1px solid; padding:2px 8px;"| /ignores
| style="border:1px solid; padding:2px 8px;"| Prints a list of ignored players.
|-
| style="border:1px solid; padding:2px 8px;"| /kick <player> <reason>
| style="border:1px solid; padding:2px 8px;"| /kick xTROLLx Throwing grenades in base
| style="border:1px solid; padding:2px 8px;"| Kicks the specified player.
|-
| style="border:1px solid; padding:2px 8px;"| /mute <player>
| style="border:1px solid; padding:2px 8px;"| /mute Cthon98
| style="border:1px solid; padding:2px 8px;"| Prevents the player from saying anything in chat.
|-
| style="border:1px solid; padding:2px 8px;"| /mutes
| style="border:1px solid; padding:2px 8px;"| /mutes
| style="border:1px solid; padding:2px 8px;"| All players that are muted (can’t talk in chat).
|-
| style="border:1px solid; padding:2px 8px;"| /open <player>
| style="border:1px solid; padding:2px 8px;"| /open AzureDiamond
| style="border:1px solid; padding:2px 8px;"| Opens another player’s inventory.
|-
| style="border:1px solid; padding:2px 8px;"| /o <player>
| style="border:1px solid; padding:2px 8px;"| /o AzureDiamond
| style="border:1px solid; padding:2px 8px;"| Same as /open.
|-
| style="border:1px solid; padding:2px 8px;"| /players <online/o/count/c>
| style="border:1px solid; padding:2px 8px;"| /players
| style="border:1px solid; padding:2px 8px;"| Prints a list of players in the game. (parameter online/o, it prints only players that are online, count/c prints only count)
|-
| style="border:1px solid; padding:2px 8px;"| /promote <player>
| style="border:1px solid; padding:2px 8px;"| /promote AzureDiamond
| style="border:1px solid; padding:2px 8px;"| Promotes the player to admin.
|-
| style="border:1px solid; padding:2px 8px;"| /purge <player>
| style="border:1px solid; padding:2px 8px;"| /purge Cthon98
| style="border:1px solid; padding:2px 8px;"| Clears all the messages from this player from the chat log.
|-
| style="border:1px solid; padding:2px 8px;"| /reply <message>
| style="border:1px solid; padding:2px 8px;"| /reply oh, really?
| style="border:1px solid; padding:2px 8px;"| Replies to the last player that whispered to you.
|-
| style="border:1px solid; padding:2px 8px;"| /reply <message>
| style="border:1px solid; padding:2px 8px;"| /reply oh, really?
| style="border:1px solid; padding:2px 8px;"| Replies to the last player that whispered to you.
|-
| style="border:1px solid; padding:2px 8px;"| /r <message>
| style="border:1px solid; padding:2px 8px;"| /r oh, really?
| style="border:1px solid; padding:2px 8px;"| Same as /reply.
|-
| style="border:1px solid; padding:2px 8px;"| /server-save
| style="border:1px solid; padding:2px 8px;"| /server-save
| style="border:1px solid; padding:2px 8px;"| Saves the game on the server in a multiplayer game.
|-
| style="border:1px solid; padding:2px 8px;"| /shout <message>
| style="border:1px solid; padding:2px 8px;"| /shout Hello world!
| style="border:1px solid; padding:2px 8px;"| Sends a message to all players including other forces.
|-
| style="border:1px solid; padding:2px 8px;"| /s <message>
| style="border:1px solid; padding:2px 8px;"| /s Hello world!
| style="border:1px solid; padding:2px 8px;"| Same as /shout.
|-
| style="border:1px solid; padding:2px 8px;"| /swap-players <player> <player>
| style="border:1px solid; padding:2px 8px;"| /swap-players AzureDiamond
| style="border:1px solid; padding:2px 8px;"| Swaps your character with the given player’s character, or if two players are given swaps the two player characters.
|-
| style="border:1px solid; padding:2px 8px;"| /unban <player>
| style="border:1px solid; padding:2px 8px;"| /unban xTROLLx
| style="border:1px solid; padding:2px 8px;"| Unbans the specified player.
|-
| style="border:1px solid; padding:2px 8px;"| /unignore <player>
| style="border:1px solid; padding:2px 8px;"| /unignore Cthon98
| style="border:1px solid; padding:2px 8px;"| Allows the chat to show messages from this player.
|-
| style="border:1px solid; padding:2px 8px;"| /unmute <player>
| style="border:1px solid; padding:2px 8px;"| /unmute Cthon98
| style="border:1px solid; padding:2px 8px;"| Allows the player to talk in chat again.
|-
| style="border:1px solid; padding:2px 8px;"| /whisper <player> <message>
| style="border:1px solid; padding:2px 8px;"| /whisper AzureDiamond thats what I see
| style="border:1px solid; padding:2px 8px;"| Sends a message to the specified player.
|-
| style="border:1px solid; padding:2px 8px;"| /w <player> <message>
| style="border:1px solid; padding:2px 8px;"| /w AzureDiamond thats what I see
| style="border:1px solid; padding:2px 8px;"| Same as /whisper.
|-
| style="border:1px solid; padding:2px 8px;"| /whitelist <add/remove/get/clear>
| style="border:1px solid; padding:2px 8px;"| /whitelist get
| style="border:1px solid; padding:2px 8px;"| Adds or removes a player from the whitelist, where only whitelisted players can join the game. Enter nothing for “player” when using “get” to print a list of all whitelisted players. An empty whitelist disables the whitelist functionality allowing anyone to join.
|}


== Commands ==
== Scripting and cheat commands ==
To see a list of all available commands, enter '''/help''' (or '''/h''') in to the console.
{| style="border-collapse:collapse; border-spacing:0"
The available commands will depend on Factorio version and game setup.
|-
<syntaxhighlight lang="lua">
! style="border:1px solid; padding:2px 8px;"| Command
/help
! style="border:1px solid; padding:2px 8px;"| Description
</syntaxhighlight>
|-
 
|-
In [https://forums.factorio.com/viewtopic.php?f=3&t=32248 Factorio 0.14.4 and later], the '''/help''' command will just display a list of commands - to get full details for a command add the command name (without slash) after '''/help''' (or '''/h'''), for example if you want help on the '''/evolution''' command, you'd type:
| style="border:1px solid; padding:2px 8px;"| /c <command>
<syntaxhighlight lang="lua">
| style="border:1px solid; padding:2px 8px;"| Executes a Lua command.
/h evolution
|-
</syntaxhighlight>
| style="border:1px solid; padding:2px 8px;"| /command <command>
 
| style="border:1px solid; padding:2px 8px;"| Executes a Lua command.
=== Scripting and cheat commands ===
|-
You can run Lua script commands via the console.
| style="border:1px solid; padding:2px 8px;"| /measured-command <command>
It works similarly to any command line interface or the JavaScript console for your browser.
| style="border:1px solid; padding:2px 8px;"| Executes a Lua command and measures time it took.
|-
| style="border:1px solid; padding:2px 8px;"| /silent-command <command>
| style="border:1px solid; padding:2px 8px;"| Executes a Lua command without printing it to the console.
|}


This is a very powerful feature, which also allows cheating, and as such <span style="color:#FF0000">achievements will be permanently disabled for the save</span> as soon as you use a script command.
This is a very powerful feature, which also allows cheating, and as such <span style="color:#FF0000">achievements will be permanently disabled for the save</span> as soon as you use a script command.


To run a script, prefix it with '''/command''' (or '''/c'''), for example:
== Basic example scripts ==
<syntaxhighlight lang="lua">
/c game.player.print 'hello me!'
</syntaxhighlight>
 
In a multiplayer game, only admins are able to use commands, and the command will be echoed to all other players.
 
Multiplayer server admins can use '''/silent-command''' (only via RCON/server console) instead of '''/c''' to avoid the command being echoed to all players.
<syntaxhighlight lang="lua">
/silent-command game.player.print 'only admins can use (and see) silent commands'
</syntaxhighlight>
 
Mod developers can also take advantage of the special '''/measured-command''' which is like '''/c''' but will time how long the command takes to run.
This is very useful for performance tuning scripts.
<syntaxhighlight lang="lua">
/measured-command game.player.print 'how much time does this take to run?'
</syntaxhighlight>
 
The game ignores newlines when pasting "scriptlets" in the console.
This means they can be written in a human readable form in an editor and copy/pasted into the console, making understanding and editing a bit easier.
 
== Basic Command Examples ==


=== Large Screenshots ===
=== Large Screenshots ===
Line 170: Line 332:
</syntaxhighlight>
</syntaxhighlight>


=== Played time ===
== Inventory manipulation scripts ==
This command says how many hours, minutes and seconds are you played.
<syntaxhighlight lang="lua">
/time
</syntaxhighlight>
 
== Inventory Manipulation ==


=== Refill resources (refill oil, iron etc.) ===
=== Refill resources (refill oil, iron etc.) ===
Line 221: Line 377:
</syntaxhighlight>
</syntaxhighlight>


== World Manipulation ==
== World manipulation scripts ==


=== Reveal the map around the player ===
=== Reveal the map around the player ===
Line 375: Line 531:
</syntaxhighlight>
</syntaxhighlight>


== Enemy/Evolution ==
== Enemy/evolution scripts ==
=== Check how far the biters have evolved ===
Note that commands that do not start with "/c" do not disable achievements.
<syntaxhighlight lang="lua">
/evolution
</syntaxhighlight>


=== Set evolution factor ===
=== Set evolution factor ===
Line 423: Line 574:
</syntaxhighlight>
</syntaxhighlight>


== Player Character ==
== Player character scripts ==
Commands concerning the player directly.
Commands concerning the player directly.
=== Get Player Position ===
=== Get Player Position ===
Line 438: Line 589:


To teleport to the world's origin, use 0,0.
To teleport to the world's origin, use 0,0.
=== Change Player color ===
Note that commands that do not start with "/c" do not disable achievements. Replace COLOR with the name of a color. Available names are: Black, blue, brown, cyan, gray, green, orange, pink, purple, red, white, acid and yellow. The color can also be set to an [[:Wikipedia:RGBA_color_space|RGBA value]].
<syntaxhighlight lang="lua">
/color COLOR
/color r g b a
</syntaxhighlight>


=== Enable god mode ===
=== Enable god mode ===
Line 464: Line 608:
</syntaxhighlight>
</syntaxhighlight>


== Research ==
== Research scripts ==
 
=== Enable faster research ===
=== Enable faster research ===
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">

Revision as of 11:44, 31 March 2018

Overview

The Console is Factorio's command-line interface.

The in-game console is used for:

  • Chatting with other players
  • Running commands / scripts / cheats
  • Occasional status updates

There are three types of commands:

  • Normal - Display information about the game and customize your experience.
  • Multiplayer - Message filtering, banning users, etc.
  • Scripting/Cheating - Run small Lua scripts (but they disable achievements for the save game)

Using the console

The console display can be toggled with the / (slash) or ~ (tilde) keys.

You can customize the keys via Options Menu -> Keyboard -> Toggle Lua console. When the console is open, you'll see a blinking cursor at the bottom of the screen; type your message or command and hit Return to send it (this will also close the console). Documentation about message and command prefixes can be found further down this page.

When console is closed, only the most recent messages/commands will be displayed, but they will gradually fade away (opening the console will immediately re-display all recent messages). Note that by default, all executed commands are made visible to all users. You can set the fade out time via Options Menu -> Other Settings -> Message Delay.

If you want to immediately hide the console, open the console and then press Escape key (or press Return without entering any message/command). This not only closes the console, but it also hides all the recent messages/commands. The console can be cleared with the /clear command.

Note that the console can also accept raw Lua code as well as game commands.

Console history

The console has an inbuilt history; it's a bit like a text editor where only one line of text is displayed at a time.

Use the and keys to scroll through the console history.

Use the and keys to cursor through the currently displayed message or command, which you can edit (delete, insert, etc.) and resend (by pressing Return).

The Tab key will auto-complete commands and player ids.

Normal commands

Command Example Description
/alerts <enable/disable/mute/unmute> <alert> /alerts turret_fire disable Enables, disables, mutes, or unmutes the given alert type. Available alerts: entity_destroyed, entity_under_attack, not_enough_construction_robots, no_material_for_construction, not_enough_repair packs, turret_fire, custom, no_storage.
/clear /clear Clears the console.
/color <color> /color 20 255 255 100 Changes your color. Can either be one of the pre-defined colors or RGBA value in the format of “# # # #”. Available colors: default, red, green, blue, orange, yellow, pink, purple, white, black, gray, brown, cyan, acid.
/evolution /evolution Prints info about the alien evolution factor.
/help <command> /help Prints a list of available commands, the optional argument can specify the command that should be described.
/h <command> /h Same as /help.
/mute-programmable-speaker <mute/unmute> <local/everyone> /mute-programmable-speaker mute local Mutes or unmutes the global sounds created by the Programmable Speaker. Use “local” to mute just the local client. Admins can use “everyone” to mute the sounds for everyone on the server.
/perf-avg-frames <number> /perf-avg-frames 100 Number of ticks/updates used to average performance counters. Default is 100. Value of 5-10 is recommended for fast convergence, but numbers will jitter more rapidly.
/permissions /permissions Opens the permissions GUI.
/screenshot <true/false> /screenshot Takes a screenshot with your current view settings. The optional argument is to specify the visibility of the GUI elements.
/seed /seed Prints the starting map seed.
/time /time Prints info about how old the map is.
/toggle-action-logging /toggle-action-logging Toggles logging all input actions performed by the game. This value isn’t persisted between game restarts and only affects your local game in multiplayer sessions.
/toggle-heavy-mode /toggle-heavy-mode Used to investigate desyncs. Will slow down the game and make multiplayer unplayable.
/toggle-rockets-sent-gui /toggle-rockets-sent-gui Toggles if the rockets sent button is shown in the upper left corner of the screen.
/version /version Prints the current game version.

Multiplayer commands

Command Example Description
<message> Hello team! Console input that does not start with / is shown as a chat message to your team.
/admins /admins Prints a list of game admins.
/ban <player> <reason> /ban xTROLLx Throwing grenades in base Bans the specified player.
/banlist <add/remove/get/clear> <player> /banlist get Adds or removes a player from the banlist. Same as /ban or /unban.
/config <get/set> <option> <value> /config set password hunter2 Gets or sets various multiplayer game settings. Available configs are: afk-auto-kick, allow-commands, allow-debug-settings, autosave-interval, autosave-only-on-server, ignore-player-limit-for-returning-players, max-players, max-upload-speed, only-admins-can-pause, password, require-user-verification, visibility-lan, visibility-public.
/delete-blueprint-library <player> /delete-blueprint-library everybody confirm Deletes the blueprint library storage for the given offline player from the save file. Enter “everybody confirm” to delete the storage of all offline players.
/demote <player> /demote AzureDiamond Demotes the player from admin.
/ignore <player> /ignore Cthon98 Prevents the chat from showing messages from this player. Admin messages are still shown.
/ignores /ignores Prints a list of ignored players.
/kick <player> <reason> /kick xTROLLx Throwing grenades in base Kicks the specified player.
/mute <player> /mute Cthon98 Prevents the player from saying anything in chat.
/mutes /mutes All players that are muted (can’t talk in chat).
/open <player> /open AzureDiamond Opens another player’s inventory.
/o <player> /o AzureDiamond Same as /open.
/players <online/o/count/c> /players Prints a list of players in the game. (parameter online/o, it prints only players that are online, count/c prints only count)
/promote <player> /promote AzureDiamond Promotes the player to admin.
/purge <player> /purge Cthon98 Clears all the messages from this player from the chat log.
/reply <message> /reply oh, really? Replies to the last player that whispered to you.
/reply <message> /reply oh, really? Replies to the last player that whispered to you.
/r <message> /r oh, really? Same as /reply.
/server-save /server-save Saves the game on the server in a multiplayer game.
/shout <message> /shout Hello world! Sends a message to all players including other forces.
/s <message> /s Hello world! Same as /shout.
/swap-players <player> <player> /swap-players AzureDiamond Swaps your character with the given player’s character, or if two players are given swaps the two player characters.
/unban <player> /unban xTROLLx Unbans the specified player.
/unignore <player> /unignore Cthon98 Allows the chat to show messages from this player.
/unmute <player> /unmute Cthon98 Allows the player to talk in chat again.
/whisper <player> <message> /whisper AzureDiamond thats what I see Sends a message to the specified player.
/w <player> <message> /w AzureDiamond thats what I see Same as /whisper.
/whitelist <add/remove/get/clear> /whitelist get Adds or removes a player from the whitelist, where only whitelisted players can join the game. Enter nothing for “player” when using “get” to print a list of all whitelisted players. An empty whitelist disables the whitelist functionality allowing anyone to join.

Scripting and cheat commands

Command Description
/c <command> Executes a Lua command.
/command <command> Executes a Lua command.
/measured-command <command> Executes a Lua command and measures time it took.
/silent-command <command> Executes a Lua command without printing it to the console.

This is a very powerful feature, which also allows cheating, and as such achievements will be permanently disabled for the save as soon as you use a script command.

Basic example scripts

Large Screenshots

This is how you would take a large HD screenshot.

The file is put into a folder called "script-output", which is located in the same location as the mods folder, the application directory. These pictures can be quite large.

/c game.take_screenshot{<parameter>=<value>,...}

The command takes the following parameters:

  • showgui - Boolean value, true or false. True if GUIs should be included in the screenshot.
  • resolution - Takes an x and y, in the form {x = <x-size>, y = <y-size>}.
  • show_entity_info - Boolean value, true if alt info should be shown in the screenshot.
  • zoom - The zoom level. 1 is normal, 2 is zoomed in to half the area, 0.5 is zoomed out to twice the area, etc.

Example, this takes a 1000x1000 screenshot with alt-mode on, but without the gui, at zoom level 2:

/c game.take_screenshot{resolution = {x = 1000, y = 1000}, zoom = 2, show_entity_info = true}

Use it as calculator

/c game.player.print(1234*5678)

Mine faster

/c game.player.force.manual_mining_speed_modifier=1000

Craft faster

/c game.player.force.manual_crafting_speed_modifier=1000

Unlock and Research all Technology

/c game.player.force.research_all_technologies()

Undo this with the command in the next section.

Unresearch all technologies

This does not reset manually applied bonuses

/c for _, tech in pairs(game.player.force.technologies) do 
	tech.researched=false
	game.player.force.set_saved_technology_progress(tech, 0)
end

Reset your force

This resets all data for your force, including kill and production statistics, technologies, bonuses and charting status.

/c game.player.force.reset()

Zoom beyond normal bounds

Note that zooming too far out can cause performance hits. Be careful.

/c game.player.zoom=0.1

Inventory manipulation scripts

Refill resources (refill oil, iron etc.)

While holding the cursor over a resource tile in-game

/c game.player.selected.amount=7500

Add items to the player's inventory

Replace iron-plate with the internal name of the item desired.

/c game.player.insert{name="iron-plate", count=100}

For instance, here's a god-mode energy system interface:

/c game.player.insert{name="electric-energy-interface"}

Add a powerful armor with equipment:

/c	local player = game.player
player.insert{name="power-armor-mk2", count = 1}
local p_armor = player.get_inventory(5)[1].grid
	p_armor.put({name = "fusion-reactor-equipment"})
	p_armor.put({name = "fusion-reactor-equipment"})
	p_armor.put({name = "fusion-reactor-equipment"})
	p_armor.put({name = "exoskeleton-equipment"})
	p_armor.put({name = "exoskeleton-equipment"})
	p_armor.put({name = "exoskeleton-equipment"})
	p_armor.put({name = "exoskeleton-equipment"})
	p_armor.put({name = "energy-shield-mk2-equipment"})
	p_armor.put({name = "energy-shield-mk2-equipment"})
	p_armor.put({name = "personal-roboport-mk2-equipment"})
	p_armor.put({name = "night-vision-equipment"})
	p_armor.put({name = "battery-mk2-equipment"})
	p_armor.put({name = "battery-mk2-equipment"})

Cheat mode

Allows for infinite free crafting. Disable by replacing true with false.

/c game.player.cheat_mode=true

World manipulation scripts

Reveal the map around the player

Reveals the map around the player, similar to a radar.

/c local radius=150
game.player.force.chart(game.player.surface, {{game.player.position.x-radius, game.player.position.y-radius}, {game.player.position.x+radius, game.player.position.y+radius}})

or from start position

/c game.forces.player.chart(game.player.surface, {{x = -2000, y = -2000}, {x = 2000, y = 2000}})

Change 150 to the desired radius, higher values take longer.

If much of the map is revealed, it increases the size of the save file. The following command cancels the generation of all chunks that are currently queued for generation and removes chunks outside a 32 chunks radius around 0,0. Note that this will remove player entities if there are any on these chunks.

/c local surface = game.player.surface;
game.player.force.cancel_charting(surface); 
local chunk_radius = 32;
for chunk in surface.get_chunks() do
  if (chunk.x < -chunk_radius or chunk.x > chunk_radius or chunk.y < -chunk_radius or chunk.y > chunk_radius) then
    surface.delete_chunk(chunk)
  end
end

Turn off night

Enables eternal day.

/c game.player.surface.always_day=true

Change game speed

0.5 is half speed, 1 is default, 2 is double speed, etc. Minimum is 0.01. This can be used for a lot of things like when you know you will have to wait for long periods of time for something to complete. Increasing will decrease performance, be careful.

/c game.speed=X

Expensive (marathon) or normal mode

To change from normal to expensive mode preset (this changes the research cost and intermediate product cost):

/c game.difficulty_settings.recipe_difficulty=1
game.difficulty_settings.technology_difficulty=1
game.difficulty_settings.technology_price_multiplier=4

To change back to normal:

/c game.difficulty_settings.recipe_difficulty=0
game.difficulty_settings.technology_difficulty=0
game.difficulty_settings.technology_price_multiplier=1

Freeze Time Passage

Stops the advancement of the time if you replace "BOOL" with "true" or unfreezes it if you replace it with "false".

/c game.player.surface.freeze_daytime=BOOL

Remove all pollution

/c game.player.surface.clear_pollution()

Disable friendly fire for your force

/c game.player.force.friendly_fire = false

Add new resource patch

This creates a new 11x11 patch of resources, centered on the player character. The patch it creates is perfectly square but it randomizes the amount similar to natural generation, with fewer ore at the edges and more ore in the center. The default numbers result in a patch with 2500-3000 ore.

If you want a larger patch, change "local size = 5" to a larger number. A larger patch will have exponentially more ore. Entering a number above 30 is not recommended.

If you want a richer patch, change "local density = 10" to a larger number. Entering a very large number shouldn't hurt anything but you probably don't need to go above 100.

To choose which resource is spawned, change "stone" near the bottom to "iron-ore", "copper-ore", "coal", or "uranium-ore".

/c local surface=game.player.surface
local ore=nil
local size=5
local density=10
for y=-size, size do
	for x=-size, size do
		a=(size+1-math.abs(x))*10
		b=(size+1-math.abs(y))*10
		if a<b then
			ore=math.random(a*density-a*(density-8), a*density+a*(density-8))
		end
		if b<a then
			ore=math.random(b*density-b*(density-8), b*density+b*(density-8))
		end
		surface.create_entity({name="stone", amount=ore, position={game.player.position.x+x, game.player.position.y+y}})
	end
end

Add new oil patch

This creates 9 crude oil patches in a 3x3 square.

/c for y=0,2 do
	for x=0,2 do
		game.player.surface.create_entity({name="crude-oil", amount=5000, position={game.player.position.x+x*7-7, game.player.position.y+y*7-7}})
	end
end

or randomly without any collision:

/c local position=nil
for i=1,9 do
	position=game.player.surface.find_non_colliding_position("crude-oil", game.player.position, 0, i/2+1.5)
	if position then 
		game.player.surface.create_entity({name="crude-oil", amount=5000, position=position})
	end
end

Count entities

Counts all entities whose name includes the string in local entity.

/c local entity="belt"
local surface=game.player.surface
local count=0
for key, ent in pairs(surface.find_entities_filtered({force=game.player.force})) do
	if string.find(ent.name,entity) then
		count=count+1
	end
end
game.player.print(count)

Emptying all pipes and underground pipes

Useful when pipes contain a fluid you dont want.

/c local surface = game.player.surface
local deleted=0
for key, entity in pairs(surface.find_entities_filtered({force=game.player.force})) do
	if string.find(entity.name, "pipe") then
		for i=1,#entity.fluidbox do
			deleted = deleted + 1
			entity.fluidbox[i] = nil;
		end
	end
end
game.player.print("Pipes emptied: "..deleted)

Enemy/evolution scripts

Set evolution factor

Ranges from 0 (new game) to 1.

/c game.forces["enemy"].evolution_factor=X

Disable time-based evolution & increases pollution-based evolution

/c game.map_settings.enemy_evolution.time_factor=0
/c game.map_settings.enemy_evolution.pollution_factor=game.map_settings.enemy_evolution.pollution_factor*2

The "2" at the end of the last command will double the default pollution factor. You can substitute another number to increase (or decrease) the pollution factor further.

Kill all biters on the "enemy" force

Note that this will kill only mobile units and worms, spawners will not be killed.

/c game.forces["enemy"].kill_all_units()

Kill all enemies

This will kill all biters, bases and worms. Anything that is an enemy will be completely destroyed. This only affects enemies in the explored world, so any unexplored parts of the map which still need to be generated will still have enemies.

/c local surface=game.player.surface
for key, entity in pairs(surface.find_entities_filtered({force="enemy"})) do
	entity.destroy()
end

Enable peaceful mode

Peaceful mode prevents biter attacks until provoked. Substitute false for true to disable.

/c game.player.surface.peaceful_mode=true

Disable biter expansion

This prevents biters from creating new spawners.

/c game.map_settings.enemy_expansion.enabled=false

Player character scripts

Commands concerning the player directly.

Get Player Position

Prints coordinates of your current position.

/c game.player.print(game.player.position.x .. ", " .. game.player.position.y)

Teleport player

Moves the player to the specified location. You should be able to teleport to a specific player if you obtain their coordinates via them executing the previous command and giving them to you.

/c game.player.teleport({X, Y})

To teleport to the world's origin, use 0,0.

Enable god mode

God mode removes your player character allowing you to fly over obstacles and take no damage.

Disassociate your controls from the player:

/c game.player.character=nil

Then, hover the mouse over the useless player and destroy it by typing:

/c game.player.selected.destroy()

To undo, spawn a player character. This will spawn a new player at the spawn point of the world, and connect your controls to it.

/c game.player.create_character()

Research scripts

Enable faster research

/c game.player.force.laboratory_speed_modifier=1

1 is normal speed, 2 is double speed 3 is triple etc. I think it goes up to 100.

Researching specific technologies

The internal technology names can be found in the infoboxes on their respective pages, click on the little arrow to show them.

/c game.player.force.technologies['electric-energy-distribution-1'].researched=true
/c game.player.force.technologies['steel-processing'].researched=true

Unresearching specific technologies

The internal technology names can be found in the infoboxes on their respective pages, click on the little arrow to show them.

/c game.player.force.technologies['electric-energy-distribution-1'].researched=false; game.player.force.set_saved_technology_progress('electric-energy-distribution-1', 0)
/c game.player.force.technologies['steel-processing'].researched=false; game.player.force.set_saved_technology_progress('steel-processing', 0)

Enabling specific recipes

The internal recipe/item names can be found in the infoboxes on their respective pages, click on the little arrow to show them.

/c game.player.force.recipes["electric-energy-interface"].enabled=true
/c game.player.force.recipes["rocket-silo"].enabled=true
/c game.player.force.recipes.loader.enabled=true

Enable all recipes

/c for name, recipe in pairs(game.player.force.recipes) do recipe.enabled = true end

Finish research immediately

/c for name,technology in pairs(game.player.force.technologies) do technology.researched=technology.enabled end

Command Line Parameters

As of Game Version 0.15.13

Command line parameters can be used to set settings in the command line before the game launches, this is useful mainly for advanced users or server hosts.

General options:

 -h [ --help ]                      display help
 --version                          show version information
 -v [ --verbose ]                   enable verbose logging
 -c [ --config ] PATH               config file to use
 --no-log-rotation                  don't rotate log file
 --mod-directory PATH               Mod directory to use
 --check-unused-prototype-data      Print a warning for all prototype values that were not accessed

Running options:

 -s [ --map2scenario ] arg          map to scenario conversion
 -m [ --scenario2map ] arg          scenario to map conversion
 --apply-update arg                 immediately apply update package
 --create FILE                      create a new map
 --map-gen-settings FILE            Map generation settings for use with --create. See data/map-gen-settings.example.json
 --map-settings FILE                Map settings for use with --create. See data/base/prototypes/map-settings.lua
 --preset arg                       Name of the map generation preset to be used.
 --generate-map-preview FILE        Generate preview images of the map
 --map-preview-size SCALE (=1,024)  Size (in pixels) of map preview
 --map-preview-scale SCALE (=1)     Scale (meters per pixel) of map preview
 --map-preview-offset X,Y (=0,0)    Offset of the center of the map, in meters
 --start-server FILE                start a multiplayer server
 --start-server-load-scenario FILE  start a multiplayer server and load the specified scenario
 --start-server-load-latest         start a multiplayer server and load the latest available save
 --until-tick TICK                  run a save until given map tick
 --mp-connect ADDRESS               start factorio and connect to address
 --load-game FILE                   start Factorio and load a game in singleplayer
 --benchmark FILE                   load save and run benchmark
 --benchmark-ticks N (=1,000)       number of ticks for benchmarking. Default is 1000
 --force-opengl                     use OpenGL for rendering
 --force-d3d                        use Direct3D for rendering
 --fullscreen BOOL                  start game in windowed mode (saved to configuration)
 --max-texture-size N               maximal size of texture that the game can use (saved to configuration). Should be power of two greater than 2048
 --graphics-quality arg             accepted values: normal, low, very-low
 --video-memory-usage arg           accepted values: all, high, medium, low
 --gfx-safe-mode                    resets some graphics settings to values that should work on most configurations
 --shader arg                       enable/disable shader postprocessing (saved to configuration)
 --disable-audio                    Disable audio. Mainly for faster startup during development.

Server options:

 --port N                           network port to use
 --bind ADDRESS[:PORT]              IP address (and optionally port) to bind to
 --rcon-port N                      Port to use for RCON
 --rcon-password PASSWORD           Password for RCON
 --server-settings FILE             Path to file with server settings. See data/server-settings.example.json
 --server-whitelist FILE            Path to file with server whitelist.
 --server-banlist FILE              Path to file with server banlist.
 --console-log FILE                 Path to file where a copy of the server's log will be stored
 --server-id FILE                   Path where server ID will be stored or read from

Multiplayer

 --start-server SAVE

Will start a Headless (Dedicated) server, with no GUI.

 --mp-connect ADDRESS

ADDRESS is the IP:port of the remote host. Port is optional. Examples:

 ./factorio --mp-connect 192.168.1.101
 ./factorio --mp-connect 192.168.1.101:2345

As above, port can be specified by placing the port number after a colon in the address.

 --map2scenario SAVE

Converts a save game to a User Scenario, allows saved game state to be loaded into map editor. Assuming that save game name is "foo.zip", executing './factorio --map2scenario s1' will result in Factorio loading, opening the save file, and saving the scenario into the scenario folder.

Modding tools

A list of the internal names of most things in the vanilla game can also be found on data.raw.

Write all researched technologies to file

/c local list = {}
for _, tech in pairs(game.player.force.technologies) do 
	if tech.researched then
    list[#list+1] = tech.name
  end
end
game.write_file("techs.lua", serpent.block(list) .. "\n", true)

Write all enabled recipes to file

/c local list = {}
for _, recipe in pairs(game.player.force.recipes) do 
	if recipe.enabled then
    list[#list+1] = recipe.name
  end
end
game.write_file("recipes.lua", serpent.block(list) .. "\n", true)

See also