I know modal = True, but if use Modal, we need to create another button to hide it.
Omg, this code is what I'm looking for because it is sorter, but still have one problem as my code that if we didn't use modal = True, it will appear throughout Choice screen. And it work the same as my code
But I add ShowTransient to both of it, your code work perfect than mine:
Code: Select all
textbutton "Inventory" action If(renpy.get_screen("inven_screen"), true=Hide("inven_screen"), false=ShowTransient("inven_screen"))
Compare with my code:
Code: Select all
if inven_button == 1:
textbutton ("Inventory") action [ShowTransient("inven_screen"), SetVariable("inven_button", 0)] #<==== Show changed to ShowTransient
if inven_button == 0:
textbutton ("Inventory") action [Hide("inven_screen"), SetVariable("inven_button", 1)]
Problem of my code for secondary tried was: If the inventory shows up, and click outside it, it will auto hide and won't progress the game. But after that, we need to click
2 time at inventory button, and it shows again(as when clicked outside, inven_button didn't change value to 1, so we need click on it 1 more time before click it again to show inventory)
Your code with ShowTransient: just click outside inventory's screen 1 times, it hides, and click 1 time inventory's button, it shows again (not click 2 time, someone may think that is laggy).
It's just a minor problem, seems not much ppl use the code like me. But really thanks for your help!!