YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
24 stars 8 forks source link

Allow Resetting a Persistent Room While Outside the Persistent Room #4342

Open ParodyKnaveBob opened 9 months ago

ParodyKnaveBob commented 9 months ago

I reported from the IDE to more easily attach a project, but since there was no way to call the "bug" report a feature request, I'd hoped I could simply edit it after it was submitted. I see no way to do that. Please view this as a desired feature and not a misguided claim of a bug -- and (YYG please) edit accordingly, of course. Tyvm.

Description

So many threads on the GMC boil down to the inability to reset persistent rooms without first visiting them. How many confused users don't even ask us?

Good news: I have just tested and discovered that one can visit multiple rooms in a single code block...

room_goto(rm_persistent);
room_persistent = false;
room_goto(rm_hub);
room_set_persistent(rm_persistent, true);

...and thus reset a room in the blink of an eye, (and I'm attaching said test project,) but beyond a mere test where a real game might have more than one (ha) persistent room to reset, one might be better off convolutedly saving a few things to a temporary file, using game_restart(), reloading the temp values, and deleting the file.

I suggest allowing the GM user to reset a persistent room while outside the persistent room. Three options came to mind while I was responding to another one of these threads:

Where _rm is the room to reset and _is_pers is the optional Boolean to set that room's persistent flag at the same time:

  1. overload existing function: room_restart() room_restart(_rm) room_restart(_rm, _is_pers) which I believe is my favorite option
  2. create new function: room_reset(_rm) room_reset(_rm, _is_pers)
  3. create new function pair: room_get_start(_rm) and room_set_start(_rm) room_set_start(_rm, _is_pers) which I don't favor, but would get whether or not a room is not in memory and (set) remove a room from memory

If one wants to toggle the _is_pers flag while resetting for whatever reason, one can of course use something like... !(room_get_info(_rm, false, false, false, false, false)).persistent

6554e06c-557c-4086-8bf0-6c83faaca0de

Alphish commented 9 months ago

Yet another alternative is to repurpose existing function room_set_persistent and make it work so that: