Console/Commands

This im age shows useful console commands clearly. Open the console by pressing ~, ^, ø or ö. Depending on which keyboard layout you have. You can change it by pressing shift + alt. Also you can hide the console menu again by pressing Ctrl + L.

To enable commands open the settings.ini file at the following location: Windows, Mac: \Klei\DoNotstarve\settings.ini Linux:        ~/.klei/DoNotStarve/settings.ini

Opening settings.ini, players should make the following changes: [MISC] ENABLECONSOLE = true To find this for mac you need to go to your downloads and find dontstarve folder and open it, in there will be a folder called klei, open it and carry on opening untill u see 4 documents and then open a folder called ;Settings.ini and do the changes that are said that need to be done and it will work.

Note: You have to re-enter every command after loading a world.

Simple commands
To enable simple commands, declared in data\scripts\consolecommands.lua, but disabled by default, do:

RunS​cript("consolecommands")

This will allow you to use the following commands:



c_spawn("prefab", amount)
 * Debug spawn

Improved DebugSpawn("prefab"), spawns amount of selected "prefab". c_doscenario(scenario)
 * Scenario (Not tested)

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

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

''Sets your sanity to selected percentage. Note: Use fractional numbers 0.90 = 90%.'' c_sethunger(0.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. There's some other commands, but they're hard to use and not very useful.

Player commands
​​ GetPlayer.components.locomotor.runspeed = 6 ''Standard runspeed is 6. 10 makes you a bit faster and with 40 you can walk through walls and "over" water. ''
 * Runspeed

​GetPlayer.components.health:SetInvincible(true)​ It won't drain Sanity, Hunger or Health when attacked anymore.
 * God mode

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

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

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

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

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

GetPlayer.components.beavernessSetPercent(1)

turns you into werebeaver

World commands
​DebugSpawn("prefab name")​ After pressing enter, it spawns the object at the position of you cursor.
 * Debug Spawn

​c_gonext("prefab name")​ ''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
 * Delete Item Under Mouse

​minimap = TheSim:FindFirstEntityWithTag("minimap")​ ​minimap.MiniMap:ShowArea(0,0,0,10000)​ ''First enter the upper code, then the second one. This will show the whole map''
 * Reveal Map

One-line, longer version: ​minimap = TheSim:FindFirstEntityWithTag("minimap").MiniMap:ShowArea(0,0,0,10000) ​

​GetClock:MakeNextDay Skips the current day.
 * Skip day

Usage: ​GetClock:SetSegs(day,dusk,night) ''Sets amount of segments. Errors if adds up to over 16.'' Example: ​GetClock:SetSegs(14,1,1) Very long day, very short dusk and night (one segment for dusk and one for night)
 * Set segments

​for x = 1, 50 do GetClock:MakeNextDay end​ ''Skips 50 days in this example. Replace 50 with the amount of days you want to skip. ''
 * Skip more days

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

​GetClock:NextPhase​ Skips the current phase.
 * Skip phase

​GetSeasonManager:StartSummer​ Start summer
 * Start Summer

​GetSeasonManager:StartWinter​ Start winter
 * Start Winter

​GetSeasonManager:StartPrecip​ Start rain.
 * Start Rain

​GetSeasonManager:StopPrecip​ Stop rain.
 * StopRain

​print(math.sqrt(GetPlayer: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. GetPlayer.profile:UnlockCharacter("willow") GetPlayer.profile:Save ''Unlocks Willow. Does not need to be re-entered after the first time unless you lose your profile settings.'' GetPlayer.profile:UnlockCharacter("wolfgang") GetPlayer.profile:Save ''Unlocks Wolfgang. Does not need to be re-entered after the first time unless you lose your profile settings.'' GetPlayer.profile:UnlockCharacter("wendy") GetPlayer.profile:Save ''Unlocks Wendy. Does not need to be re-entered after the first time unless you lose your profile settings.'' GetPlayer.profile:UnlockCharacter("wx78") GetPlayer.profile:Save ''Unlocks WX-78. Does not need to be re-entered after the first time unless you lose your profile settings.'' GetPlayer.profile:UnlockCharacter("wickerbottom") GetPlayer.profile:Save ''Unlocks Wickerbottom. Does not need to be re-entered after the first time unless you lose your profile settings.'' GetPlayer.profile:UnlockCharacter("woodie") GetPlayer.profile:Save ''Unlocks Woodie. Does not need to be re-entered after the first time unless you lose your profile settings.'' GetPlayer.profile:UnlockCharacter("wes") GetPlayer.profile:Save ''Unlocks Wes. Does not need to be re-entered after the first time unless you lose your profile settings.'' GetPlayer.profile:UnlockCharacter("waxwell") GetPlayer.profile:Save '' Unlocks Maxwell. Does not need to be re-entered after the first time unless you lose your profile settings. '' ​GetPlayer.profile:UnlockEverything
 * Unlock Willow
 * Unlock Wolfgang
 * Unlock Wendy
 * Unlock WX-78
 * Unlock Wickerbottom
 * Unlock Woodie
 * Unlock Wes
 * Unlock Maxwell (Character)
 * Unlock Everything (Currently all characters)