Couldn't extract another token: ChoiceScript IDE vs Firefox

Something really strange is happening. When I use ChoiceScript IDE my game passes the randomtest… but when I open the file in firefox, it does not.

I keep getting couldn’t extract another token, for example “2_Baptism_of_Fire line 1071: Invalid expression, couldn’t extract another token: #Maybe fun to continue to pretend to be a hero for the time being.”

The error is solved if I change from a fake_choice to a normal choice, and then place *goto at the end of every choice… but, this puzzles me slightly…

Any ideas?

*fake_choice

*if (superhero_choice != “supervillain”) #My duty as a superhero is far more important than my daily job.
*set vigilante %-5
You feel that your duty to society as a superhero is far more important than your daily job.

*if (superhero_choice != “supervillain”) #Whoever is robbing this bank is no match for me. I’ll sort it out in no time and return to work quickly.
*set arrogant %+10
Your powers and abilities really set you aside from others,
and you are confident you’ll quickly manage to dispatch whoever is foolish enough to be robbing this bank.

*if (superhero_choice != “supervillain”) #My job is really important, just as is my life as ${superhero_name}. In another circumstance I might have let it go, but I’m worried about Captain Villardi’s tone. Maybe she really needs help this time.
*set kind %+10
You are worried by Captain Villardi’s tone, and it could be that whoever is robbing this bank might be too much for the police to handle.

*if (superhero_choice != “supervillain”) #This is beneath my powers, but far better than spending a day at the office.
*set vigilante %+10
*set arrogant %+20
Such a situation is beneath you, though it is far better than spending the rest of the day at the office.

*if (superhero_choice = “supervillain”) #I couldn’t care less about the bank robbery, but I’m in the mood for a fight!"
*set aggressive %+20
*set vigilante %-20
The idea of getting into a fight completely thrills you. Clearly, it is much better than spending the rest of the day at the office.

*if (superhero_choice = “supervillain”) #Maybe fun to continue to pretend to be a hero for the time being.
*set charismatic %+10
*set aggressive %-10
*set kind %+10
*set vigilante %-30
It might be fun to continue to pretend to be a hero for the time being, while you wait for an opportunity to make your move.

For starter, you can preformat your comment with triple grave accent ```. Put them at the top and bottom of your snippet.


As for your problem, I’m not sure what is the cause (since I can’t see the code properly, duh). FYI, *fake_choice can’t be nested within each other.

Sorry, here it goes (I’m not nesting fake_choices, btw).

*fake_choice

   *if (superhero_choice != "supervillain") #My duty as a superhero is far more important than my daily job.
      *set vigilante %-5
      You feel that your duty to society as a superhero is far more important than your daily job. 
      
   *if (superhero_choice != "supervillain") #Whoever is robbing this bank is no match for me. I'll sort it out in no time and return to work quickly.
      *set arrogant %+10
      Your powers and abilities really set you aside from others, 
      and you are confident you'll quickly manage to dispatch whoever is foolish enough to be robbing this bank. 
        
   *if (superhero_choice != "supervillain") #My job is really important, just as is my life as ${superhero_name}. In another circumstance I might have let it go, but I'm worried about Captain Villardi's tone. Maybe she really needs help this time.
      *set kind %+10
      You are worried by Captain Villardi's tone, and it could be that whoever is robbing this bank might be too much for the police to handle. 

   *if (superhero_choice != "supervillain") #This is beneath my powers, but far better than spending a day at the office. 
      *set vigilante %+10
      *set arrogant %+20
      Such a situation is beneath you, though it is far better than spending the rest of the day at the office. 

   *if (superhero_choice = "supervillain") #I couldn't care less about the bank robbery, but I'm in the mood for a fight!" 
      *set aggressive %+20
      *set vigilante %-20
      The idea of getting into a fight completely thrills you. Clearly, it is much better than spending the rest of the day at the office.
            
   *if (superhero_choice = "supervillain") #Maybe fun to continue to pretend to be a hero for the time being. 
      *set charismatic %+10
      *set aggressive %-10
      *set kind %+10
      *set vigilante %-30
      It might be fun to continue to pretend to be a hero for the time being, while you wait for an opportunity to make your move. 
            
   *if (superhero_choice = "supervillain") #Being in the office is just so boring. Better to go and have a look. 
       You hate being in the office, so going to have a look is far better than continue to sit in your chair. 
       *set vigilante %-10

        
   *if (superhero_choice = "supervillain") #Maybe I can steal something myself, while this villain is robbing the bank. 
       This might be an opportunity to steal something from the bank, while this villain is robbing it. 
       *set vigilante %+20
       
   *if (superhero_choice = "supervillain") #This could be a great opportunity to meet a fellow villain and join forces.  
       This could represent a great opportunity to meet a fellow villain, and potentially join forces. 
       *set charismatic %+20

Are you intending to use selectable if?

It’s weird that #Maybe fun got highlighted as having the error, while the option right above it doesn’t.

BTW, you can format your choice structure so

*fake_choice
   *if supervillain
      #a
      #b
      #c
   *else
      #d
      #e
      #f

See if that works.


Alternatively you can include

*create implicit_control_flow true

around your variable declaration. Everything else shouldn’t need to be changed.

2 Likes

Sometimes I had this error when having an if condition checking a string variable. You could try to make the portion after the contidion (the one starting with the choice text #) in the next line, indented.

Like:

   *if (superhero_choice = "supervillain")
      #Maybe fun to continue to pretend to be a hero for the time being. 
         *set charismatic %+10
         *set aggressive %-10
         *set kind %+10
         *set vigilante %-30
         It might be fun to continue to pretend to be a hero for the time being, while you wait for an opportunity to make your move. 
1 Like

In my various code tests, it’s been my experience that ChoiceScript likes to have *selectable_if on the same line as the #option, the way you currently have *if statements. However, it’s also been my experience that CS prefers the #option indented on the line below an *if, as @GoldenSilver suggested. So it seems happiest with something like this:

*fake_choice
   *if (variable)
      #option
   *selectable_if (variable) #option

If you made me guess, I’d say the reason for the desired indent is to enable what @Szaal suggested: Putting multiple #options under a single *if statement.

1 Like