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,901
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
38,490
Reaction score
10,911
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,901
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

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,035
Reaction score
16,847
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

GABposterworkhardest.png
Just about finished I reckon.
This could probably be an entire thread, but it’s really interesting how replaying a game several years later can change how you relate to a character. I think Tidus from FFX got such a bad rap. I getchu. Completely different reaction as an adult now.
As you see, I still enjoy writing tutorials. Is there anything specific you want to see? (I know mapping and editing/resource making is usually popular, but those are very broad topics)
Well, I wanted to expand player battlers visually and now have 3 sheets and counting for each of my players party.
1. Regular sheet
2. The character has turned stone sheet.
3. Using potions sheet.

Technically the main hero has 4 since he starts with a wooden sword, and I felt that the battler should reflect that until he gets a metal one.

Right back to the RM game dev grind in about 15 minutes. :LZSexcite:

Forum statistics

Threads
131,735
Messages
1,222,793
Members
173,488
Latest member
GustoEater
Top