Jory4001

Veteran
Veteran
Joined
Feb 16, 2014
Messages
80
Reaction score
20
First Language
English
I have an event with a conditional that needs the "Script" so it can check multiple things at once, If (A < C) && (A > D) Then...


I tried:


$gameVariables.(26) > 60 && $gameVariables(26) < 81;


but I get a syntax error "("


I am fairly familiar with javascript conditionals and have do many in my plugins, but I'm not sure how the "Script" event handles them...
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,114
Reaction score
5,876
First Language
English
Primarily Uses
RMVXA
$gameVariables.value(26) > 60 && $gameVariables.value(26) < 81 is the correct syntax.


Don't forget you can also nest Conditional Branches within each other (place the < 81 check inside the block that runs if it's > 60) - in this case, this approach would save you from needing to remember JS syntax (though there are things you might need to check like a troop member's current TP that would require a scripted condition).
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,309
Reaction score
9,705
First Language
German
Primarily Uses
RMMV
the script option is javascript, but you used the wrong names. Check the forum for the correct function names to get the values of the variables.


Additionally, the syntax error in that form was caused by the point before the (
 

Jory4001

Veteran
Veteran
Joined
Feb 16, 2014
Messages
80
Reaction score
20
First Language
English
Thanks, I knew about nesting the Conditionals, but that is very inefficient!


the .value was what I was missing! I Checked the forums and google and found nothing, I also checked the script call equivalent page and it only showed how to set a variable.


Thanks for the Help!
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,114
Reaction score
5,876
First Language
English
Primarily Uses
RMVXA
You're welcome!


What I've done to figure out the correct syntax when unsure (which is 80% of the time, lol) is to open up the game's scripts (accessible from the game's 'js' folder) and search for words that I think might be useful, such as "variables".  Sometimes you need to luck upon the right word, or search through a lot of irrelevant results, but eventually you'll usually find a good example of how to use the syntax you need. :)
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,744
Reaction score
15,884
First Language
English
Primarily Uses
RMMV
the Game_Interpreter class within the rpg_objects.js file is a good one.  If you can do it through an event command, that section of code will show the js behind that command.  You'll learn a whole lot by studying the Game_Interpreter functions.
 

Latest Threads

Latest Posts

Latest Profile Posts

Map034.png
First try making a temple- looking thing.
NUMINA Part 1 is finally out ✨ Get it now with a 10% launch discount!
Made this simple Training Dummy :D

obraz_2022-07-01_095700524.png
I'm still undecided weather or not I should add minor swearing to my game. Like I'm going for an all ages demographic... but the idea of a cartoon character saying dammit, hell, or crap in normal conversation is really funny to me.

Forum statistics

Threads
123,223
Messages
1,155,045
Members
161,604
Latest member
Astolfo
Top