Variable screen naming? [SOLVED]

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
HammeredEnt
Newbie
Posts: 21
Joined: Sat May 04, 2019 8:09 am
Contact:

Variable screen naming? [SOLVED]

#1 Post by HammeredEnt » Sun Nov 10, 2019 9:43 am

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!
Last edited by HammeredEnt on Mon Nov 11, 2019 7:33 am, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 2317
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Variable screen naming?

#2 Post by Alex » Sun Nov 10, 2019 10:12 am

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

HammeredEnt
Newbie
Posts: 21
Joined: Sat May 04, 2019 8:09 am
Contact:

Re: Variable screen naming?

#3 Post by HammeredEnt » Mon Nov 11, 2019 7:32 am

Perfect! Thanks for that!

Post Reply

Who is online

Users browsing this forum: deltadidirac, Newnewbie