Debugging Tips and Tricks!

● ARCHIVED · READ-ONLY
Started by Neok 5 posts View original ↗
  1. Let's share some tips for debugging scripts!

    One of my fav's that I think everyone should know is:

    p(output)msgbox_p(output)Where output can be a string, variable, etc.

    p(output) displays whatever the output is in the RGSS console.

    msgbox_p does the same, but in a popup window.

    So some ways to use it, if you want to check the condition of a switch, you can write in your script:

    p($game_switches[n])Where n is the number of the switch you're checking. So when you run the game and your script reads that line, it'll print 'true' or 'false' depending on whether that switch is currently turned on or not. This can be useful when you need to check a switch's state multiple times without going into F9 debug, or if you can't even go into F9 debug (such as when displaying a message)

    What other tricks do you guys use?

    (Don't think I saw this topic anywhere. Sorry if it's already been done!)
  2. Press F9 and you can see a window which shows all of the Switches and Variables you have defined.  You can even edit them from there.

    Hold down the Control key to walk through walls and events and bypass all random encounters.
  3. Almost every RGSS3 tool that I've written falls into this category in some way, shape, or form.

    • SES Console -- a REPL for debugging and testing code as the game is running
    • SES Debugger -- set breakpoints in your scripts and debug them as-needed
    • SES Tracer -- trace the Ruby call stack, useful for all kinds of debugging
    • SES Benchmark -- test the execution speed of multiple approaches to a problem
    • SES Lexicon -- browse script source code in-game; great in combination with all of the other tools
    Honestly, all of these tools could also be ported to work with RGSS2 or the original RGSS quite easily -- I simply haven't taken the time to do so myself.
  4. Debug frameskip

    www.rpgmakervxace.net/topic/24034-debug-frameskip/

    It's not for scripting purpose, but for developing a game. Just press a key, and it will be like a cutscene skipper
  5. @Solistra Wow, that's pretty advanced stuff! Gonna look all that over when I have time.

    @TheoAllen Very cool, yeah just anything that saves time and improves efficiency would fit this thread.

    Another recommendation I have is to try doing your scripting outside of RPG Maker's Script Editor. For example, Notepad++ is an incredible tool for programming languages, and lets you do all kinds of useful things like set your own color definitions for syntax, hide parts of the code that you don't need to look at, bookmark places in the code so that you can get back there later without having to search for it. Whenever I script now, I just copy everything from the editor to a new Ruby Notepad++ file, do what I need to do there, then port it back over. It's so much easier than working with the Script Editor.