Invalid Return Error


I tried to resolve this issue myself, but I just haven’t managed to find a workable solution. The error is a 'invalid return; we’ve already returned from the last gosub. It occurs when reaching the end of either one of the gosubs.


I don’t know if that will be helpful, but I’ve had this error when I added new variable and tried to play from save point.

This occurs for me because the save point doesn’t recognize the new variable so I always restart the game and this error goes away. At least that’s what happen for me.

Edit: I took a look at your forum thread and you mentioned an update. Most likely your save slots are broken and players need to restart the game if you added any new variables. Hope this helps.


I encountered this very issue yesterday :flushed:
In my case, the problem was that the scene being accessed by gosub_scene was listed at the end of my scene list in startup. So the error didn’t come from going to the scene using gosub_scene, it came from accessing the scene sequentially from the scene list (since, when you access the scene this way, it doesn’t know what to do with the *return command at the end).
To fix this, I had to move the scene in question up in the scene list, and make sure that it is never accessed unless I use a gosub_scene command (ie.the scene above it in the scene list now has a goto command at the end instead of a *finish, essentially skipping over the scene in question).
Weirdly, simply using the *ending command in the scene prior did not solve the problem, though it seems like it should have.

I don’t know if this will help you, but it was the solution I came to yesterday after an annoying amount of time spent scratching my head :confounded:


Thanks for the responses so far. I’ll be sure to try them and see if it leads to a resolution.


Your solution worked perfectly. I had to change a few things on my side, however, it made the game playable again. So I’ll definitely remember it for next time if I ever encounter the same issue.