Console/Don't Starve Together Commands

The Command Console is enabled by default. If for whatever reason it is not, you first need to do some tweaking in your settings.ini of your save. This can be found in the "DoNotStarveTogether" folder, located in the following paths : Windows, Mac: \Klei\DoNotStarveTogether\settings.ini Linux:        ~/.klei/DoNotStarve/settings.ini

Locate the settings.ini and open it with Notepad and where it says [MISC]ENABLECONSOLE = false and rewrite it as [MISC]ENABLECONSOLE = true then save the document.

Then to open the console while in game by pressing "~" by default on English keyboards. This can be changed at any time in the controls menu.

Notes:
 * You have to re-enter almost every command after loading a world.
 * Lua supports variable numbers of arguments to functions, so if, for example, you only want to spawn one of a prefab, you can leave out the "amount": "c_spawn('beefalo')".

Simple commands
c_spawn("prefab", amount)
 * Spawn prefab

Improved DebugSpawn("prefab"), spawns amount of selected "prefab" under the mouse cursor. c_give("prefab", amount)
 * Give Item

''Spawns amount of selected "prefab" in your inventory. Only works with Backpacks and Items that can be stored in the inventory.'' c_doscenario(scenario)
 * Scenario (Not tested)

Apply a scenario script to the selection and run it. c_sethea​lth(percent)
 * Health

''Sets your health to selected percentage. Note: Use fractional numbers 0.90 = 90%.'' c_setsanit​y(percent)
 * Sanity

''Sets your sanity to selected percentage. Note: Use fractional numbers 0.90 = 90%.'' c_sethunger(pe​rcent)
 * Hunger

''Sets your hunger to selected percentage. Note: Use fractional numbers 0.90 = 90%.'' c_give("prefab", am​ount)
 * Spawn item

Creates selected item at given amount directly into your inventory. c_godmode
 * God Mode

''It won't drain Sanity, Hunger or Health when attacked anymore. You cannot change your stats with commands while in godmode.''

c_speed(value)
 * Set bonus running speed

''Standard bonus runspeed is 0. 6 makes you twice as fast and with 20 or more you can easily walk through walls and "over" water. ''

There's many other commands, but they're hard to use and not very useful.

Player commands

 * Note: Most of these will not work if you are a client and not an admin sending a remote command (switch to remote mode with ctrl).

ThePlayer:EnableMovementPrediction(enable) ''Enabled by default, setting it to "false" will exchange rubberbanding for choppiness, but is often helpful for combat. This only does anything if executed by a client, hosts do not have prediction.''
 * Action Prediction

ThePlayer.components.builder:GiveAllRecipes You can craft everything.
 * Creative mode

​ThePlayer.components.health:SetMaxHealth(value) Change the Maximum Health of your Characters
 * Maximum health

ThePlayer.components.sanity:SetMax(value) Change the Maximum Sanity of your Characters
 * Maximum sanity

ThePlayer.components.hunger:SetMax(value) Change the Maximum Hunger of your Characters
 * Maximum hunger

ThePlayer.components.hunger:Pause(true) Your Characters won't starve anymore.
 * Pause hunger

ThePlayer.components.beaverness:SetPercent(1) Turn Woodie into the Werebeaver.
 * Werebeaver

Other Player Commands
AllPlayers[number] ''AllPlayers[1] will get ThePlayer if you are the host. Other players should have numbers as shown on the scoreboard (In certain situations, the number may be wrong. You can be more precise by using c_listallplayers first to see the username and character for each player number.). Most of ThePlayer commands can be used with AllPlayers[number] instead of ThePlayer.''
 * Get another player

for k,v in pairs(AllPlayers) do command end ''Replace command with another command, using "v" instead of AllPlayers[number]. For example, "for k,v in pairs(AllPlayers) do c_move(v) end" will move all players to the mouse position.''
 * Apply a command to all players

c_move(AllPlayers[number]) Moves the player to the cursor position.
 * Move another player

AllPlayers[number]:PushEvent('death') Kills the player.
 * Kill a player

AllPlayers[number]:PushEvent('respawnfromghost') Resurrects the player.
 * Resurrect a player

c_despawn(AllPlayers[number]) Note that this will delete their items, so it is recommended that you kill them first to drop their items.
 * Return a player to character select

c_reset(regenerate) ''Leaving out regenerate will simply restart the server. Players will remain connected. c_reset(true) will delete the world and generate a new one.''
 * Restart the server

World commands
c_gonext("prefab") ''After pressing enter, it teleports you to the first numerical instance of the named prefab. If multiple iterations of the prefab exist, a list of the entity numbers will be displayed in the console log, and each subsequent execution of the same command will transport the player from entity to entity in the order they were generated in the world.''
 * Teleport to Prefab

TheInput:GetWorldEntityUnderMouse:Remove After pressing enter, it deletes the item under your mouse TheWorld.​minimap.MiniMap:ShowArea(0,0,0,10000)
 * Delete Item Under Mouse
 * Reveal Map

​TheWorld:PushEvent("ms_nextcycle") ''Skips the current day. Change the value to skip more days or parts of days (e.g. 16*30*4.5 to skip 4.5 days)''
 * Skip day

WARNING: Too big values may freeze the game. (Depending on computer speed)

