Somehow eval() doesn't want to evaluate my string

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
so I have a code which looks like this


if (item.meta.max) {
return eval(item.meta.max);
};


With item.meta.max being "$gameVariables(1)"


but when the code is called, it returns an error that says object is not a function. the nodekit console points to item.meta.max line during this error


I already made sure that item.meta.max returns "$gameVariables(1)" via a show text event so somehow eval doesn't seem to want to evaluate it.. 


Anyone has an idea of the problem here?
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
You use the function $gameVariables.value(variableId) to get the value of a variable.


The actual array of game variables is stored in $gameVariables._data. You'd access a particular variable directly via $gameVariables._data[varaibleId].


The _data array is a property of the $gameVariables object. That's why you get that error.


The object structures can be viewed via the console. Press F8, type console.log(window) and search for whatever you want to modify.


To see the list of natively available functions I recommend grabbing zalerinian's split files.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Oh I see, thanks a lot! I always forget that most of the things directly accessible back on RGSSx have getter and setter functions on MV  :)


PS: how do I select the post that gets marked as the answer?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
it doesn't look like the script forums have that feature enabled - if it did, you wouldn't miss it.
 

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

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,859
Messages
1,017,030
Members
137,566
Latest member
Fl0shVS
Top