I have a subroutine to cap all stats and relationships at 0/100, filed under *label stat_cap
It is as follows:
*if vampire_like < 0
*set vampire_like 0
*if vampire_like > 100
*set vampire_like 100
*return
(Except that everything before the *return is a complete list of all of my stats, subbed into that formula.)
After adding to any stats during the scene, I put in a line:
*gosub stat_cap
This is working perfectly for my first scene, which has that gosub after several options (multiple options and also multiple choices - practically every option changes stats, which then directs to it.)
I then have a second scene that has the identical subroutine (everything from *label to *return) pasted at the bottom of that text file. I used the exact same format to *gosub to it.
The weird thing is, it also works perfectly - until I get to the very last set of options I’ve written into that scene. Then it gives me this:
The bug report line refers to 154, which is the line with the single *return on it.
I did a “find” in my second scene, and the word “return” only appears once, in the *return at the end of the subroutine (which is identical to the one from the first scene.) So, how can my code be returning with no problems from multiple gosub commands, then suddenly think there is a second return somewhere which only breaks the last option of the second scene? I should also add, all options in scene 2 worked fine before adding in the *gosub lines.
Here is the complete code for the option that keeps breaking my subroutine (has minor spoilers for Monster High):
*label hunter_threat
As you pass near his desk, you're surprised when he speaks; normally he sticks to brooding at you.
It's just one muttered word: "[i]Freak[/i]." You whirl around to stare at him. It takes a second to believe what you've heard, but then you say...
*choice
*selectable_if (Popular >=70) # "WHAT did you just say to me??"
You wait a few long moments, waiting for everyone to start whispering and staring. Then you say, "You're the freak, you jerk. Do you have [i]any[/i] friends?" With that you give him a superior smile and head to your assigned seat. Assorted giggles and snickers tell you that you have gained social status and he has lost it.
Victory is sweet.
*set Popular +5
*set Hunter_like -10
*gosub stat_cap
*goto start_of_class
*selectable_if (Humanity >=35) #"You must be a very unhappy person to bully other people for no reason."
*set Serenity +5
*set Hunter_Like +5
*gosub stat_cap
*goto start_of_class
#"Why do you have to insult me all the time? Y'know, I wish we could just get along."
*set Humanity +5
*set Hunter_Like +10
*gosub stat_cap
*goto start_of_class
*selectable_if ((Attractive >=50) and (orientation !="Asexual")) # "Darling, I know you have the hots for me - and believe me, the feeling is mutual. But I fear our love is not meant to be... so let's stop flirting in class, okay?"
*set Attractive +5
*set Hunter_Like +10
*gosub stat_cap
*goto start_of_class
#"Nice to see you too, ${Hunter_name}. Is that a new pair of 'look at me, I'm a badass' boots? They really go with the douchey hair."
*set Persuasion +5
*set Hunter_Like -10
*gosub stat_cap
*goto start_of_class
*if species!="Goblin"
*selectable_if (Humanity <30) # "I wonder what your skin would look like as a hat."
*set Humanity -10
*set Hunter_Like -5
*gosub stat_cap
*goto start_of_class
#Nothing. I'm unsettled by what this might mean... could he know about my real species?
*set Cunning +5
*gosub stat_cap
*goto start_of_class
*label Artemis_entrance
This is where you should end up if the Hunter is female.
*goto start_of_class
*label start_of_class
This is the start of class.