• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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
7
Years
    • Age 21
    • 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.


    uc






    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