Problem with *if, "Expected option starting with #"

Hello! This is my first post, I’ve recently started to learn ChoiceScript and I’m finding it really fun and interesting, but I just ran into my first big problem. As I said, I’m pretty new so this might be very simple but I just can’t figure out by myself what I’m doing wrong!

I’m trying to use *if to give different options in a choice for the player depending on the outcome of a previous choice using a boolean variable. It’s set as ‘create touch true’ in this particular startup file, so i can test it as I go along, but each time I try to test in firefox it it’s giving me an “Expected option starting with #” for the first line using an *if command. I’ve read every relevant wiki page a dozen times and loads of forum threads but I don’t see what’s wrong with my code and why it won’t accept it.

*choice
	#I don't know what I was thinking bringing this home. I throw it in the back of my closet and try to forget about it.
		*set ignore true
		This artifact, whatever it is, is clearly dangerous. You got caught up in the excitement of discovering something strange and 
		potentially life changing, but you don't want to risk it ruining your life. You take it and, still wrapped in the jacket that you're
		pretty certain you will never wear again, put it inside one of the boxes of random stuff from your childhood you still keep deep within 
		your closet. It'll be safe there and with a bit of luck you'll be able to just ignore it until you find the right time to get rid of it.
		*finish

	*if ( touch = true ) #I need to touch the artifact again. I know if I just keep trying, eventually I'll be able to understand the information 
	it's attempting to communicate and I am willing to suffer to achieve that understanding.
		You need to descipher whatever secrets the artifact might hold. This is so important to you that you barely
		think about the pain it'll cause you, because ignoring it would bring its own kind of pain that would stay with you 
		your entire life.  
		*finish

	*if not (touch)
		#I will run tests to find out more about the artifact. Proper science is the only answer to this. 
			This is an unparalleled and incredible opportunity for scientific discovery. You will attempt to research the artifact 
			properly and test it to find out as much about it as possible.
			*finish

I’ve tried to use ‘*if (touch) #Whatever’ too but changed it to see if that fixed it, without any luck. I’ve checked my indentation and changed it around SO much too. Please help me, I don’t know what to do anymore :confused:

Try moving “#I need to touch the artifact again” to the line below and indenting it, the same way you’ve formatted the “#I will run more tests option”. Does that help?

You can use *selectable_if or *hide_reuse in-line, but I think plain *if commands (which hide the option under the *if entirely if the stats aren’t right) have to be on their own line, and then the option needs to be one more indentation over, and on the next line.

1 Like

Thanks for your reply! But I just tried it and it still gives me the exact same error message. I’m using *if because I want to hide the option unless the player chose to do a certain thing in an earlier scene, yeah. The example on the wiki gives its own line to the *if not commands but not to the *if ones so that’s why I had it that way, but it doesn’t seem to make a difference even if I give it its own line.

That’s odd. Try taking the spaces out that are besides the parentheses and using *if (touch = true) maybe?

And just to make sure, you didn’t happen to copy paste from a word processor (or even an email or other pre-formatted text field) into a text document, did you? Sometimes that can have strange effects.

2 Likes

That’s how I tried it after changing it from *if (touch), I tried it again now just in case and still didn’t work, still same error message.

I wrote it directly into that .txt file, I didn’t copy paste it from anywhere else. And yeah it’s really strange because everything I keep reading is telling me it should work written this way, so I’ve got no idea why it isn’t!

I copy-pasted what you had into @CJW’s IDE and it worked fine for me. It is very odd . . . Are you using tabs or spaces?

2 Likes

That’s so weird, huh. And I’m using tabs.

Which line is the error giving?

When I copy and pasted the code into the IDE it actually flagged the indentation of

it's attempting to communicate and I am willing to suffer to achieve that understanding.

as the problem.

2 Likes

It’s giving an error for the first line using an *if command. I actually just tried to test it while setting the touch variable as false with ‘create touch false’ and that is working, but when I try to chose an option that will set that variable as true, it gives me an error saying ‘Expected an #option here, not *set’

I think @FairyGodfeather spotted it actually; that line has an enter instead of a space at the beginning.

@Arsit_Rouke: Try copy-pasting this and replacing what you currently have? I exchanged a space with an enter before the line “it’s attempting to communicate and I am willing to suffer”.

 *choice
	#I don't know what I was thinking bringing this home. I throw it in the back of my closet and try to forget about it.
		*set ignore true
		This artifact, whatever it is, is clearly dangerous. You got caught up in the excitement of discovering something strange and potentially life changing, but you don't want to risk it ruining your life. You take it and, still wrapped in the jacket that you're pretty certain you will never wear again, put it inside one of the boxes of random stuff from your childhood you still keep deep within your closet. It'll be safe there and with a bit of luck you'll be able to just ignore it until you find the right time to get rid of it.
		*finish
		*if (touch = true)
			#I need to touch the artifact again. I know if I just keep trying, eventually I'll be able to understand the information. It's attempting to communicate and I am willing to suffer to achieve that understanding.
				You need to descipher whatever secrets the artifact might hold. This is so important to you that you barely think about the pain it'll cause you, because ignoring it would bring its own kind of pain that would stay with you your entire life.
				*finish
		*if not (touch)
			#I will run tests to find out more about the artifact. Proper science is the only answer to this.
				This is an unparalleled and incredible opportunity for scientific discovery. You will attempt to research the artifact properly and test it to find out as much about it as possible.
				*finish
3 Likes

Oh thank goodness, that’s working! Thank you so much, this was so very helpful.

1 Like