Join Commands: *if and *selectable_if and *allow_reuse

Neat. I was looking up a problem I was having and found my own thread. :slight_smile:

Here’s my trouble. Combining the *if with *hide_reuse or *allow_reuse works just fine:


*choice
     *if (whatever=1)
          *allow_reuse #Pick this option
               Blah blah

But, *selectable_if doesn’t. This gives an error:


*choice
     *selectable_if (whatever=1)
          *allow_reuse #Pick this option
               Blah blah

Is this true, that *selectable_if doesn’t work with *hide_reuse or *allow_reuse?

I generalized this from memory. If this isn’t the case, let me know and I’ll dig up the exact sequence that didn’t work.

Thanks!

Have you tried putting the *allow_reuse first?


*choice
  *allow_reuse
    *selectable_if (whatever=1) #Pick this option
      Blah, blah...

That would make sense to me, but I haven’t tried it.

I tried it, doesn’t work.



*choice
	*selectable_if (variable>4)
		*allow_reuse #This work?
			Hope so.
			*goto Start

This gives me a:
Error: line 58: Couldn’t parse the line after *selectable_if: {variable>4)


This also gives the same error:


*choice
     *allow_reuse
	     *selectable_if (variable>4) #This work?
		     Hope so.
		     *goto Start


And yet, this works:


*choice
	*if (charm>4)
		*allow_reuse #This work?
			Hope so.
			*goto Start


But this way doesn’t, giving Error: line 58: Expected option starting with #


*choice
	*allow_reuse
		*if (variable>4) #This work?
			Hope so.
			*goto Start

I’m fairly sure selectable_if will only work inline, so you’d want something like this:


*choice
  #Option 1
  *allow_reuse *selectable_if (condition) #Option 2

I’m pretty sure that (or the other way around) works, but can’t check it right at now as I’m on my phone.

1 Like

Wow, I wouldn’t have expected that. This one works on the quicktest. Thanks!


*choice
	*allow_reuse *selectable_if (charm>4) #This work?
		Hope so.
		*goto Start

@Lucid
Awesome, glad to hear it.
Memo to self: Make a note of this on the wiki :stuck_out_tongue:

I wonder why this wouldn’t follow the same style as all the others, using its own indent? Seems like a needlessly confusing quirk.

I also wonder why the order matters for all of these indentable commands? (Although I suspect that it’s just easier to code it that way)

Either way, I’m happy. I can do what I want now. :slight_smile:

I actually always tend to use commands like *if, *allow_reuse and the like inline, I personally think it’s confusing/untidy to add extra (unnecessary?) levels of indentation - but it’s all just a matter of personal preference.

I think the reason *selectable_if only works inline is because that you can only ever use that command on a *choice option (whereas even allow_reuse and hide_reuse can be used standalone), and this makes it harder to use it in the wrong context? I couldn’t say for certain though.

Yes, inline makes sense, since it all works at once giving one block of result.

It happened again! :slight_smile:

Aug 2012 was when I had this problem the first time, and wow, I was making some simple errors back then. It happened again in June 2014, although a lot more complicated. And now, 8 years since the first time, I ran into the problem yet again… and again, I found my own thread!

I edited the first post so when I need to fix this problem again in 2025, I won’t have to read through all of these responses. :smiley:

This is the correct order, in case you’re curious:

*if (this_thing)
	*allow_reuse *selectable_if (that_thing) #Choose something.
		The choice occurs.
		*goto the_next_part