I think GOTO and GOSUB are useful, but many people say I should not use them...
@STARTG
LOOP 'START SCREEN
VSYNC
TXTF 'TEXT FORMAT ESTABLISHED EARLIER IN THE CODE
PRINT "WELCOME, PRESS A TO BEGIN."
IF APRS()==1 THEN @LVL0
ENDLOOP
@LVL0
LOOP
VSYNC
TXTF
PRINT "CHOOSE STORYLINE"
PRINT "A BUTTON: CHERRY"
PRINT "B BUTTON: ORANGE"
PRINT "Y BUTTON :BANANA"
IF APRS()==1 THEN @CH0 'CH0 IS THE FIRST SCREEN FOR THE CHERRY STORYLINE
ENDLOOP
Actually this suggestion gave me an idea that eventually worked. I was hesitant to use a variable to keep track because it would be a lot of work depending on how many screens (functions) I would eventually make, and with branching paths in the story, numbering the variables would become difficult to track and assign.
Here's an example what I came up with, for anyone in the future who wants to make a text based game and runs into issues like I did.
ACLS
DEF TXTF 'FUNCTION TO ESTABLISH TEXT FORMATTING, RIGHT
'NOW IT'S ONLY CLS BUT WILL BE USED FOR MORE LATER ON IN DEVELOPMENT
DEF CHF 'FUNCTION ESTABLISH TEXT FORMATTING FOR CHERRY STORYLINE
SPSET 1,1 'CHERRY SPRITE
SPOFS 0,370,200 'PUTS SPRITE IN BOTTOM RIGHT SO IT DOESNT BLOCK TEXT
SPSCALE 0,2,2 'CHERRY IS TWICE AS BIG AS NORMAL
END
DEF APRS 'CHECKS IF A IS RELEASED
IF BUTTON(1,#B_RRIGHT,3)==1 THEN RETURN 1 'THE 3 CHECKS IF THE BUTTON IS
'RELEASED, THAT WAY DIALOGUE CAN'T BE CYCLED THROUGH
'BY MERELY PRESSING THE BUTTON FOR TOO LONG/HOLDING IT DOWN
RETURN 0
END
DEF ST 'FUNCTION TO PUT IN THE BEGINNING OF EACH SCENARIO FUNCTION
CLS
WAIT 10 'WAIT 10 FRAMES, EVEN WITH BUTTON RELEASE BEING CHECKED FOR, IT IS STILL
'POSSIBLE FOR THE GAME TO DETECT A BUTTON RELEASE
'AND SKIP TWO OR MORE FUNCTIONS INADVERTENTLY, THIS MAKES
'IT SO THE BUTTON CAN ONLY TRIGGER ONE FUNCTION PER RELEASE
END
LOOP 'GAME LOOP
STARTG 'CALLS FIRST LEVEL SEE BELOW
VSYNC
ENDLOOP
DEF STARTG
LOOP
TXTF
PRINT "WELCOME, PRESS A TO BEGIN"
IF APRS()==1 THEN LVL0 'IF A BUTTON IS RELEASED, GO TO NEXT SCENARIO
VSYNC 'TO GET RID OF FLICKER
ENDLOOP
END
DEF LVL0
ST 'FUNCTION TO CLEAR SCREEN AND WAIT FOR 10 FRAMES, STARTS BEFORE LOOP
LOOP
CHF
PRINT "SAMPLE TEXT"
'MORE TEXT, MORE BUTTON CHECKS, MORE CALLING FUNCTIONS
VSYNC
ENDLOOP
END
Thanks for the help Na_trium