I usually would do something like BlinkOk said.. where id set like
global currentworld = 1
global currentlevel = 1
SetUpScene()
do
UpdateCharacter()
UpdateEnemy()
UpdateCollision()
UpdateFriends()
UpdateItems()
SyncScene()
sync()
loop
CleanupScene()
Function SetUpScene()
select currentworld
case 1
select currentlevel
case 1 : lvl_1_1_setup() : exitfunction : endcase
case 2 : lvl_1_2_setup() : exitfunction: endcase
endselect
endcase
endselect
endfunction
Only other way I see is maybe #include a blank text file at the beginning.. and then maybe .. hmmm..
#include "temp_function.txt"
Create a function that will rewrite the function on the blank text file and then call it after.
Like if you wanted to get a sprite from a world or level...
Function GetSpr( world, level, whattoget$, ID )
opentowrite(1, "temp_function.txt" )
writeline(1, "Function GetSprFromEditor("+str(world)+","+str(level)+")" )
writeline(1, "spr = lvl_"+str(world)+"_"+str(level)+"_"+whattoget$+"["+str(ID)+"]")
writeline(1, "" )
writeline(1, "Endfunction spr")
closefile(1)
spr = GetSprFromEditor(world,level)
endfunction spr
Maybe use it like
spr = GetSpr(1,1,"eggs")
JUST A THEORY