Nested text

        *if (Parts >= 15)
          #I'll sell a lot of parts. 
            *set Parts -15
            *set Credits +75
            *goto GenShop
        *if (Parts >= 10)
          #I'll sell a moderate amount of parts.
            *set Parts +10
            *set Credits +50
            *goto GenShop
        *if (Parts >= 5)
          #I can't sell many parts, but some.
            *set Parts -5
            *set Credits +25
            *goto GenShop

Since the NPC’s response (vocally) to all of these options is identical, could I do this instead…

        *if (Parts >= 15)
          #I'll sell a lot of parts. 
            *set Parts -15
            *set Credits +75
        *if (Parts >= 10)
          #I'll sell a moderate amount of parts.
            *set Parts +10
            *set Credits +50
        *if (Parts >= 5)
          #I can't sell many parts, but some.
            *set Parts -5
            *set Credits +25
          *goto GenShop

… to get it to go to GenShop without having it under each option like I did before? I don’t mind copy/pasting the dialogue, but I’m also not sure where to place it to get it to go for all paths.

Yes you can use this, the npc’s response will be the same for all options, and the code will proceed to GenShop regardless of which option is selected

I don’t think that’ll pass Quicktest?

If you’ve turned on ICF or use a *fake_choice (grumble grumble) here, you don’t need to use a *goto at all. (Unless the *label GenShop where the story continues is somewhere other than right after the choice. If so, then you should indent the *goto at the same level as the *choice or *fake_choice, not the level of the *ifs or the #options. The single *goto in that case is where you want the code to go after all the detailed choice stuff is dealt with; so don’t put it at the level of the choice details, put it at the level of the story pre-choice, which should be the same indent level as your *choice/*fake_choice command.)

Otherwise, with a regular *choice, each #option needs its own *goto. Pretty sure QT will throw an error otherwise.

2 Likes

The *GenShop label is above this choice set in a loop with the other shop options (so that players won’t automatically exit the shop if they need to purchase more than one thing or purchase and sell some items and so forth). The biggest thing I’m stuck on is…

        *if (Parts >= 15)
          #I'll sell a lot of parts. 
            TEXT HERE
            *set Parts -15
            *set Credits +75
        *if (Parts >= 10)
          #I'll sell a moderate amount of parts.
            TEXT HERE
            *set Parts +10
            *set Credits +50
        *if (Parts >= 5)
          #I can't sell many parts, but some.
            TEXT HERE
            *set Parts -5
            *set Credits +25
          *goto GenShop

… getting the “text here” parts to be the same text without having to repeat the text three times.

Apologies. I clarified below.

But having that *goto at the bottom like that would do it even if they selected a different option?

In similar blocs in XoR I’d usually do:

        *if (Parts >= 15)
          #I'll sell a lot of parts. 
            *set Parts -15
            *set Credits +75
            *label parts_text
            TEXT HERE
            *goto GenShop
        *if (Parts >= 10)
          #I'll sell a moderate amount of parts.
            *set Parts +10
            *set Credits +50
            *goto parts_text
        *if (Parts >= 5)
          #I can't sell many parts, but some.
            *set Parts -5
            *set Credits +25
            *goto parts_text
1 Like

A loop within a loop within a loop… nice.

Loop-de-loop is what I will call this technique. I’ll be sure to hit’tem with it.

1 Like

Man i like their approach better, also correct me if im wrong but shouldn’t it be *set Parts -10 instead of *set Parts +10

1 Like

Nope! (Yes)

1 Like

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.