EthanFox

Veteran
Veteran
Joined
Oct 15, 2018
Messages
620
Reaction score
408
First Language
English
Primarily Uses
RMMV
When a user starts a game for the first time, reinitialising all variables, and no script/event etc. has edited a variable, is it "zero"?

Not "null", or "void", but actually the numeric quantity of "zero", which isn't necessarily the same thing?
 

Mike-Turtle

Veteran
Veteran
Joined
Apr 17, 2021
Messages
75
Reaction score
181
First Language
English
Primarily Uses
RMMV
Yes. All start with the numerical value of '0' - and all switches start as 'false'.
 
Last edited:

SimProse

Veteran
Veteran
Joined
Jul 9, 2016
Messages
375
Reaction score
202
First Language
English
Primarily Uses
Traditionally in Javascript, its similar to other languages in that it depends on what type the variables is initialized with. "Numbers" initialize with 0 and 'Strings' initialize with null unless they're assigned with a default value at creation time.
 

EthanFox

Veteran
Veteran
Joined
Oct 15, 2018
Messages
620
Reaction score
408
First Language
English
Primarily Uses
RMMV
Traditionally in Javascript, its similar to other languages in that it depends on what type the variables is initialized with. "Numbers" initialize with 0 and 'Strings' initialize with null unless they're assigned with a default value at creation time.
Thanks, I'm not so accustomed to JS.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,977
Reaction score
4,587
First Language
English
Primarily Uses
RMMZ
$gameVariables._data initialises as an empty array. When you access the value with $gameVariables.value(x), it will either return the value at the given index, or 0 if it doesn't exist.

Note that this does not mean the variable itself defaulted to 0; technically the index you tried to access had a value of "undefined".
 
Last edited:

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
848
Reaction score
731
First Language
English
Primarily Uses
RMMV
$gameVariables._data initialises as an empty array. When you access the value with $gameVariables.value(x), it will either return the value at the given index, or 0 if it doesn't exist.

Note that this does not mean the variable itself defaulted to 0; technically the index you tried to access had a value of "undefined".
I believe it also rounds numbers to integers.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
4,977
Reaction score
4,587
First Language
English
Primarily Uses
RMMZ
I believe it also rounds numbers to integers.
It does not. It DOES round them if you assign a numerical value using $gameVariables.setValue, but you can set data directly and put a float in there.
 

Latest Threads

Latest Posts

Latest Profile Posts

Took some trial and error, but I managed to create "visuals" for underground dig path regions.
Couldn't sleep at all so I started working on the topmost deck. I've had to make several deviations from the Imperator/Berengaria's deck-plans to accommodate MV's movement, but 100% accuracy was never my intention.
Still no name for the poor ship...:kaodes:
Screenshot-2022-06-25-053308.png
ScreenShot_6_24_2022_9_20_7.png
Here's Mike when you get a preemptive strike in battle. There's another one for when an enemy sneaks up on you too.
Suddenly, games mean nothing. The money spent was worth it to bring souls towards the light of life. May God bless my path forever. I pray that all are shaken for truth and poured out flat on the table of true understanding, knowledge, and wisdom. Bless you.

Forum statistics

Threads
123,033
Messages
1,153,561
Members
161,374
Latest member
artdeko
Top