Conditional Branch+

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
965
Reaction score
802
First Language
English
Primarily Uses
N/A
@mishakoc You're very welcome, I'm happy it's been useful c:
 

w.alexander

Warper
Member
Joined
Sep 1, 2014
Messages
4
Reaction score
5
First Language
Spanish
Primarily Uses
RMMV
Hi, sorry if this is necroposting.
I've read through the helpfile multiple times, but I don't know if I'm missing it or not.

I was wondering if there is a way to check if the value of a given variable is greater than the values of multiple other variables.
For example, if variable1= 10, is there a way to make it so that the result only happens if variable1's value (10) is greater than the values of variables 2, 3, or 4?
Sorry if I'm not being clear, or if it has already been described. So far, I'm only able to see that it can check if the variable is a constant value. The traditional editor lets you compare only one variable's value to the variable in question, but not multiple.

Thanks, and sorry again if it is unclear, or goes against rules.
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
965
Reaction score
802
First Language
English
Primarily Uses
N/A
@w.alexander
No, no, not necroposting at all. It's a pretty quick add (currently writing it now), but I couldn't think of a better name than Check.vgreater(....). Any suggestions on what the function should be called?
 

w.alexander

Warper
Member
Joined
Sep 1, 2014
Messages
4
Reaction score
5
First Language
Spanish
Primarily Uses
RMMV
@w.alexander
No, no, not necroposting at all. It's a pretty quick add (currently writing it now), but I couldn't think of a better name than Check.vgreater(....). Any suggestions on what the function should be called?
I think Check.vgreater(....) is good. I'm no coder at all, but as long as it allows to compare one variable to multiple other ones at the same time (rather than doing it 1 by 1 or only by a constant value). I figured out a way to do it with default editor, but it is pain and makes wall of text. Thanks for the response. I'll look forward to seeing the new function added. :)
 

w.alexander

Warper
Member
Joined
Sep 1, 2014
Messages
4
Reaction score
5
First Language
Spanish
Primarily Uses
RMMV

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
965
Reaction score
802
First Language
English
Primarily Uses
N/A
@w.alexander Aww, you're welcome! That's very kind of you, there's no need for it at all but I really do appreciate the gesture c:

I don't have a ******* (yet...), but if you like, you can send donations via my PayPal. I usually don't make the link super public (because identity scraping bots are a force to be reckoned with) but I've sent the link to you privately in PM if you decide you really wanna send something my way ;p
 

CalebW

Veteran
Veteran
Joined
Feb 16, 2019
Messages
147
Reaction score
58
First Language
English
Primarily Uses
RMMV
Awe yea this is perfect for a crafting system I was making. I originally did it through the player loses x items and gains x skill. problem is I think that can put the player into the negative. So this should be a more efficient way to run the check.
 

AndromedaFr

Warper
Member
Joined
Mar 8, 2018
Messages
3
Reaction score
0
First Language
Dutch
Primarily Uses
RMMV
Hi, thanks for this plugin! I've tried to replace the more convoluted coding I did, but I must have made a mistake.

