Cool, heading in the right direction. Post it again please. And is it still the same error you mentioned previously?
Just a thought as well, if you’re deleting any lines from your actual script before posting it, I’d recommend not doing so. It’s hard to help if we can’t see the full picture.
*choice
*selectable_if (military_officer)
#MRE's and Canteen
*goto start
Try doing as I said above with it. and about the choices that use no *if or *selectable_if’s, put them on the same line with the *selectable_if’s and the *if’s, not on the same line with the choices; do this:
@Vendetta, Well, it works with the *if commands, and I never used the *selectable_if (mainly because of the errors encountered with it) so I don’t really know.
Anyways, why don’t you change the *selectable_ifs into *ifs, which would fix it? Just a suggestion…
Yep, you’re correct on that score–when used within a *choice statement the ordinary *if condition(s) should indeed be placed on their own line, followed on the next line (and indented again accordingly) by any ordinary #option, *hide_reuse or *selectable_if. This makes the *choice statement highly flexible, by allowing a variety of *if conditions to be pre-applied to any of the three types of options.
However, when *selectable_if is the only condition needed (as in this case), then it should simply be written as (and all on one line):
*selectable_if (military_officer) #MRE’s and Canteen
Concerning your last comment; it’s a fair question so I’ll answer in full for any future readers wondering the same thing!
He really doesn’t want to change his *selectable_ifs to ordinary *ifs in this case. Not only is it unnecessary to do so (he just needs to follow the example above), he has also chosen the correct option type for what he wants to achieve here, which is to “gray out” a *selectable option if the player does not qualify. By this means the player knows that when they play again and choose different options at an earlier stage, different options would then become available at this point (e.g. Military Officers get a canteen). He doesn’t want to hide the information in this case (which is what an ordinary *if would do) as it encourages replays to try those unselectable options.
To help explain what I meant in my previous post, I’ve knocked up the following example to demonstrate how the the different #options of a *choice statement should be laid out. Bear in mind that this is just a bit of nonsense as an example of the different things you can do, different ways you can use these elements together, and some things to bear in mind when doing so–such as the required indentation for each style, and where & when you need double parentheses, etc.
I’ve included the *temps so you can just copy & paste this into a current project and play around with it by changing the values, just to see what effect it has on the options displayed.
*temp shadowwalk
*set shadowwalk 30
*temp infravision
*set infravision 30
*temp lit_torch_held
*set lit_torch_held false
*temp agility
*set agility 50
*label throne_room
*choice
#Cross the throne room and exit through the doorway at the far side
*if shadowwalk > 20
You tip-toe across the throne room and head into a damp passageway.
*goto damp_passage
*else
You clumsily trip over the dragon's tail and promptly get eaten.
*ending
*if (shadowwalk > 30) and ((infravision > 30) or (lit_torch_held = true))
*hide_reuse #Search every nook and cranny of the throne room.
You search every nook and cranny . . . pointlessly.
*goto throne_room
*if (shadowwalk < 31) and ((infravision < 31) and (lit_torch_held = false))
#Search the throne room, avoiding the sleeping dragon.
You trip over the dragon's tail. She awakens and gobbles you up . . . Burp!
*ending
*selectable_if ((agility > 50) and (shadowwalk < 31)) #Leap for the balcony.
You reach the balcony, grab the treasure, and leave via an open window.
*goto castle_grounds
*if shadowwalk > 30
*selectable_if (agility < 50) #Quietly leap up to the crumbling balcony
You fail to reach the balcony but land softly, without awakening the dragon.
*goto throne_room
*hide_reuse #Dance a jig around the sleeping dragon . . . quietly!
You (somewhat pointlessly) dance a silent jig around the dragon. Zzzzzzz.
*goto throne_room
#Hack the head off the slumbering dragon.
Nice try . . . You succeed only in annoying her. Charred adventurer! Yummy!
*ending
*label damp_passage
Damp passageway blah blah blah
*ending
*label castle_grounds
Castle grounds blah blah blah
*ending
@Cristoph, I’ve tested your code, and it works just fine with the following edits:
all referenced variables are created and given initial values.
all *selectable_if’s and #SelectableOptions are placed on the same line.
millitary_officer is changed to military_officer
My version of firefox errors out with “Couldn’t parse the line after *selectable_if: (var_name)” where var name is something like “military_officer” whenever *selectable_if and #SelectableOptions are on separate lines. That’s the only serious issue I noticed.
Of course to really make it useful you’ll have to set item variables to true as @JimD has mentioned, and add some additional logic that will exit the loop once you equip 6 items. Currently it doesn’t end until the player selects “Done”.
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.
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.
This is the correct order, in case you’re curious:
Yes, that’s exactly right. When you have multiple conditions on options like this, CS requires the *if on its own line, the toggle flag first on the #option line, and the *selectable_if in the middle, immediately before the #option text.