FANDOM


    The *selectable_if command is intended specifically for use within the #options body of a *choice statement. It serves no other purpose whatsoever -- unlike the ordinary *if command, which also has many other uses. The difference between the two when applied to a particular *choice #option is, however, very significant.

Applying an ordinary *if condition to an #option has the effect of completely removing that #option from display if the condition is not met, so the player never even sees it. However, *selectable_if merely disables ("grays out") that particular #option; i.e. it will always be displayed but cannot actually be selected if the stated condition has not been met. This is an important distinction.

Use

*selectable_if is typically used as follows:

What do you want to do?

*choice

  *selectable_if (muscular) #Lift some weights.

    You pump iron to stay in shape.

    *finish

  #Go jogging.

    You go jogging to stay in shape.

    *finish

In the above example, the "Go jogging" #option will always be selectable by the player, being an ordinary (i.e. non-conditional) option, while the "Lift some weights" #option will be displayed but not actually be selectable if that specific condition is not met. In this case it is using a boolean variable (true / false data type) which must previously have been *set to true for this condition to be met and that #option to actually be made selectable.

Note that any of the three data types (numeric, string or boolean) can be used in a *selectable_if condition, but the condition itself must always be placed within parentheses (brackets) as shown in the example above, and those below:

*choice

  *selectable_if (strength > 30) #Lift some weights.

    You pump iron to stay in shape.

    *finish

  *selectable_if (partner_name = "Jill") #Go jogging with Jill.

    You go jogging with Jill to stay in shape.

    *finish

  #Nuke some popcorn and watch TV.

    You do your impersonation of a Couch Potato.

    *finish

In the above example we have based the condition of the first #option on the character's numeric strength variable, while the second #option is now conditional on having the fitness fanatic Jill as your partner. As before, both options will be displayed regardless, but will only actually be selectable by the player if the stated condition is met (i.e. is true).

There is one other important point to bear in mind concerning the second example above. Because we have now also made "Go jogging" conditional, we must include a third option which is not in any way conditional, or which would always be true if neither of the other options are.

In effect, there can never be allowed a situation within any *choice body whereby the player does not have at least one selectable option always available, regardless. If every #option is conditional, then at least two of those options must be exact opposites, so that if one is not true then the other must be true. To continue the example above, the third option could, for instance, be something conditional on strength being less than 31 -- i.e. the exact opposite of the first #option.

Why use *selectable_if in preference to an ordinary *if command?

The important difference is that *selectable_if always displays the #option, even if it is not selectable by the player because the stated condition has not been met. An ordinary *if would simply not even display the option in the event that the condition has not been met.

*selectable_if is therefore a subtle means of informing the player that other options would be available at this particular stage if certain condition(s) were met, generally as a result of decisions made during either the character creation stage or at some point earlier in the story. It is a way of encouraging replays of your game in order to try out these different options. For this reason you should give careful consideration to conditional options, to decide whether each should be governed by *selectable_if or ordinary *if conditions.

Combining *selectable_if and *disable_reuse or *hide_reuse

Note that *selectable_if can be combined with *hide_reuse, *disable_reuse or *allow_reuse, provided that the reuse command precedes it, as in:

*temp money 5

*label Home

You have $${money} to spend. What will you buy?

*choice

    *hide_reuse *selectable_if (money >= 2) #A popsickle for $2.

        Great choice, the popsickle is delicious!

        *goto Home

    *disable_reuse *selectable_if (money >= 4) #A chocolate waffle for $4.

         A little overpriced, but it's worth every penny.

         *goto Home

    #Done shopping.

        You leave the candy store.

        *finish

Here, the options to buy a popsickle and a waffle will be visible but disabled ("greyed out") if they don't have enough money (as insured by the *selectable_if commands). Further, the popsickle option will become hidden if it has previously been picked (thanks to *hide_reuse), whereas the waffle option will be grayed out after it has been picked before (thanks to *disable_reuse). Otherwise, the options will be selectable.


More commands
Choice *choice, *fake_choice, *disable_reuse, *hide_reuse, *allow_reuse, *selectable_if
Variable *create, *temp, *set, Arithmetic operators, *delete, *input_number, *input_text, *print, *rand
Conditional *if, *elseif, *else
Goto *label, *goto, *goto_scene, *goto_random_scene, *gosub, *gosub_scene, *finish
Formatting Bold text, Italic text, *image, *line_break, *page_break, *link, *stat_chart
Miscellaneous *comment, *scene_list, *title, *author, *achieve, *achievement, *check_achievements, *bug, *ending, *more_games, *share_this_game, *show_password, *script

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.