Howdy, Stranger!

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

I keep getting unexpected indentifier and cant tell why

(link: "Switch your (if: $RiderChoise is "Gaim")[lockseed](else:)[form].")[
(link: "$form1")[(set: $Weapon to $form1Weapon)(set: $currentdamage to $form1damage)]
(link: "$form2")[(set: $Weapon to $form2Weapon)(set: $currentdamage to $form2damage)]
(link: "$form3")[(set: $Weapon to $form3Weapon)(set: $currentdamage to $form3damage)]
(link: "$form4")[(set: $Weapon to $form4Weapon)(set: $currentdamage to $form4damage)]
(link: "$form5")[(set: $Weapon to $form5Weapon)(set: $currentdamage to $form5damage)]
]
i keep getting unexpected identifier on the above and i cant tell why
more specifically on
(link: "Switch your (if: $RiderChoise is "Gaim")[lockseed](else:)[form].")

Comments

  • The reason you are getting that error is because you are embedding one set of double quotes within another.

    The first parameter of the (link:) macro meant to be a String value, and in TwineScript (and Javascript) a Sting value is delimited with either double or single quotes:
    (set: $varA to "this is a String value delimited using double quotes")
    (set: $varB to 'this is a String value delimited using single quotes')
    

    Knowing this if you look at the first line of your example the parameter you are giving the (link:) macro is made up of two strings with the word Gaim between them:
    string 1: "Switch your (if: $RiderChoise is "
    string 2: ")[lockseed](else:)[form]."
    

    There are two basic ways to fix your problem:

    1. Escape the two internal double quotes using a backslash:
    (link: "Switch your (if: $RiderChoise is \"Gaim\")[lockseed](else:)[form].")[
    ....
    ]
    

    2. Replace the two internal double quotes with single quotes:
    (link: "Switch your (if: $RiderChoise is 'Gaim')[lockseed](else:)[form].")[
    ....
    ]
    
Sign In or Register to comment.