Is it possible to have at least seven vars?


#1

I tried searching and can’t seem to find a discussion on how to add more vars. Sorry if this is already answered.

I’ve been trying to make seven conditions, but I can’t seem to make it work.
*if (((((var1) or (var2)) or (var3))) or ((var4) or (var5)))) or ((var6) or (var7)))))

It’s wrong, I know so I need a little help please and thank you.


#2

You can have as many as you want as far as I can tell. I’ve had 26 on one line working fine. It does however, need to be set out like this:

*if (((((((var1) or (var2)) or (var3)) or (var4)) or (var5)) or (var6)) or (var7))

#3

Try this: (((((((((1) or (2))) or (3)) or (4)) or (5)) or (6)) or (7)))

I find having a text editor like Notepad++ helps keep track of the brackets, although my example may be wrong, given it’s different to BlazedStorm’s.


#4

Lols, I could only make until five so it made me wonder if I could make the conditions longer.

Thanks @BlazedStorm

Quick question. If I changed it to an “and” condition will this work?

*if (((((((var1) and (var2)) and (var3)) and (var4)) and (var5)) and (var6)) and (var7))

Or I need to change the setting of vars?

Sadly I can’t use the notepad ++ since I’m using a phone to code. @Saracenar Still thanks for the suggestion will try that.


#5

Ands and ors work interchangeably, yes. But of course the hands mean that everything has to be true. You can have a combination as well.


#6

Thanks @Saracenar


#7

@BlazedStorm 26 conditions at once!? Oh wow. At that point it would probably be easier to set individual *ifs one after another in a list instead.

Y’know this is something that gives me trouble as well from time to time, and I’ve yet to find a hard rule on how it should be constructed, past three conditions. I’ve heard that it ought to be in sets of twos, but in your example only the first two is a pair, while the rest seems to just be tacked on there.

Obviously it seems to be several right ways to doing this, I usually go with pairs of twos beyond the three, so *if (((var1) and (var2)) and ((var3) and (var4))), and that works as well, but your method certainly seems simpler.

The real trouble comes when you’re mixing or and and. Like for instance;

*if (((hamburger) and (pickles)) or ((hotdog) and (pickles)). There have been times when I have wondered, do I need to specify this var again or is there some way I could set the ‘and’ to apply for both? For instance, *if (((hamburger) or (hotdog)) and (pickles)), in this case, it would appear as if either hamburger needs to be true, or hotdog and pickles, but pickles doesn’t matter for the burger. I’ve been meaning to experiment with this, but I haven’t gotten around to it. Would be interesting to hear more about how others handle this.


#8

You’re right @MutonElite It would be interesting know how other people code conditions if it gets longer.

Many thanks for the help.


#9

@MutonElite, your pickles example will work – you got the logic exactly right.

I gave a couple examples on this thread: https://www.choiceofgames.com/forum/discussion/comment/128749#Comment_128749


#10

@MutonElite I do, nearly 1000 lines, and then each if has around 15 vars, and every now and then there are some with 26. Its part of my ‘create your very own playable species hybrid’, resulting into over 350 different playable species that I gave up with separately coding at every specific choice xD


#11

@BlazedStorm That’s some ambition there! But it also sounds undoable, maybe if the species’ features were just cosmetic it could be done, but otherwise… Like wow, does your creature have a tail, do this? Does it have arms, do that? Does it have arms AND a tail, do this! Recreating Spore in text form. :stuck_out_tongue:

@Havenstone Ah yeah, I remember seeing that thread before. Thanks for linking!