How to use AND, OR, and ELSE IF

I know how to use the if and else but not the AND, OR, and ELSE IF conditions.

Never used Squiffy, but in Quest here is a little explanation (can't be too different, right =):

If checks for a a specific condition and Else is essentially NOT that condition, but you know that.

The Else If are alternative options to the original condition.

Example. If the player tries to 'start fire' in a barrel and you have an If/Else If/Else in place, here is what might happen.

If barrel contains 'newpaper', then start fire.
Else If barrel contains 'gasoline', then start fire.
Else if barrel contains 'kindling', then start fire.
Else if... Else if... Else if...
Else, then "You cannot start a fire with nothing to burn."

The AND and OR conditions (in code view form):
if (moss2.parent = metal barrel and planks2.parent = metal barrel), {
msg ("You light the contents of the barrel on fire by using the match."
else if (moss1.parent = metal barrel and planks2.parent = metal barrel), {
msg ("That's a good idea, but that moss is just too wet to catch on fire.")
else if etceteras...
else {
msg ("That won't work.")

OR you could substitute other things that would work in place of moss2.

if (moss2.parent = metal barrel or kindling.parent = metal barrel and planks2.parent = metal barrel)
msg ("blah blah blah")

In GUI view, it is If object attribute object expression if (moss2.parent = metal barrel and planks2.parent = metal barrel) attribute parent metal barrel
then, ...

Hope it helps. Again, it is a conversion from Quest so not sure how it applies. EDIT: just open Squiffy out of curiosity and it looks nothing like Quest, so...

Best of Luck!

Squiffy mark up doesn't allow for anything more complex than if and else. If you need greater functionality you'll need to use Javascript.

If I'm understanding correctly, "AND" is possible through nesting. I do it all the time.
for example, [[start]]

@set minutes=10
Is it [time] to go [[home]] yet?

@inc minutes
The clock says we've been here for {minutes} minutes.

{if minutes>10:{if seen time:I guess we can go!}}

Thank you guys. I'm able to do it now.

it is just the most awesome SQUIFFY trick I've ever seen in this forum. Nesting allows a lot of great tricks.

do you think you could use "else" in the nested condition? I tried but it didn't work.

Hey, I got an idea to simulate the " OR " in Squiffy.
Let's say I have two variables: "Sword" and "Knife". You can have one of them, both or niether. Now what if I want some condition to run if you have either one or the other? Simple: you make a 3rd variable, let's say "weapon". It is set as true in the same section in which you set Sword and Knife. When you need to write the condition "have knife OR sword", you just ask, instead, if "weapon" is true.

"ELSE" is not very flexible. The way I get around it is to use ambiguous language. For example, when, I use <input type="text" id="blahblah">, for conversational NPCs, I'll have at the bottom, "Feel free to [try] a different topic." which the player sees regardless of the success or lack of the input.

This topic is now closed. Topics are closed after 60 days of inactivity.