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,334
Reaction score
9,718
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,752
Reaction score
15,889
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 Profile Posts

Dog saliva is an antiseptic.
NghNgE9.gif
Oh man. IGMC's finally back. I really want to participate, but I'm not sure if I have the time.
It is DC's turn to be celebrating her leveling up and starts her 20th year. We were many to think she wouldn't live that long. Starts your cats motors and make 'em purr!
why_hello_mira.jpg

I made myself a cult leader, and a concept scene for him as well. :LZSexcite:

Forum statistics

Threads
123,316
Messages
1,155,722
Members
161,736
Latest member
sm0ll
Top