Running a build of my WIP on the CogDemos.ink. I have it setup for when you go to the inventory from the housing, it executes the inventory file as a gosub_scene. Then when going to weapons from inventory, that uses a goto_scene. When I executed the *return function from that goto_scene file, it said that there wasn’t an area to *return to.
Tried to research this one, couldn’t find a prior thread, so opening this one!
IIRC, yes, every new gosub overwrites where the game tries to return to.
From what I understand, though, you want to have multiple inventory systems, that can be done with a ‘page’ variable or just with a navigation menu
EDIT:
For example, this is all in the choicescript_stats file
*label main
Stuff for the main stats page
*goto navigation_menu
*label page2
Stuff for this page
*goto navigation_menu
*label page3
Stuff for this page
*goto navigation_menu
*label page4
Stuff for this page
*goto navigation_menu
*label navigation_menu
*choice
#Main Page
*goto main
#Page 2 Title
*goto page2
#Page 3 Title
*goto page3
#Page 4 Title
*goto page4
I would have expected this to work. That said, I would strongly advise you try not to sprinkle normal goto_scenes amidst gosub_scenes. That could lead to some very complicated and hard to follow systems. Is there any particular reason you can’t just make it another gosub_scene? Two returns should get you the same result?
Edit:
I can’t remember the specific implementation details but there is to my knowledge a return “stack” so you can nest gosub routines (both across files and within). There might be instances where that stack is cleared or behaviour isn’t quite as one might expect, but by and large I wouldn’t expect this statement here to be true.
IIRC, you can stack gosubs, even gosub_scenes, but once you goto_scene it clears the stack. @CJW’s solution is the correct one, use another gosub_scene and two returns.