Gosub scene error: gosub has not yet been called?

Been working on a project on and off the past few months but the way I code is clunky as heck. My original code for setting the PC’s gender and other things looks like:

*fake_choice
`#Boy
``*set mc_m true
``*set mc_he "he"
`#Girl
``*set mc_f true
``*set mc_she "she"
`#Child
``*set mc_nb true
``*set mc_he "they"

Which is fine, it works but it’s very clunky to look at. So I peeked at CdlC’s code and wanted to experiment with the gosub scene command. Specifically using this code:

*label pc_male
*set gender 1
*set pc_he "he"
*set pc_him "him"
*set pc_his "his"
*set pc_boy "boy"
*set pc_sibling "brother"
*set pc_child "son"
*return

Now I keep getting the gosub has not yet been called error and I’m having a hard figuring it out. I checked the wiki and the tutorial but I’m still not getting it.

It means you are hitting the *return command before you hit the *gosub leading to it.

If you can hit that code with the *return in it from a number of different directions, it may be useful to put the *return under an *if. Then set a variable just before you gosub.

So

*if sent-from-chapter-six
   *return
4 Likes

Put the code snippet you copied below the actual gender set-up choice. Or, preferrably, at the bottom of your document, treating it like a footnote of sorts.

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