Ruth Studio

Veteran
Veteran
Joined
Oct 19, 2017
Messages
61
Reaction score
24
First Language
English
Primarily Uses
RMMV
I am working on a simple plugin for myself to create easy to call scripts in my game.

So far, I got Event X & Y to work. I was working doing the same for Variables. However, I am having some issue so I thought I would reach out to the experts.

1641214486039.png
 

eomereolsson

Veteran
Veteran
Joined
Sep 29, 2021
Messages
211
Reaction score
176
First Language
German
Primarily Uses
RMMV
As far as I know $gameVariables doesn't have a property _value. Where did you find that?
Try instead accessing:
JavaScript:
return $gameVariables._data[id];
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
5,978
Reaction score
2,342
First Language
Dutch
Primarily Uses
RMMV
you can just use the regualar one if you want it's value.

$gameVariable.value(id) unless you want to set the value ofcourse.

the one you use is probably more globally if you want to set something
or check multiple values?
 

Ruth Studio

Veteran
Veteran
Joined
Oct 19, 2017
Messages
61
Reaction score
24
First Language
English
Primarily Uses
RMMV
That worked thanks!

I just went with the RPG Maker script $gameVariables.value(id). So, I assumed it was "value".
As far as I know $gameVariables doesn't have a property _value. Where did you find that?
Try instead accessing:
JavaScript:
return $gameVariables._data[id];
 

eomereolsson

Veteran
Veteran
Joined
Sep 29, 2021
Messages
211
Reaction score
176
First Language
German
Primarily Uses
RMMV
Such assumptions can be verified either by looking at the code of the engine or the documentation. No need to blindly guess.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,682
Reaction score
9,859
First Language
German
Primarily Uses
RMMV
@Ruth Studio
are the exaamples in your first post just badly selected or are you indeed adding an entire API-Layer just so that you have to type less letters when accessing data?

Never forget that the computer has to interpret that code (because javascript is an interpreted language, not a compiled one), and even if one such function is not much, it does add up when using those functions thousands of times.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
6,843
Reaction score
9,234
First Language
Indonesian
Primarily Uses
N/A
Probably for fewer letters to type. I do it from time to time as well.

Never forget that the computer has to interpret that code (because javascript is an interpreted language, not a compiled one), and even if one such function is not much, it does add up when using those functions thousands of times.
I would like to correct this assumption. Yes, it is interpreted language. But the program only gets even worse if (and is likely to be) used in the script call box, which in itself is an eval function (an expensive one). However, if you only do it once, shouldn't be a problem (damage formula also uses eval). It only becomes problematic if you're using the script call within the game loop. But if you're using it as a "native code" (not using eval), shouldn't be worry that much.
 

Latest Threads

Latest Posts

Latest Profile Posts

Only 3 more days to get your copy of Move That Box! with -15% discount!
1660090657213.png
Mistakes will be made.
After three years, it was awesome to be back at Gen Con!
Words of Wisdom: You can be honest and alone. Or dishonest and together.
Working on mapping using RPGTools to create parallax maps using PVgames tiles/assets. It's super cool... but mapping is still something I drag my feet on getting done. I hate this but love the math parts of design, which is the opposite of a lot of dev's around, I think. It really do be different strokes for different folks.

Forum statistics

Threads
124,381
Messages
1,163,226
Members
163,180
Latest member
Viking
Top