​TheWorld.net.components.clock:OnUpdate(16*30*x) ''Skips the current day. Change x to skip more days or parts of days (e.g. 16*30*4.5 to skip 4.5 days)''
 * Skip time

WARNING: Too big values may freeze the game. (Depending on computer speed)

LongUpdate(X) Skips X time units and performs the "LongUpdate" function on world objects
 * Skip time units and update

Note: There are 30 time units per segment. To skip a whole day one can either use LongUpdate(480) or use multiplicative values such as LongUpdate(X*16*30) or LongUpdate(X*TUNING.TOTAL_DAY_TIME), with X=days to skip.

Usage: ​TheWorld:PushEvent("ms_setclocksegs", {day=x,dusk=y,night=z}) ''Sets amount of segments. Errors if x + y + z adds up to over 16. Note that this will get reset the next day.'' Example: TheWorld:PushEvent("ms_setclocksegs", {day=14,dusk=1,night=1}) Very long day, very short dusk and night (one segment for dusk and one for night)
 * Set segments

Usage: ​TheWorld:PushEvent("ms_setseasonclocksegs", {summer={day=sx,dusk=sy,night=sz}, winter={day=wx,dusk=wy,night=wz}}) ''Sets amount of segments. Errors if x + y + z adds up to over 16. Unlike setclocksegs, this is permanent.'' Example: TheWorld:PushEvent("ms_setseasonclocksegs", {summer={day=14,dusk=1,night=1}, winter={day=13,dusk=1,night=2}}) Very long day, very short dusk and night (one segment for dusk and one for night), with a slightly longer night in winter.
 * Set season segments

TheWorld:PushEvent("ms_nextphase") Skips the current phase.
 * Skip phase

TheWorld:PushEvent("ms_setseason", "summer") Start summer
 * Start Summer

TheWorld:PushEvent("ms_setseason", "winter") Start winter
 * Start Winter

When the RoG DLC is added, the additional commands will likely be TheWorld:PushEvent("ms_setseason", "spring")​ and TheWorld:PushEvent("ms_setseason", "autumn")​

TheWorld:PushEvent("ms_forceprecipitation") Start rain.
 * Start Rain

TheWorld:PushEvent("ms_forceprecipitation", false) Stop rain.
 * Stop Rain

TheWorld:PushEvent("ms_sendlightningstrike", TheInput:GetWorldPosition) ''Lightning strike on mouse cursor. Will hit lightning rod instead if there is one near''
 * Do Lightning Strike

print(math.sqrt(ThePlayer:GetDistanceSqToInst(TheInput:GetWorldEntityUnderMouse))) Prints the distance between player and object under mouse to the console log (displayed with Ctrl + L by default).
 * Measure Distance

Profile Commands
While profile commands are permanent and do not need to be done each time, they do need to be performed while in a game. You can unlock multiple characters at a time without requiring the line including the save until the very last step. ThePlayer.profile:UnlockCharacter("willow") ThePlayer.profile:Save ''Unlocks Willow. Does not need to be re-entered after the first time unless you lose your profile settings.'' ThePlayer.profile:UnlockCharacter("wolfgang") ThePlayer.profile:Save ''Unlocks Wolfgang. Does not need to be re-entered after the first time unless you lose your profile settings.'' ThePlayer.profile:UnlockCharacter("wendy") ThePlayer.profile:Save ''Unlocks Wendy. Does not need to be re-entered after the first time unless you lose your profile settings.'' ThePlayer.profile:UnlockCharacter("wx78") ThePlayer.profile:Save ''Unlocks WX-78. Does not need to be re-entered after the first time unless you lose your profile settings.'' ThePlayer.profile:UnlockCharacter("wickerbottom") ThePlayer.profile:Save ''Unlocks Wickerbottom. Does not need to be re-entered after the first time unless you lose your profile settings.'' ThePlayer.profile:UnlockCharacter("woodie") ThePlayer.profile:Save ''Unlocks Woodie. Does not need to be re-entered after the first time unless you lose your profile settings.'' ThePlayer.profile:UnlockCharacter("wes") ThePlayer.profile:Save ''Unlocks Wes. Does not need to be re-entered after the first time unless you lose your profile settings.'' ThePlayer.profile:UnlockCharacter("waxwell") ThePlayer.profile:Save '' Unlocks Maxwell. Does not need to be re-entered after the first time unless you lose your profile settings. '' ThePlayer.profile:UnlockCharacter("wigfrid") ThePlayer.profile:Save '' Unlocks Wigfrid. Does not need to be re-entered after the first time unless you lose your profile settings. '' ThePlayer.profile:UnlockCharacter("webber") ThePlayer.profile:Save '' Unlocks Webber. Does not need to be re-entered after the first time unless you lose your profile settings. '' ​ThePlayer.profile:UnlockEverything
 * Unlock Willow
 * Unlock Wolfgang
 * Unlock Wendy
 * Unlock WX-78
 * Unlock Wickerbottom
 * Unlock Woodie
 * Unlock Wes
 * Unlock Maxwell (character)
 * Unlock Wigfrid (Reign of Giants DLC)
 * Unlock Webber (Reign of Giants DLC)
 * Unlock Everything (Currently all characters)

Miscellaneous Commands
ErasePersistentString("morgue") ''Clears the morgue. Requires closing and reopening the game for changes to be seen.''
 * Clear the morgue