"Selectable_if" invalid command


#1

I’ve been trying to create a series of questions to ask someone in my game and I’ve been in a huge wrestling match against ChoiceScript to get it right. Now it’s telling me that “selectable_if” isn’t a valid command.

May I get some help?

I’m unsure of how to write so that indentation shows up, so I’ll use this: [] to indicate a tab.

*choice
[]*disable_reuse #“What do you mean Danger?”
[]*if questionasked = false
[][]*set questionasked true
[][]*set question +1
[][][]Kiara bites her lip. “I can’t explain. All I can say is you’re in danger. I will do my best to protect you so you don’t…” She stops. When you press her for more, she refuses to tell you. You decide to leave it alone and ask another question.
[][][]*goto questions
[]*disable_reuse #“What is this place?”
[]*if questionasked = false
[][]*set questionasked true
[][]*set question +1
[][][]“It’s called the Red Candle Mansion. The owner, you’ve had the pleasure of meeting. Her children…I only hope you don’t.” Kiara looks to the floor before smiling at you once again.
[][][]*goto questions
[]*disable_reuse #“Who are you really?”
[]*if questionasked = false
[][]*set questionasked true
[][]*set question +1
[][][]Kiara grins. “I’m Kiara, of course, just as I told you.” You get the impression she’s avoiding your question, but she won’t let you press for more no matter how hard you try. The best you get out of her is finding out her favourite food is beef noodles.
[][][]*goto questions
[]*selectable_if(questionasked= true) # I have no more questions for Kiara.
[][]*goto explore


#2

Well it could be that the var is not really there? or forgotten to type them.

*temp status false

*label stat
*set status true
Stats?! Why?
*choice
	*selectable_if (status) #Skill

#3

Did you spell *selectable_if correctly in your code? That’s the most likely cause of not being read as a valid command.

Failing that, check to make sure the conditional part of the command is in the correct format:


#4

Well “*selectable_if(questionasked= true) # I have no more questions for Kiara.”
I think should have a space before the var. “*selectable_if (questionasked= true) # I have no more questions for Kiara.”

The “[][]*goto explore”
should be below the *choice.


#5

@Vendetta It is written correctly (I checked at least 20 times, and even copy-pasted it from the wikipage at one point) and I checked every conceivable way to correct my code; it doesn’t want to correct.

@Aera The variable is there; I left it out of the thing since it was at the top of the document. Also, I’ve edited the ting so it reads:

*selectable_if (questionasked = true) # I have no more questions for Kiara.
Although I’m not sure I follow you; I thought *goto explore was already below the choice?


#6

Yes, the spaces are the problem. You should have the space between “*selectable_if” and “(” and shouldn’t have a space between “#” and “I”.


#7

@DSeg I did both of those but it didn’t seem to help. It’s something to do with the command itself, methinks. Changing it to an *if command didn’t do anything to help.


#8

Also, put a space between “questionasked” and “=”.


#9

Well @DSeg is right its a space problem.

Sorry @Aquos_Boost erm try it on IDE it will tell you the space problems faster and posting code type this without the space and your code in the middle. < p r e > < / p r e >


#10

I’ve tried just about everything and nothing’s working; It’s bad to blame the program but in this case, I think it’s appropriate; selectable_if is written properly according to both the tutorial and the wiki.

Then again, it is 9:30pm where I live and my brain could be dead.

IDE says it’s valid, so I have no idea why it’s not correct for ChoiceScript when they’re essentially the same program sort-of. My coding in the file looks like this:

*label questions
Next, you ask...
*choice
	*disable_reuse #"What do you mean Danger?"
	*if questionasked = false
		*set questionasked true
		*set question +1
			Kiara bites her lip. "I can't explain. All I can say is you're in danger. I will do my best to protect you so you don't..." She stops. When you press her for more, she refuses to tell you. You decide to leave it alone and ask another question. 
			*goto questions
	*disable_reuse #"What is this place?"
	*if questionasked = false
		*set questionasked true
		*set question +1
			"It's called the Red Candle Mansion. The owner, you've had the [i]pleasure[/i] of meeting. Her children...I only hope you don't." Kiara looks to the floor before smiling at you once again.
			*goto questions
	*disable_reuse #"Who are you really?"
	*if questionasked = false
		*set questionasked true
		*set question +1
			Kiara grins. "I'm Kiara, of course, just as I told you." You get the impression she's avoiding your question, but she won't let you press for more no matter how hard you try. The best you get out of her is finding out her favourite food is beef noodles.
			*goto questions
	*selectable_if (questionasked = true) #I have no more questions for Kiara.
		*goto explore

#11

:stuck_out_tongue: its 10pm i think @Aquos_Boost hahaha rest for now :smiley:


#12

I shall rest… for now >:)


#13

You should quit( = true) and write

 *selectable_if (questionasked) #

#14

@Aquos_Boost It looks like your problem may be more to do with incorrect indentation than *selectable_if itself. That whole *choice statement should look more like this (when word-wrap toggled on, which I’ve done here to show proper indentation levels):


*label questions
Next, you ask...
*choice
    *disable_reuse #"What do you mean Danger?"
        *if questionasked = false
            *set questionasked true
            *set question +1
        Kiara bites her lip. "I can't explain. All I can say is you're in danger. I will do my best
        to protect you so you don't..." She stops. When you press her for more, she refuses
        to tell you. You decide to leave it alone and ask another question. 
        *goto questions
    *disable_reuse #"What is this place?"
        *if questionasked = false
            *set questionasked true
            *set question +1
        "It's called the Red Candle Mansion. The owner, you've had the [i]pleasure[/i] of
        meeting. Her children...I only hope you don't." Kiara looks to the floor before
        smiling at you once again.
        *goto questions
    *disable_reuse #"Who are you really?"
        *if questionasked = false
            *set questionasked true
            *set question +1
        Kiara grins. "I'm Kiara, of course, just as I told you." You get the impression she's
        avoiding your question, but she won't let you press for more no matter how hard
        you try. The best you get out of her is finding out her favourite food is beef
        noodles.
        *goto questions
    *selectable_if (questionasked) #I have no more questions for Kiara.
        *goto explore

Don’t copy-paste the above verbatim though, as I’ve used spaces for display purposes. Just edit your own file to suit.


#15

As @Vendetta said your indentation is all off, you want something (like) this:
http://tinyurl.com/qz3lzzk

I don’t think that’s working quite how you’d want it to, but the indentation is right.


#16

It worked; thank you so much @Vendetta @CJW, I probably wouldn’t have guessed it was an indent problem :smiley:


#17

@Aquos_Boost True enough. :slight_smile: That’s one of the reasons why it’s useful to post a substantial chunk of code when trying to resolve a tricky error - a fresh set of eyes often spot these things much easier.

The error messages system isn’t always perfect though; indentation is usually the real cause when the error message doesn’t seem to make sense - as in this case, and sometimes also being the real culprit behind the ‘Cannot fall out of a [choice/if/else] statement’ type of error.

There is a simple ‘Golden Rule’ to help get your indentation right:

And some of the basic techniques described in the first half of this article can also make things easier as your scripting hierarchy grows:

But the best thing to do, especially when still learning, is to use the IDE for your game scripting, as that has a cool “smart indentation” auto-indent feature which you can toggle on under “Settings”:

https://dl.dropboxusercontent.com/u/7840892/CJW/choicescript/tools/IDE/main.html#


#18

Thank you very much @Vendetta :slight_smile: I suppose it’s off to IDE for me :smiley: