MV Increment variables

Hi guys

I am trying to make a system that gold increase over time. I use Moghunter time system

So basically I assigned hour to variable id 1. I used this equation but did not work

If $gameVariables.value(1) == $gameVariables.value(1)+1;
do increase gold

For example, if 8am, variable ID 1 should be 8
When 9am, variable ID 1 should be 9 (which I hope go meet if condition), but I think my logic is incorrect

Any idea/suggests are welcome
why are you trying to do things with javascript that are easier to do with event commands?
This is not the first time you asked something similar....

if you are trying to learn javascript, it is much easier if you forget about making a game like that while learning how to program - which would help you because your example shows that you don't know how computer logic works, that line can never be true.

and if you're just trying to make a game, then you should learn to use event commands first, and only switch to javascript if there are no event commands that can do that. Because the event system is designed to handle most of the simpler mechanics in any game...

that said, you need two different variables to handle that, because otherwise you'll always have it like "If 1 == 2" which will never be true.
I used this equation but did not work
What you seek is not an equation, rather a system to track that the variable is changed.

The easiest way is to use the second variable.
For example,
Code:
If ($gameVariables.value(1) != $gameVariables.value(2)) {
  $gameVariables.setValue(2, $gameVariables.value(1))
  increase gold
}
got it thanks guys

Original thread: https://forums.rpgmakerweb.com/threads/increment-variables.132307/