I’m having a hard time trying to load a level from a file, which was created within the game. The loading the level code is working very well.
The levels (or strings if I can call them) are a group of file directory, which is obtain by a script when it is executed from the left mouse pressed event of an object:
//I used text format as a demonstration.
global.lvl0=get_open_filename("text (.txt)|*.txt",".txt");
global.lvl1=get_open_filename("text (.txt)|*.txt",".txt");
global.lvl2=get_open_filename("text (.txt)|*.txt",".txt");
global.lvl3=get_open_filename("text (.txt)|*.txt",".txt");
global.lvl4=get_open_filename("text (.txt)|*.txt",".txt");Now first, I make a script for either saving all these strings in one (which is working well) or loading the group of strings from the file (which is not working right)://I use my own file format in this one. scr_lvl_temp(Boolean)
//the Boolean is for checking wether load or save.
if 1==argument0{
ini_open("5169369122.XbbY")
global.lvl0=ini_read_string("level","type0","")
global.lvl1=ini_read_string("level","type1","")
global.lvl2=ini_read_string("level","type2","")
global.lvl3=ini_read_string("level","type3","")
global.lvl4=ini_read_string("level","type4","")
ini_close()}
if 0==argument0{ini_open("5169369122.XbbY")
ini_write_string("level","type0",global.lvl0)
ini_write_string("level","type1",global.lvl1)
ini_write_string("level","type2",global.lvl2)
ini_write_string("level","type3",global.lvl3)
ini_write_string("level","type4",global.lvl4)
ini_close()}This code is executed at the room creation. At first it loads the first string, but when I press the “Enter key”, this should cause to skip to the next text, but instead, it didn’t load it. I try debugging and notice that the code is not loading the strings. I tried a different method by checking whether the global.lvl0==0 in step event, then it should open up the first script (to load the strings). And for draw event, it draws a text to see if global.lvl0 (and others) do not equal 0. The final result was that it did load the string but did not display the level (level didn’t loaded). I just don't get it; it should work.Is there some way to solve this problem?
Edited by MisuMen49, 26 April 2012 - 08:54 PM.











