B
Borbely-Popescu Robert
Guest
Hello everyone!
I have a problem regarding room persistence.I want to turn the gameplay room's persistence off after the user clicks on the "Back to Main Menu" button that is located in the pause menu(another room which can be reached using a button located in the gameplay room).
My goal is to set the persistent status of the gameplay room to "true" in order for it to resume upon clicking the "Resume" button that is located in the Pause room but if the user clicks on the "Back to Main Menu" button the persistence should be turned off so the next time the user enters the gameplay room,it will start from step 0.
Note that the gameplay room has a "room_persistent = true" line in the creation code so the progress will not be lost upon pausing.
After googling it,I understood that there is a function ( room_set_persistent(room,state) ) that can be used to change the persistence status while not being in the targeted room.Using it while in the Pause room to set the gameplay room's persistence to "false" if the user clicks the "Back to Main Menu" did not work.
On the Tutorial page I have read, there was another method using the "room_persistent" variable while being in the targeted room to change the persistent state to "false" or "true" if the room was already visited and its persistence was already turned on.
The second method I tried was to introduce in the "Back to Main Menu" button's Left Pressed event the following code:
room_goto(Gameplay_room);
room_persistent = false;
room_goto(Start_Room);
so before returning to the Main Menu,the gameplay room is visited and its persistence is turned off but that didn't work either and as soon as the user reaches the Main Menu again and clicks the "Play" button,the gameplay room continues from where it stopped(the moment the user entered the pause menu to exit the gameplay room).
The problem is the gameplay room's persistence is never turned off even if it is visited,manually turned off and then exited.
I hope that you can help me and I thank you in advance for your time and effort ,
Robert.
I have a problem regarding room persistence.I want to turn the gameplay room's persistence off after the user clicks on the "Back to Main Menu" button that is located in the pause menu(another room which can be reached using a button located in the gameplay room).
My goal is to set the persistent status of the gameplay room to "true" in order for it to resume upon clicking the "Resume" button that is located in the Pause room but if the user clicks on the "Back to Main Menu" button the persistence should be turned off so the next time the user enters the gameplay room,it will start from step 0.
Note that the gameplay room has a "room_persistent = true" line in the creation code so the progress will not be lost upon pausing.
After googling it,I understood that there is a function ( room_set_persistent(room,state) ) that can be used to change the persistence status while not being in the targeted room.Using it while in the Pause room to set the gameplay room's persistence to "false" if the user clicks the "Back to Main Menu" did not work.
On the Tutorial page I have read, there was another method using the "room_persistent" variable while being in the targeted room to change the persistent state to "false" or "true" if the room was already visited and its persistence was already turned on.
The second method I tried was to introduce in the "Back to Main Menu" button's Left Pressed event the following code:
room_goto(Gameplay_room);
room_persistent = false;
room_goto(Start_Room);
so before returning to the Main Menu,the gameplay room is visited and its persistence is turned off but that didn't work either and as soon as the user reaches the Main Menu again and clicks the "Play" button,the gameplay room continues from where it stopped(the moment the user entered the pause menu to exit the gameplay room).
The problem is the gameplay room's persistence is never turned off even if it is visited,manually turned off and then exited.
I hope that you can help me and I thank you in advance for your time and effort ,
Robert.