Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Problems trying to have variables + changed path depending on history of reader (Harlowe+Twine 2)

Hi! I'm quite new to Twine, and have expectedly come across a few problems. I've searched the forums and wiki but can't find a solution to my problem. I'm trying to get variables and.. I think the reader's history to determine what links are available to them.

So far, my story has 5 parts. I want people to go from Part 1, to either Parts 2 & 3 (they go together) OR Part 4. Either choice should then take them to the other one which they haven't seen yet, but no matter their choice they should end up at Part 5. (For example, they can go from Pt 1 and choose Pt 2->Pt3->Pt4->Pt5, or choose to go from Pt 1 -> Pt 4 -> Pt 2 -> Pt3 -> Pt5.

If people choose to see Pt 4 before Pts 2&3, I don't want the link leading to Part 4 to show up at the end of Part 3.

I'm using Harlowe (I'm not sure which version, but it's Twine 2.0). I've tried a few different things, I'll list them below. I'm sorry if they're way off, I just started this morning.
(if: ((history:) contains "The Beginning, pt. 5")[[
What of the village?->The Girl, pt. 1]])(else:[[
It is still snowing->The Beginning, pt. 3]])

^^^ This lights up as if it's a proper command, but doesn't create any real links.
<<if visited "The Beginning, pt. 5"=true>>
What of the village?->The Girl, pt. 1
<<end if>>

^^^^ that's what I was doing first, because I found some examples on this forum of that. It seemed to show the links alright, but it showed them regardless of whether you had already visited them (which isn't what I wanted).

Any help is appreciated :)

Comments

  • To paraphrase Meghan Trainor it's "All About That Brace (Bracket)"

    You have parenthesis and square brackets in the wrong places, try something like the following:
    (if: (history:) contains "The Beginning, pt. 5")[
    	[[What of the village?->The Girl, pt. 1]]
    ]
    (else:)[
    	[[It is still snowing->The Beginning, pt. 3]]
    ]
    

    note:
    I have added extra line-breaks and indentation in the above so that you can see where a (if)/(else:) macro's associated hook starts and ends [square brackets], those line-breaks and indentation can be safely removed except in one special case.

    Currently having three sequential open square brackets cause a parsing error, to get around this you need to place a space character between the first open square bracket and the next two.
    broken: (if: $var is "value")[[[link text->target passage]]]
    works: (if: $var is "value")[ [[link text->target passage]]]
    
Sign In or Register to comment.