Variable as goto label?

I was wondering if i could use:
*goto StoryPointer
at the end of a battle system, so i could essentially call that battle system from any point in my game, feed it the variables i have defined from that point in the story and when the battles over, return to the next page in the story. then i can call a new battle with new variables reflecting the new position in the story.

If you can’t have a redirecting goto command then the battle system can’t be re-usable as instead of advancing in the story, it will go back to the same place forming a loop.

the only fix i can think of, is adding a lot of if commands, checking what StoryPointer is current and then using that specific goto NAME.
*if StoryPointer = NAME1
*goto NAME1
*if StoryPointer = NAME2
*goto NAME2
I really hope there’s a way to just use a ( goto Variable) to avoid having to use all that extra code.

I don’t think you can use variables within a *goto command. (I could be proven wrong though).

Could you use sub-routines and the return command? I’m not sure if they work if you’re going between scenes though.

yes that should work, i haven’t tested it but it sounds solid, i’ll change goto’s into gosub. thanks for the quick reply.

*set a variable hold_position. Before you send the reader to the battle code, record with hold_position where you want to send the reader after the battle. At the end of the battle scene, use *gotoref hold_position.

For example:

*set hold_position “StoryPhaseTwo”
*goto BattleSequence

*label BattleSequence
*comment fight fight fight
*gotoref hold_position

*label StoryPhaseTwo
Story story story
*set hold_position “NextStory”
*goto BattleSequence

*label NextStory
Blah blah blah
*finish

1 Like