Page 1 of 1

Variable screen naming? [SOLVED]

Posted: Sun Nov 10, 2019 9:43 am
by HammeredEnt
Hi there!

I'm having a slight challenge with a memory system I've built into my game. I have a screen for the main memory menu which then allows the player to replay events with the characters.

So we start with the screen 'memories' and have this as a textbutton to access the memory menu for the White Queen character specifically:
if "wq00" in memory or "wq00z" in memory:
textbutton "White Queen" action Hide('memories'), Show('wqmem')


which then opens the 'wqmem' screen, and that works fine. Only problem is that I have a quick navigation screen also going so if the player uses that while the 'wqmem' screen is up, then the 'wqmem' screen may end up being stuck 'on' and I can't put in every possible variation for the characters into the quick navigation screen to close all those .

Is it possible to have a dynamic name for a screen? I thought if I could have a 'memorymenu' screen name that could be dynamically changed whenever a new character memory menu was selected, then I could just have a 'Hide('memorymenu')' action built into every action on the quick navigation bar that would always hide the individual character memory menu, but I haven't been able to figure out how to achieve that. Somehow setting "screen memorymenu' to equal 'screen wqmem' and having Hide('memorymenu') in my quick navigation actions. I haven't been able to find if that's possible, let alone if I'm coding it wrong.

Alternatively, I thought it might work with adding a "memorymenuset" variable into the script and then something like this:
textbutton "White Queen" action SetVariable('memorymenuset', 'wqmem'), Hide('memories'), Show('wqmem')

and then having:

hotspot (585, 702, 86, 128) action Hide('goto_shortcut'), Hide('goto'), Hide('inventory_screen'), Hide('todo'), Hide('memories'), Hide('[memorymenuset'), Show('stphonemenumain')

so that the viaible within the action would always be up-to-date to close the specific character memory menu, but that doesn't seem to work either. Any suggestions on how I can clean this up?

Thanks team!

Re: Variable screen naming?

Posted: Sun Nov 10, 2019 10:12 am
by Alex
Try to give the same 'tag' for all those screens, so you could show them using their names and hide using this single 'tag' (Hide action can use 'tag' of the screen instead of its name) - https://www.renpy.org/doc/html/screens. ... -statement

Also, this thread might be interesting for you - viewtopic.php?f=8&t=57095

Re: Variable screen naming?

Posted: Mon Nov 11, 2019 7:32 am
by HammeredEnt
Perfect! Thanks for that!