Control Variable Range?

Beta4

Veteran
Veteran
Joined
May 15, 2015
Messages
72
Reaction score
1
First Language
English
Primarily Uses
So I would like to know, how do I write a range on a control variable in an If statement with possible Else attached.


Lets say for example:  If: This Variable 8 - 47. Else 48 - 50


Where "This Variable" is the name of the control variable with the range between 8 and 47 in the If statement  with an Else with a range between 48 and 50


An example with the If statement and example with the If and else statement combo would be nice.


Also would I put this code a Conditional Branch, Tab 4 in the Script Input box?


In other words how would I write that in javascript.


Thanks again any help would be appreciated.
 

chalkdust

Resource Staff
Restaff
Joined
Mar 23, 2015
Messages
360
Reaction score
556
First Language
English
Primarily Uses
RMMV
There are lots of ways to embed conditional branches to achieve this, but the cleanest solution would be to use the script option in the conditional branch and use the following:


$gameVariables.value(index) >= 8 && $gameVariables.value(index) <= 47


Then, in your else branch start another conditional branch and use this:


$gameVariables.value(index) >= 48 && $gameVariables.value(index) <= 50


Change "index" to the number of the variable you want to check.
 

Beta4

Veteran
Veteran
Joined
May 15, 2015
Messages
72
Reaction score
1
First Language
English
Primarily Uses
Thank you thats great.... would you know what it would be if i wanted to get a number of potions for example... such as item.value(index) what would it be in other words to be able to do it with items if you can. Thanks again
 

chalkdust

Resource Staff
Restaff
Joined
Mar 23, 2015
Messages
360
Reaction score
556
First Language
English
Primarily Uses
RMMV
I'm not 100% sure but I think this might work:


$gameParty.numItems($dataItems[index])


There may be a more concise way but I'm not super familiar with the code yet.
 

Beta4

Veteran
Veteran
Joined
May 15, 2015
Messages
72
Reaction score
1
First Language
English
Primarily Uses
Ok do you know how display it in a text box... such as i know control variable can display with \V[10]  i.e show the quantity of control variable 10.. 
 

chalkdust

Resource Staff
Restaff
Joined
Mar 23, 2015
Messages
360
Reaction score
556
First Language
English
Primarily Uses
RMMV
I don't know a way to directly inject it into a message. Just store it to a temp variable before the message window pops up, then display the temp variable. Make sure to post back if that code above works or not because someone else may come here with the same question.
 

Beta4

Veteran
Veteran
Joined
May 15, 2015
Messages
72
Reaction score
1
First Language
English
Primarily Uses
Hey great! Thanks a bunch! It works by the way!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,018
Members
137,563
Latest member
MinyakaAeon
Top