• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Draw event doesn't update when value gets from ini file

L

LightWood

Guest
Hello GMS 1.4 Community! I have a really weird and annoying problem. I am just beginner in Game maker Studio and maybe I am doing something wrong. I have a save object (like in Undertale) which saves me and the room name where I am located. And in future I need to draw the room name where i were and I need to replace that room name with name where I am located now.
For example it draws room_1 (where i were before) than when I hit "save game" room_1 replaces to room_4. For example let's say that I have a global varibale called global.savedroom (this varibale saves the room name we are in). I created that varibale to display its value in another room.
For example i saved myself in room called room_1 and then I need to display that room name in another room even if I exit the game. To do it I save that variable (room_1) value in ini file. So here is one another problem. I save all my game values which I need to use in fututre in ini files (for example savedroom = <roomname>). So when I load that values from ini files in draw event it does show its name but when i save myself again in one room it also shows the room_1 name not the room_4 name (it does not update draw event). But I already saved myself in room_4. I also noticed that global.savedroom updates its value but doesn't updates in draw event. I hope you understood me. Here is an example gif to represent what I want to achieve.
 

Attachments

L

LightWood

Guest
Post the draw event.
switch(global.savedroom){
case "rm_forest1":
global.savedroomName = scr_lang("roomname1");
break;

case "rm_road":
global.savedroomName = scr_lang("roomname2");
break;
}

switch(global.currentRoom){
case "rm_forest1":
global.currentRoomName = scr_lang("roomname1");
break;

case "rm_road":
global.currentRoomName = scr_lang("roomname2");
break;
}

switch(global.savedroomCur){
case "rm_forest1":
global.savedroomCurName = scr_lang("roomname1");
break;

case "rm_road":
global.savedroomCurName = scr_lang("roomname2");
break;
}


//draw_text(32, 32, save_button)
draw_set_font(fnt_default);
get_input();

switch(save_button){
case 0:
break;

case 1:
txt_color_save[3] = c_yellow;
txt_color_save[4] = c_white;

draw_sprite(spr_savebox, 0, 0, 0);
draw_set_color(c_white)
draw_text(250, 64, global.name);
draw_text(250, 200, global.savedroomName);

draw_set_color(c_yellow);
draw_text(142, 256, save[0]);

draw_set_color(c_white);
draw_text(392, 256, save[1]);

if(rightKeyP){
save_button = 2;
}

if(leftKeyP){
save_button = 2;
}


break;

case 2:
txt_color_save[4] = c_yellow;
txt_color_save[3] = c_white;

draw_sprite(spr_savebox, 0, 0, 0);
draw_set_color(c_white)
draw_text(250, 200, global.savedroomCur);
draw_text(250, 64, global.name);


draw_set_color(c_white);
draw_text(142, 256, save[0]);

draw_set_color(c_yellow);
draw_text(392, 256, save[1]);

if(rightKeyP){
save_button = 1;
}

if(leftKeyP){
save_button = 1;
}

break;

case 3:
draw_sprite(spr_savebox, 0, 0, 0);
draw_set_color(c_yellow)
draw_text(250, 64, global.name);
draw_text(250, 200, global.currentRoomName);

draw_text(142, 256, save[2]);
draw_set_color(c_white);
break;
}
 

hogwater

Member
Sorry, but I can't make sense of all the variables you've got going on there. Hopefully someone else can help if you post that script as well.
 
Top