How to watch var value

Discussion in 'RPG Maker MV' started by XGuarden, Jan 25, 2017.

    Tags:
  1. XGuarden

    XGuarden Veteran Veteran

    Messages:
    419
    Likes Received:
    12
    First Language:
    French
    I look for a realtime help to look at the value of a specific variable.


    Something go wrong, so I want to debug my game.


    It's must exist a way to get realtime value of a var.


    Thanks for your help.
     
    #1
  2. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,580
    Likes Received:
    1,360
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    , if you talk about variable from rpg maker 


    in game tape F9


    if you talk about javascript variable.
     


    transforme your var like thats


    var Thisismyvar = 0;
    // remove the declaration var to change the scope.this allow you to call your variable anywhere in game
    Thisismyvar = 0;


    and in the console (F8)


    Tape the name of your variable and you will get the reeltime current value.


    Capture.JPG
     
    Last edited by a moderator: Jan 25, 2017
    #2
  3. DuncanS

    DuncanS Veteran Veteran

    Messages:
    160
    Likes Received:
    96
    Location:
    Toronto, Ontario, Canada
    First Language:
    English
    In addition to Jonforum's answer, if you're trying to debug a particular script/plugin you can use console.log(); from the script to print to the console.


    You can also access the various global vars ($gamePlayer, $gameMap, $gameVariables...) and all related functions and data directly from the console.


    For example, $gameMap.events(); will list all the event objects on the current map.
     
    #3
  4. JLowther

    JLowther Veteran Veteran

    Messages:
    327
    Likes Received:
    34
    First Language:
    English
    Also, Orange Hud will allow you to display variables on screen:


    http://hudell.com/blog/mv-plugin-orange-hud/


    It's meant for creating new HUDs and interfaces, but I use it all the time to just print a variable on screen that will automatically update whenever it changes.
     
    #4
    XGuarden likes this.
  5. XGuarden

    XGuarden Veteran Veteran

    Messages:
    419
    Likes Received:
    12
    First Language:
    French


    Did't work here, told me that var was undefined. I want value of Var 1 with the name MomentJour(ok)
     
    #5
  6. Jonforum

    Jonforum Veteran Veteran

    Messages:
    1,580
    Likes Received:
    1,360
    Location:
    Canada / Québec
    First Language:
    French
    Primarily Uses:
    RMMV
    @XGuarden


    send your complete script is because you not remove the var declaration before your variable


    ps: Dont quote all post, You will attract the lightning of the moderator :rock-left: .
     
    Last edited by a moderator: Jan 26, 2017
    #6
  7. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    12,065
    Likes Received:
    12,240
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    F9 is the way you show the value of the variable in real time in game. I tried it on a clean project and it works. If you can't even get that far to do that, then the only way I ever got it to work was a print command to force print the value of the variable at that point in time. I know in ruby msgbox_p(name of variable) will do that, but I have no idea on JavaScript (maybe someone who knows JavaScript will know more?)
     
    #7
  8. XGuarden

    XGuarden Veteran Veteran

    Messages:
    419
    Likes Received:
    12
    First Language:
    French
    I fix it wit the orange plugging. That what I need because the provide real time value unlike F9. I try to find out when this value change for no reason so it's perfect.


    Problem solved.
     
    #8

Share This Page