I keep getting the same "couldn't extract another token", and I have no idea why

I keep getting the same error in randomtest, quickest, and by playing the game manually. It’s maddening because I’ve tried many different solutions in order to solve this, but nothing seems to work. I’ve implemented script like this in other parts of the game, and it’s been fine. Syntactically, I believe it should work, but apparently not. Hopefully, you folks have more insight than I do.

The error I’m getting is: RANDOMTEST FAILED: Error: six line 1454: Invalid expression, couldn’t extract another token: ?

Line 1454 is the section that reads “You find Doctor collapsed…”. No matter how I rearrange the code, or what new label or different indention I try, I always get the same error in the same place.

My code currently looks like this:

*label sixaptspwdoc

You find Doctor collapsed on a bench just outside in the hall. His lids barely flicker open at your approach. "You see it, don't you? The ruin and destruction of my body and being? It won't be long now." He wheezes.

*label docloyalornot
*if (loyalty >= 3)
	*goto docloyal
*else
	*goto docnotloyal

*label docloyal
"You've proven yourself every bit the special one I made you to be. All those years dreaming of immortality, and you were my greatest creation all along. I think... I can pass in peace. But you must promise me, ${name}." He reaches out. "Will you continue my work, ${name?} Please. You've seen my lab. The plans I had. The notes I wrote. Take them, and continue what I've started."
*choice
	# "Yes, of course."
		He smiles. "Remember, ${name}. Trust no one but yourself. When I die, you will be alone." He settles back into the chair and drifts back off into sleep.
				
		You don't quite understand what you've promised, but a heavy weight falls on your shoulders. Soon it will be your time to ascend to Doctor's place.
		*set heirending true
		*goto sixapthub
	# "No, I won't do that."
		Wearing a heavy frown, he turns his head away. "Bah! Kill it all! Kill me, kill everything I've worked for, everything I [i]am[/i]! Just let it all die. How can you do this to an old man?" He settles back into the chair and drifts back off into sleep.
					
		You know one thing. When Doctor dies, the status quo he's so meticulously constructed in the apartments will fall apart, and nothing will remain.
		*goto sixapthub
*goto sixapthub

The player reaches Line 1454 by through this choice

*label spendtimewsomeone
Whom do you spend time with?
*choice
	*hide_reuse *if ((docinmachine = false) and (docdead = false)) #Speak to Doctor.
		*set daylimit +1
		*goto sixaptspwdoc

Thanks everyone!

EDIT: I’ve managed to isolate the error. When I removed the *if ((docinmachine = false) and (docdead = false)) conditions on the choice, I no longer receive the error. Problem is, I need those conditions. If anyone has any idea how to include these in a way that’ll keep the code from exploding, I’d be thankful.

Do you have an escape option in the “whom do you spend time with” tree?

I’ve run into a similar error when I made a *choice with the potential to have every option unselectable. Which should display as a helpful “no selectable options” but if *hide_reuse is in play you can get that weird invalid expression error

edit: vvv

You got a little oopsie, there.
line 1462: ${name?}

2 Likes

I appreciate all you good people responding here! Thank you!

Anybody stumbling upon this thread, see my edit in the OP about how I’ve isolated the error, so that may help!

@SpokesWriter
I checked, and I do indeed have an escape option. Just for the sake of completion, it’s:

	#Never mind.
		*goto sixapthub

@Szaal
Woops indeed and fixed!

Looking at the code, did you get this error with following conditions are true?

  • loyalty >= 3
  • docinmachine = false
  • docdead = false

What if you format it as such?

*label spendtimewsomeone
Whom do you spend time with?
*choice
	*if ((docinmachine = false) and (docdead = false)) 
        *hide_reuse #Speak to Doctor.
		    *set daylimit +1
		    *goto sixaptspwdoc

if the error still continues, check if it’s jumpy. as in, in jumps back and forth between labels too often for CS to handle. While not looping, this can happen if you have things go back and forth between certain labels excessively

Try putting the *if statement first, then indenting the *hide_reuse #option below it.

*label spendtimewsomeone
Whom do you spend time with?
*choice
	*if not (docinmachine or docdead)
		*hide_reuse #Speak to Doctor.
			*set daylimit +1
			*goto sixaptspwdoc
1 Like