Ender570

Villager
Member
Joined
Jan 24, 2021
Messages
16
Reaction score
3
First Language
English
Primarily Uses
RMMZ
I'm trying to do a conditional branch to determine the amount of days in that month

I have my game variables set as:
0001 Day of Week
0002 Week (number of weeks passed)
0003 Month
0004 Day of Month

0003 ranges from 1-12
I know months 1, 3, 5, 7, 8, 10, and 12 have 31 Days
Month 2 has 28
Everything else has 30

So i first wanted to set conditions for the months with 31 days

I thought that
if $gameVariables.value(0003) == [1,3,5,7,8,10,12]

would mean "If the value of variable 0003 is equal to one of these numbers..."
but, I'm not getting that result

I'm very new to java script, so any help would be appreciated!
 

TSR

The Northern Frog
Veteran
Joined
Nov 14, 2019
Messages
321
Reaction score
337
First Language
French
Primarily Uses
RMMZ
Hello! Try to write it like this:
const ar = [1,3,5,7,8,10,12];
if (ar.includes($gameVariables.value(3))) {...}
 

Ender570

Villager
Member
Joined
Jan 24, 2021
Messages
16
Reaction score
3
First Language
English
Primarily Uses
RMMZ
Hello! Try to write it like this:
const ar = [1,3,5,7,8,10,12];
if (ar.includes($gameVariables.value(3))) {...}
Awesome! Thank you!
I actually tried to use the includes() function before, but i did it wrong lol
 
  • Like
Reactions: TSR

Latest Threads

Latest Posts

Latest Profile Posts

unknown.png

A sketch of a character for an upcoming chapter. I am pre-preparing the heck out of this one and future chapters, don't want to spend time figuring the story out again. :blush:
Today *Fix the game UI
RMMZ maxRows make me tired.
The game supports real-time language switching (really interesting).
8laFKAa.png


jBYDFzZ.png


lYbvPth.png

mY99lgU.png

Swag collecting in the new randomly generated area. Now the mini map also shows the randomly generated features... And even illustrates the whole "bubble" system" that I made to manage memory... Though that part's inadvertent. We'll just call that "the fog of war"... Yes, that's what we'll do. Nobody will be the wiser! :kaopride:
not me being not lazy for 5 seconds and drawing another char portrait (her name is hazel)
its_hazel.png
Been a while since the last time I made a song remix. Had a blast making this

Forum statistics

Threads
110,458
Messages
1,053,477
Members
143,553
Latest member
DonnerTasche
Top