Howdy, Stranger!

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

"Unexpected identifier" error?

Hi all!

I'm trying to build a conversation system where everything the player says has the potential to have a positive, negative or neutral outcome (it's a little more elaborate than that, but that's the gist of it), with a colour code to warn them of the risk.

First, I set it up so that every choice could show up as either green (positive), yellow (neutral) or red (negative), at random, using the (either:) command. It worked perfectly, with the three options named This, That and Else each having a random colour every time I started up the game.

But now I'm trying to link the colour of the choice to the result of choosing it, and I'm having some trouble.
I tried a few different things (always with the same error, "Unexpected identifier"), but my current plan is to try to use $1stcolour to keep track of which version of "This" the player clicked on and respond accordingly in the "Reply" passage (the other two will have their own variables like $2ndcolour and $3rdcolour when I can figure out how to make it work).

I phrased it like this:
(either:"(colour: red)[I say [[This->Reply]]] (set: $1stcolour to "red")","(colour: green)[I say [[This->Reply]]] (set: $1stcolour to "green")","(colour: yellow)[I say [[This->Reply]]] (set: $1stcolour to "yellow")")

(either:"(colour: red)[I say [[That->Reply]]]","(colour: green)[I say [[That->Reply]]]","(colour: yellow)[I say [[That->Reply]]]")

(either:"(colour: red)[I say [[Else->Reply]]]","(colour: green)[I say [[Else->Reply]]]","(colour: yellow)[I say [[Else->Reply]]]")

"That" and "Else" are showing up just fine when I play, but "This" just gives me an "Unexpected identifier" error. It seems to be because I'm trying to use (set:) inside of (either:)? Why is that? Is there another way I could accomplish what I want to do?

I'd really appreciate any help!

Comments

  • You'll need to give us the full version number of both Twine and the story format you're working with.
  • You need quotes to appear inside of quotes. To do that, switch between single and double quotes like this:
    (either:"(colour: red)[I say [[This->Reply]]] (set: $1stcolour to 'red')","(colour: green)[I say [[This->Reply]]] (set: $1stcolour to 'green')","(colour: yellow)[I say [[This->Reply]]] (set: $1stcolour to 'yellow')")
    
  • Chapel wrote: »
    You need quotes to appear inside of quotes. To do that, switch between single and double quotes like this:
    (either:"(colour: red)[I say [[This->Reply]]] (set: $1stcolour to 'red')","(colour: green)[I say [[This->Reply]]] (set: $1stcolour to 'green')","(colour: yellow)[I say [[This->Reply]]] (set: $1stcolour to 'yellow')")
    

    Ohh, that makes sense! And it finally works! Thank you so much!

    idling wrote: »
    You'll need to give us the full version number of both Twine and the story format you're working with.

    Yeah sorry, I forgot to specify the version and format when I created the post, and afterwards it was too late (it was stuck awaiting approval for a while)!

    For the record, in case it could be relevant to anyone else who finds this thread, I'm using version 2.1.3 with Harlowe 2.0.1.
Sign In or Register to comment.