This time I'm facing a weird detour in which I have to choose if use Global Strings to store the name of the level to load (and consequentially need to create a new frame for every premade level) or use a Global Value to simply increase and reload the frame when the level is completed.
The problem is:
With the Global String I allow the Array to load a specific file (eg. "C:\DOT Levels\"+Level+".arr" where "Level" is the actual Global String previously set) at the very beginning of the frame but I cannot make it to increase that value (suppose "Level" contains just the string "1" so the file to load would be "1.arr") when player completes the level. Then I will need frames over frames to load the default levels I've made for my game.
With the Global Value I can load all the levels within a single frame just increasing the "Level" value when player completes the level and refreshing the frame. And this seems the most obvious (and easiest) way to build my game... but I really don't know how to let the Array to handle the files to load. With Global Values I can't tell it to load "C:\DOT Levels\"+Level+".arr" since it will results as a Mixed Strings and Numbers and the script won't work.
I can let the game to use Global Strings if player has made a custom level and wish it to be loaded into the game but I prefere to use a Global Value instead of a Global String for my default levels.
"C:\DOT Levels\Level" + Str$( Global Value A ) + ".arr"
(that's if the arrays are named "Level1.arr" etc)
Also, don't use fixed paths like "C:\DOT\Levels". It's much better to keep the levels in the same folder as the game itself, which the player should be able to put wherever they like (do NOT distribute your game in an installer).
Use the Appdrive$, Appdir$, and Apppath$ functions for this.
You find them under "Filenames" (in the same place as you retrieve Global Values etc from).
They tell you the current location of the game .exe itself, so it can be installed anywhere and still work properly.
Suppose your game is located at "C:\Games\MyGame\MyGame.exe"