Question: Sections & Variables

Hello Folks!
So this is my first time using Squiffy and I have somewhat gotten the hang of it(no, not at all actually). I have most of the base code down and all of my story content written out and currently assembling! Pretty exciting stuff(in my own mind anyway)! However I have two main problems and I think they can both be solved with same set of code or similar.

Problem 1:
Lets say during Chapter 1 of the story you have the option of picking up an item. Fast forward to Chapter 6. Is it possible to make a two different passages based on if you picked up the item or not?
Passage 1: The wall seems to have a circular indent. You see nothing else of interest. (Go back)
Passage 2: The wall seems to have a circular indent. It looks a lot like..... You use the silver talisman and the wall slides open to reveal a hidden passage(Silver Talisman used)

That would pretty much solve all my problems honestly. It's the last piece of code I really need to pull the whole thing together. Currently I am using a master section([[]]:) and @set to make attributes and stuff. This last bit is super frustrating! Any help would greatly be appreciated.

Problem 2 kind of ties into problem 1.
I want to have certain passages/dialouge available if the MC has a good enough relationship with a certain NPC.
"Do you want to go on a adventure with me?"
Passage 1: "Sure, we totally smashed those goblins last time."
Passage 2: "Sorry, I don't really know you well enough for that."(Reputation too low)

Does that make sense? I hope it does and I really hope someone can help me out. Much appreciated! If their is a thread like this already, sorry! Please link it to me. Thanks!

One way to work this is the "seen" function - this will let you react if you've seen a location. If you actually go into a special section depending on the path, you can query if you've been there before. From the docs...

You can see a [cupboard]. Maybe you should [open] it?

You open the cupboard.

The cupboard is {if seen open:open, and there are empty bottles inside}{else:closed}.

i.e. all you need to ask if {if seen sectionName and that should do it.

Otherwise, if you are just toggling something inside a single section (say, if a=1 you win a fight, a=2 you lose) then you can set flags to know what happened...

{if a=1: You kill the monster! {@set killFlag}}
{else: You missed the monster! {@set not killFlag}}

Then, later, you can check your flag to determine what you do.

The peasant looks at you.
{if killFlag: "I understand you killed a monster."}
{else: "I understand you are a pansy."}

Hope this helps.

That actually clears things up quite a bit! I knew I just wasn't fully understanding how the variables thing worked. I am going to toy with it and see what I can do with it. I'm sure this question has already been answered so thank you for taking the time to explain it out.

The only other question I have. Is can I trigger a passage if a @set amount is above a certain number or is it limited to only true/false variables?

Once again, thank you!

Here's an example of weird Squiffy performance. Okay, to answer your question, here's how you could check against an integer (with ranges) rather than a boolean.

@set kills=5

{if kills=1: You are not much of a hero.}
{if kills>1: {if kills<5:You are a pretty good hero.}}

{if kills>=5: I want to have your baby!}

You can test this by changing the kills value above. But notice the blank line before the third test. For some inexplicable reason, Squiffy would snarl the second and third test together (and would not print the kills>=5, no matter how I worked it. By adding the blank line, it broke whatever logic bug existed between the second and third test.

This is just one of those weird Squiffy things. Should have worked without the blank line. If anyone can explain why this dosn't work, I'd like to hear it.

Huh, that does seem kind of word and I can confirm if you don't have the blank line it does make things go wonky. So far everything seems to be working out great! Thank you so much, I was having such a hard time wrapping my brain around this. Really pulls the last bits of my story together.

Thanks so much for the explanation and help! Super appreciate it and will drop a link when I finish everything up.

Love to see what you have. I've been dinking with Squiffy for a year or so now. If you want to see what you can do with it, check out my own game @ "StoreyMinus", in the game area.

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