• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Variable Tracker

  • 971
    Posts
    8
    Years
    • Age 22
    • Seen Nov 28, 2022
    Debugging code can be pretty annoying, especially when you don't know the value of a certain variable. That's where this script comes in. It tracks whichever variables you want by displaying their value at the right side of the screen. You can specify the size of the extra window, as well as how many lines a variable may use up to show the value.


    [PokeCommunity.com] Variable Tracker






    Installation

    In a new script section above Main, add the following script:
    VariableTracker




    Documentation

    To track the value of a variable, use VariableTracker.track(name, code)
    • name: This is the display name of the variable and can be literally anything as long as it's a string.
    • code: This can either be a String or a Proc. If it's a String, it will evaluate the string and display the return value. If it's a Proc, it will call the proc (without any arguments) and display the return value. It automatically calls .inspect on whatever it's about to display.
    You can call this method at any time.


    To stop tracking a variable, use VariableTracker.stop_tracking(name). This will stop tracking the variable (so that it won't display it anymore).



    When this script tries to display a value but it returns an error, it will print out --- instead.
     
    Back
    Top