Where to put a gosub that caps relationship stats?

Hello everyone.
I have an issue related to a gosub I create to cap my relationship stats so that they don’t go negative.

First of all, let me tell you how I used the gosub so you can tell me if I did something wrong that gives me the error. After every *set char 10 I added the *gosub cap_rel

Here is the gosub code:

*label cap_rel
*if mayor < 0
    *set mayor 0
*if marc < 0
    *set marcus 0
*if jada < 0
    *set jada 0
*if dierc < 0
    *set dierc 0
*return

The issue is, I don’t know where I’m supposed to put it. I decided I was gonna add It at the very bottom of my code but if I do that I get a random test error saying something along the lines of “you already returned from the last gosub” so I don’t know what to do.

At the bottom is fine, but you have to make sure that your code never gets there other than via the gosub. So have an *ending or a *finish that your code is sure to hit before getting to *label cap_rel.

3 Likes

Also note, your code says “if marc” and then sets “marcus” instead of “marc”. This looks like a bug; they should probably be the same, whichever your variable is.

1 Like

Ah yes, I fixed it later when CSIDE caught it as a bug. Thank you for telling me either way though, I appreciate it!

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