How to add boolean "or" operator in notetag strings?

evilsaigon

Villager
Member
Joined
Apr 27, 2014
Messages
29
Reaction score
8
First Language
English
Primarily Uses
Hi. I have complete zero knowledge in programming, and I always use events to get what I want. But now, I'm stuck at notetag strings. I'm using Yami's Skillshop plugin, link: http://yed.yami.moe/yed-skill-shop/

The plugin basically allows skills to be bought in a skill shop, and imposing requirements before you can purchase by adding script calls in the skill's notetag.

Problem is I have no idea how to set the requirement strings as "either or"... that means among the listed requirement strings, as long as one of them is fulfilled, the skill can be purchased. For example, this is what I have in my skill's notetag:

<Buy Custom Require>

$gameSwitches.value(17, true)

$gameSwitches.value(18, true)

$gameSwitches.value(19, true)

actor.level > 4

</Buy Custom Require>

In this notetag, game switch number 17 and 18 and 19 must be turned on, and the actor's level must be above 4. Then the skill can be purchased for that actor.

However, what I need is (as long as switch 17 OR 18 OR 19 is turned on) AND actor's level is above 4, skill can be purchased for actor.

How do I type this boolean "or" operation in the notetag? T_____T
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,669
First Language
German
Primarily Uses
RMMV
I've moved this thread to Plugin Support. Please be sure to post your threads in the correct forum next time. Thank you.
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
Looks like the notetag is evaluated as JS itself, so the easy way to do it would be to separate the condition by the OR syntax, ||. After briefly looking at the plugin, I would imagine that this should work:

<Buy Custom Require>$gameSwitches.value(17, true) || $gameSwitches.value(18, true) || $gameSwitches.value(19, true)actor.level > 4</Buy Custom Require>From what I can tell, the plugin splits notetags by new lines, so to make an OR condition, you have to have them on the same line, separated by OR ( || ).
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
Notetags are parsed and interpreted by the plugin, so there is no universal approach to add something. You should ask Yami directly, how to do this.
 

evilsaigon

Villager
Member
Joined
Apr 27, 2014
Messages
29
Reaction score
8
First Language
English
Primarily Uses
@Andar Ah sorry, my bad. Thanks for helping me move!

@Zalerinian Ah so it's the syntax || that functions as "or" condition. Yes it worked nicely, thanks!!
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,078
Reaction score
2,654
First Language
Greek
Primarily Uses
RMMZ
@Zalerinian Ah so it's the syntax || that functions as "or" condition. Yes it worked nicely, thanks!!
You didn't know? :D

&& stands for AND

|  |  stands for OR

!    stands for NOT

As for  XOR... just forget about it for now...

If you will ever need one, check stackoverflow :p
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
XOR would work like this:

Code:
!(expr1) != !(expr2)
 

evilsaigon

Villager
Member
Joined
Apr 27, 2014
Messages
29
Reaction score
8
First Language
English
Primarily Uses
@lavra I was thinking it should be a commonly used operator by rpg makers, and also I don't see any replies to recent commenters' questions since it's an older plugin, so I thought I'd try my luck here. xD 

@Dreadshadow Those booleans would be helpful for total noobs like me haha.

@lavra I tried your XOR expression (I believe google says it stands for exclusive OR)

<Buy Custom Require>

!($gameSwitches.value(17, true)) != !($gameSwitches.value(18, true))

</Buy Custom Require>

So it ends up when (switch 17 on AND switch 18 off) OR (switch 17 off AND switch 18 on), skill can be purchased.

I can't use for now since I have more than 2 expressions, and they are independent of each other. But interesting point! 
 

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

Latest Threads

Latest Posts

Latest Profile Posts

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
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top