Can 'Check.in_range' be used to see if one variable is between two values/numbers? If not, how would I handle that? Do I simply have to create another variable and set it to change both variables at the same time?
(I tried using 'Check.any_inrange' with the variable I need and an extra one set to a number that would never be between the values checked, but I had the same result, the event didn't function.)

If this normally works I made a mistake somewhere else (unrelated to your script), so I haven't posted the rest of the 'code' yet. This is probably it, but I thought I'd check.
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
965
Reaction score
802
First Language
English
Primarily Uses
N/A
@AndromedaFr
Does combining Check.greater and Check.lesser work for you? Ex. Check.greater(1, 5) && Check.lesser(1, 10) to check if 5 <= variable 1 <= 10.
Otherwise, I'll investigate to see if this is an issue as soon as I'm free.

(edit: also, make sure you're getting this from github and not dropbox! dropbox may be a little outdated.)
 

AndromedaFr

Warper
Member
Joined
Mar 8, 2018
Messages
3
Reaction score
0
First Language
Dutch
Primarily Uses
RMMV
@AndromedaFr
Does combining Check.greater and Check.lesser work for you? Ex. Check.greater(1, 5) && Check.lesser(1, 10) to check if 5 <= variable 1 <= 10.
Otherwise, I'll investigate to see if this is an issue as soon as I'm free.

(edit: also, make sure you're getting this from github and not dropbox! dropbox may be a little outdated.)
Sorry, it took a while, but I've finally gotten the chance to correct things! Everything is in working order. And it's so much easier to deal with this without all the nesting. Your plugin is brilliant! I can't thank you enough!
 
Joined
Mar 23, 2019
Messages
40
Reaction score
22
First Language
English
Primarily Uses
RMMV
@mjshi Hey, would it be possible to mod this plugin to check other inconvenient-to-get hidden variables like player direction and x or y coordinates?


EDIT: I have experience programming, but not with javascript, and was thinking of taking a stab at doing a mod, but I figured you might have some insight as to whether that's worth doing in the first place, or if I'd just be barking up the wrong tree...
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
965
Reaction score
802
First Language
English
Primarily Uses
N/A
@Benevolentwanderer Sure, go ahead if you'd like! Feel free to contribute, or submit pull requests to GitHub.
Those shouldn't be too hard to add, I just don't have the time at the moment to add them.
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
567
Reaction score
196
First Language
English
Primarily Uses
RMMV
Hey, quick question. Would you be able to take a look at the conditional branch script I'm trying to get working, and let me know what I'm doing wrong?

I'm trying to check if any of variable 486-490 are equal to 0 or 1 (although, if there's a way to just check if any of them are equal to 0 instead, please let me know!).

Check.any_inrange(486, 487, 488, 489, 490, 0, 1)
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
965
Reaction score
802
First Language
English
Primarily Uses
N/A
Hey, quick question. Would you be able to take a look at the conditional branch script I'm trying to get working, and let me know what I'm doing wrong?

I'm trying to check if any of variable 486-490 are equal to 0 or 1 (although, if there's a way to just check if any of them are equal to 0 instead, please let me know!).

Check.any_inrange(486, 487, 488, 489, 490, 0, 1)
That looks right, you can just do Check.any_inrange(486, 487, 488, 489, 490, 0, 0) instead though if you just want to check for 0!
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
567
Reaction score
196
First Language
English
Primarily Uses
RMMV
Thanks for the quick reply! :kaoblush:

Hmm, maybe I'm just a bit confused. I used the script you listed, but it ended up doing the opposite of what I was expecting. Instead of returning true is any of those variables is equal to 0, it instead returns true if any of those variables is not 0.
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
567
Reaction score
196
First Language
English
Primarily Uses
RMMV
Thank you, using the new Check.any_is seems to be work great!
 

EAP

Villager
Member
Joined
Jan 29, 2019
Messages
7
Reaction score
0
First Language
English
Primarily Uses
RMMV
Question.
Check.has_more(~*items, number)
-- EX: Check.has_more(1, 2, 3, 4, 5)
** the last number in this is # of items you want the system to look to see if player has?
 

mjshi

Jack of Most Trades
Veteran
Joined
Feb 16, 2013
Messages
965
Reaction score
802
First Language
English
Primarily Uses
N/A
Question.
Check.has_more(~*items, number)
-- EX: Check.has_more(1, 2, 3, 4, 5)
** the last number in this is # of items you want the system to look to see if player has?
Yep! So in that example you'd want to see if the player has more than 5 of items 1, 2, 3, and 4.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

A beloved family member passed away due to complication to combat COVID and diabetes. Rest in peace Grandma.
Just got FES pack for my MZ. The details of the tilesets and chars seem not very compatible with MZ rtp. Look like they are scaled up. Not saying it's bad, but just won't fit well.
I've been busy with other things lately but I'm getting back into working on stuff for my game next month. I think I'm going to fiddle with making NPC busts next, mixing and matching stuff from DLC I've purchased.
Just finished composing a boss battle theme!

Forum statistics

Threads
105,567
Messages
1,014,687
Members
137,239
Latest member
roeselerfinnole
Top