Hi guys. This error has me stumped, so I’m posting here. Basically this is the scene I keep just to store my ‘level-up’ subroutine. I only encounter this in randomtest btw … The error in question says:
Error in line 5: skills line 5: invalid return; we’ve already returned from the last gosub
To go through the code: in the main game, whenever a quest is done, I’ll say
*gosub_scene skills quest_complete
(To keep my code clean, I have different labelled subroutines for all my experience point checks.)
So the game skips to *label quest_complete and adds 500 experience points to the experience point count. Then it goes to *label level_up_check, which checks if the player has levelled up. If so, the player can add points to a stat. This then goes to *label exceed check which ensures that the player’s stats are capped at 100. Then all these subroutines return, and the player goes back to the game once all the stuff behind the scenes is taken care of.
*label quest_complete
- Quest complete: 500 EXP -
*set exp +500
*gosub level_up_check
*return ==== this is line 5 which throws up the error
*label level_up_check
*if ((exp % 1000) = 0)
Your skill level has increased!
*if (((charisma < 100) or (knowledge < 100)) or ((engineering < 100) or (intuition < 100)))
*line_break
Add a skill point to ...
*fake_choice
*selectable_if (charisma < 100) #Charisma
*set charisma +10
*selectable_if (knowledge < 100) #Knowledge
*set knowledge +10
*selectable_if (engineering < 100) #Engineering
*set engineering +10
*selectable_if (intuition < 100) #Intuition
*set intuition +10
#Forfeit the skill point
*gosub exceed_check
*return
*else
All your skills are maxed.
*gosub exceed_check
*return
*else
*return
*label exceed_check
*if (charisma > 100)
*set charisma 100
*goto check2
*else
*goto check2
*label check2
*if (knowledge > 100)
*set knowledge 100
*goto check3
*else
*goto check3
*label check3
*if (engineering > 100)
*set engineering 100
*goto check4
*else
*goto check4
*label check4
*if (intuition > 100)
*set intuition 100
*return
*else
*return
So I have no idea why randomtest is throwing this up …