Jump to content

Effective debugging method?


Recommended Posts

Currently if I want to fix my script, I do these:

  1. edit lua or scml with notepad++ or Spriter
  2. save file(s)
  3. run game
  4. wait until the DS/DST tool doing its stuff (compile etc)
  5. wait until game loads
  6. click Play
  7. click [Host]
  8. resume game
  9. see result/changes or error, exit game, go back to step 1

 

Step 4->8 takes much time.

Step 4 is required, I understand.

However, is there a way to just run the game and skip all other mods from being rescanned/recompiled?
Also when you click Play (step 6) is there a way to just go Host so it doesn't spend time scanning for servers?

 

Thanks.

 

Link to comment
Share on other sites

@SenL, When they had a beta(-beta?) branch for experimental workshop support, they had a button above play that just jumped straight into hosting world 1... Maybe there's a flag somewhere that enables that. I agree, it would definitely be helpful.

 

Although I don't think step 4 is really required. I don't think I've ever had a time where it compiled stuff for me that I wasn't already launching the game specifically to compile. It would be nice if it were one of the launch programs under the Don't Starve Mod Tools, so you could just manually run it when you want to. 

Link to comment
Share on other sites

When testing code you do not need to completely restart the game. Just reloading the map will be enough; I added a console command to do this myself.

 

GLOBAL.c_reload = function ()
    GLOBAL.StartNextInstance({
        reset_action = GLOBAL.RESET_ACTION.LOAD_SLOT,
        save_slot = GLOBAL.SaveGameIndex:GetCurrentSaveSlot()
    })
end

 

This is assuming you didn't completely break the code and it gets stuck on a error screen. Could possibly modify that code too tho that it reloads when that happens =p

Link to comment
Share on other sites

If you enable the debug keys, the key combination Ctrl+Shift+R loads immediatly the world saved in slot 1.

Put this in the modmain of your mod:

GLOBAL.CHEATS_ENABLED = trueGLOBAL.require('debugkeys')

There is also the Ctrl+R combination that does a soft reset of the game, G to go into godmode or resurrect you if you're dead, Shift+R to delete prefab under your mouse, T to teleport you to the mouse, and much more! :-) You can look at all of them in scripts/debugkeys.lua.

Edited by Jjmarco
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...