Problems with Stats menu script

I am using the following script.


*choice
	*if (stat_page != 0) #Return to the main stat page.
		*set stat_page 0
		*gosub main_stat_page
	*if (stat_page != 1) #View Academic Progress.
		*set stat_page 1
		*gosub Academic_stat_page
	*if (stat_page != 2) #View relationship status.
		*set stat_page 2
		*gosub relationship_stat_page
	*if (stat_page != 3) #View Inventory.
		*set stat_page 3
		*gosub inventory_stat_page
	#Return to the game.
		*finish

I keep getting the error could not extract an extra token when I go to change to a different stat page. It claims the error is on a line with an *if (stat_page !=) and it only started happening because I changed the goto commands in the file to gosub commands so I could call specific stat charts from other scenes without having to copy paste. Anyone encountered this before?

Danke for fixing the indentation for the forum. It is indented properly in my script. :smiley:

1 Like

I don’t think it’s possible to use a gosub in the stats screen (It used to be impossible, at least)

Annoying. :frowning: I wanted to call it instead of making a whole other thing but that’s fine.

*goto_scene used to cause issues, but gosubs should be fine, I think. Certainly local gosubs.

2 Likes

It doesn’t seem to want to do it. So I have switched it all back to goto’s and made anoter file for grabbing easy charts. :smiley: Anyways, ChoiceScript is a fickle mistress…but at least she is a consistent one. :slight_smile:

Think about where you’re *returning to.

*choice
	*if (stat_page != 0) #Return to the main stat page.
		*set stat_page 0
		*gosub main_stat_page  <- Where's it going after this subroutine?
	*if (stat_page != 1) #View Academic Progress.
		*set stat_page 1
		*gosub Academic_stat_page

This is a small bug in that it should have a different error message, but the fact that there’s an error is correct. (I don’t know for certain, but I think quicktest would report the correct error, which is that your #options end abruptly with nowhere to go.)

1 Like

*if usually needs to be on its own line. So try:


*choice
	*if (stat_page != 0)
            #Return to the main stat page.
		*set stat_page 0
		*gosub main_stat_page
	*if (stat_page != 1) 
            #View Academic Progress.
		*set stat_page 1
		*gosub Academic_stat_page

etc.

Right…because then it returns to the middle of a choice with no extra instructions…