W
whale_cancer
Guest
Edit: Does...
Edit2: I tried making a dummy file before loading so it would point to the directory I want it to. Didn't work:
Edit3: My loading and saving system was working before, but now I realize because I was testing it by making a blank map, editing it quickly, and then loading it. This doesn't work in the long run, of course, as it means I can only save and load within a session.
Original Post: Hello. No 'all' or '!' this time. This is driving me nuts! I know this is probably something simple like my last file handling question, but I just can't figure it out.
tldr version: Using 'working_directory + '/Maps/' + string(global.mapName) + '/' + +string(global.mapName)' gives me different locations depending on whether I am saving or loading.
Full problem:
Here is the start of my map saving script:
It creates the files and writes to them as expected. I can locate both files in "C:\Users\Whale Cancer\AppData\Local\Kasei_0_22_MapEditor_Edition2\Maps\Seb\"
Here is how I (attempt to) load the map in the map load room right before the editor:
And then in the actual room where the map is to be loaded:
You can see I use the string " working_directory + 'Maps\' + parent.mapToOpen + '\'" to point to the correct file, but when saving it points to where I expect ( "C:\Users\Whale Cancer\AppData\Local\Kasei_0_22_MapEditor_Edition2\Maps\Seb\") but when loading it decides to point to "C:\Users\Whale Cancer\AppData\Local\gm_ttt_11101\gm_ttt_42887\Maps\Seb\"
What am I doing wrong. This stuff has been frustrating me all day.
...mean that I need to save a dummy file each time in order to get it to point to where I think it should point to? ( "C:\Users\Whale Cancer\AppData\Local\Kasei_0_22_MapEditor_Edition2\Maps\Seb\")For example, if you have a default *.txt file included with your game and read it into memory using working_directory, then that file will be taken from the area where the included files are stored. If you then choose to write that information to a text file using working_directory, this will write the file to the target platforms local storage, where it will be read from the next time unless you instruct GameMaker: Studio to delete the file, in which case working_directory will once more point to the area where the included files are stored.
Edit2: I tried making a dummy file before loading so it would point to the directory I want it to. Didn't work:
Code:
tB = file_bin_open('Dumb', 1);
file_bin_write_byte(tB, 04);
file_bin_close(tB);
Original Post: Hello. No 'all' or '!' this time. This is driving me nuts! I know this is probably something simple like my last file handling question, but I just can't figure it out.
tldr version: Using 'working_directory + '/Maps/' + string(global.mapName) + '/' + +string(global.mapName)' gives me different locations depending on whether I am saving or loading.
Full problem:
Here is the start of my map saving script:
Code:
show_debug_message('Saving map...')
tF = file_text_open_write(working_directory + '/Maps/' + string(global.mapName) + '/' + +string(global.mapName) + '.map');
show_debug_message('Saving .map file to '+string(working_directory + '/Maps/' + string(global.mapName)) + string(global.mapName) + '.map');
file_delete(working_directory + '/Maps/' + string(global.mapName) + '/' + string(global.mapName) + '.ini');
tIni = ini_open(working_directory + '/Maps/' + string(global.mapName) + '/' + string(global.mapName) + '.ini');
show_debug_message('Saving .ini file to '+string(working_directory + '/Maps/' + string(global.mapName)) + string(global.mapName) + '.ini');
Here is how I (attempt to) load the map in the map load room right before the editor:
Code:
global.mapToLoad = working_directory + 'Maps\' + parent.mapToOpen + '\'
show_debug_message('global.mapToLoad is '+string(global.mapToLoad))
global.loadmap = true;
//resize room based on stuff
room_set_width(rm_mapEditor, global.mapWidth * 16 * 16)
room_set_height(rm_mapEditor, global.mapHeight * 16 * 15)
room_goto(rm_mapEditor);
And then in the actual room where the map is to be loaded:
Code:
show_debug_message('Going into rm_mapEditor and loading a map')
show_message('Attemping to load... ' + global.mapToLoad)
///copy the grids from the file so that they are placed instead of the blanks created in scr_mapInitialize
//open the file again, since we are in a new room
tF = file_text_open_read(global.mapToLoad + string(global.mapName) + '.map');
show_debug_message('Loading file ' + global.mapToLoad + string(global.mapName) + '.map');
What am I doing wrong. This stuff has been frustrating me all day.
Last edited: