To exit a function prior to the end, use Exitfunction
eg.
rem load the game state
if GameState.active = SplashScreen_1_STATE then Splashscreen_1() : exitfunction
Is the code you posted the complete code your trying to compile or a snippet from it ?
if it's the complete code, then there's a number of missing declarations like
SplashScreen_1_State and
clearscreen() for example.
Edit: Looking at the code, you've a naming collision occurring between the Global instances of
GameState and the local instance of
GameState that's being passed into the set function.
Here's a quick hack that seems to compile with some stub functions added to make it compile.
Rem Project: Winter Platformer
Rem Created: Friday, January 10, 2014
Rem ***** Main Source File *****
Global WindowW = 400
Global WindowH = 600
Set display mode WindowW,WindowH,32
sync on
sync rate 60
backdrop on
color backdrop RGB(0,0,0)
type GameState_VT
status
active as integer
endtype
GameState as GameState_VT
#constant SplashScreen_1_State 1
set_game_state( SplashScreen_1_State )
do
select GameState.active
case SplashScreen_1_State
Splashscreen_1()
endcase
endselect
sync
loop
function set_game_state( NewGameState )
rem if a game state is already active, unload it
if GameState.active = SplashScreen_1_STATE then clearscreen()
rem set the new game state
GameState.active = NewGameState
rem load the game state
if GameState.active = SplashScreen_1_STATE then Splashscreen_1() : exitfunction
endfunction
function clearscreen()
print "This function clears the screen I would imagine"
EndFunction
function Splashscreen_1()
print "Show splash screen"
endfunction