Is there an easy/short way to write the exact same event for multiple values of a variable, without having to write it for each values separately?
Basically, I want to use the same call when the variable = 1,3,5,etc, and a different call when it = 2,4,6,etc.
it depends on what exactly you want to do - and you didn't give any info on that.
It would help a lot if you describe what you want to do (ingame terms) instead of how you want to do it (programming method).
That said, you might try to search for a set of scripts called the "self-data suite", because self-variables might help you here.
It doesn't have any visible impact ingame. It's just a skeleton to implement future events related to those values. But that variable is interlinked with two other variables and switches, and it requires different calls for different values. For some values, though, the call is identical. Rather than writing these calls one by one for each values, I was wondering if there was a way to shorten it.
i.e:
if var = 1,3,5 do this, else if var = 2, 4 do that, else if var = 6,7 do that
rather than
if var = 1 do this, if var = 2 do that, if var = 3 do that, etc.
In other words. Is there a way to do a conditionnal that does something like this: @>Conditionnal branch: Variable [000N:Name] == [1,3,5]?
Use "or" in JS is "|| "for this. In your own example:
@>Conditionnal branch: Variable [000N:Name]==1|| Variable [000N:Name]==3|| Variable [000N:Name] == 5|| etc...
How would I input that, then? I tried writing that in the script box on the Conditional pop-up but ended up with a Syntax error unexpected ':' expected ']'.
[1,3,5].include?($game_variables[n])
Use this in a conditional branch. (Script entry)
Thank you very much! This makes everything much easier.