var(var(n)) == var(var(n)) not working?

Brigg

Veteran
Veteran
Joined
Apr 22, 2015
Messages
129
Reaction score
4
First Language
English
Primarily Uses
I have an event that sets values to Variables 24-31. Variable 11, in this scenario, is a random number.
Rather than list them individually, I made a loop that references another variable within the variable.
However, I just can't seem to get it to work. I realize, listing them is technically less lines of code, but I prefer using the loop.
So what is it that I'm doing wrong?

This:
$gameVariables.value($gameVariables.value(32)) == $gameVariables.value($gameVariables.value(52))

Should become this:
$gameVariables.value(24) == $gameVariables.value(11)


RMMV.Var.within.Var.JPG

Sidenote:
I had to add an additional "=" inbetween the strings to avoid a Left-Hand error, which I thought was odd since it's not an IF condition, but I guess that's javaScript for you.

EDIT:
I think I just realized the problem. I need to write it as:
$gameVariables.setValue($gameVariables.value(32),$gameVariables.value($gameVariables.value(52)))
 
Last edited:

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
454
Reaction score
209
First Language
English
Primarily Uses
RMMV
Actually by using the double ='s it was evaluated as being either true or false. So:
Code:
1 == 1 // this equals true
1 == 0 // this equals false
Currently I am too tired to be of much further help at the moment sorry. :LZYdizzy:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

If there are any mods or admins online, could you please see about the re-translation pages for RPG Maker MV? They are all down :rsad:
Werewolf cons: you lose control of yourself once a month and could accidentally kill your friends. Vampire cons: no garlic bread. The choice is simple. Werewolf for sure.
2 huge market drops in 2 days. So glad I sold my non-dividend stocks about 2 weeks ago. And if the dividend ones drop heavily, hey more cheap stocks for me!
My tutorial is live! It covers using Yanfly's weapon unleash to replace the basic attack skill with a more dynamic version depending on which weapon type the actor has equipped. It also includes how to import a custom function used to generate a random number within supplied minimum and maximum values, used in the replaced skills, to give weapons a set damage range.
What can I sing for my sisters birthday...?

>.<'

Forum statistics

Threads
94,520
Messages
921,574
Members
124,374
Latest member
Daiomed
Top