Preventing user clicking on screen during dialogue
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.
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.
Preventing user clicking on screen during dialogue
Hi, I am trying to do something a little tricky.
I have a screen full of buttons, which I want to still show in the background during a particular dialogue.
But I do not want the player to be able to click on the screen buttons while the dialogue is playing.
To achieve this, I have covered the button screen with another screen which has some opacity and activates at the start of the dialogue (to indicate to the player that the background screen is unavailable), and I have made that screen modal.
However, because of the modal screen, it is now impossible to advance through the game. The dialogue just stays stuck at the first sentence.
I tried putting the 'say' window on a high zorder, but it doesn't help. I'm guessing the 'click-to-advance' behavior is happening on a low layer.
What would be the best way to approach this particular problem? Thanks a lot!
I have a screen full of buttons, which I want to still show in the background during a particular dialogue.
But I do not want the player to be able to click on the screen buttons while the dialogue is playing.
To achieve this, I have covered the button screen with another screen which has some opacity and activates at the start of the dialogue (to indicate to the player that the background screen is unavailable), and I have made that screen modal.
However, because of the modal screen, it is now impossible to advance through the game. The dialogue just stays stuck at the first sentence.
I tried putting the 'say' window on a high zorder, but it doesn't help. I'm guessing the 'click-to-advance' behavior is happening on a low layer.
What would be the best way to approach this particular problem? Thanks a lot!
- Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Preventing user clicking on screen during dialogue
Modal screens would stop interactions with everything until you hide them. Including advancing and other screens. You could make your modal screen one pixel in size and it would still block everything
Quick fix is make screen non-modal and a single invisible button, covering whole screen, with do-nothing action.
Quick fix is make screen non-modal and a single invisible button, covering whole screen, with do-nothing action.
< < insert Rick Cook quote here > >
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
- Contact:
Re: Preventing user clicking on screen during dialogue
I'd personally use imagebuttons and place their images on screen and not make them buttons until you need them to be buttons.
No need to rely on blocking the buttons then.
No need to rely on blocking the buttons then.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Free Android GUI - Updated occasionally
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Re: Preventing user clicking on screen during dialogue
Thanks! I'll try that, and report.Ocelot wrote:Modal screens would stop interactions with everything until you hide them. Including advancing and other screens. You could make your modal screen one pixel in size and it would still block everything
Quick fix is make screen non-modal and a single invisible button, covering whole screen, with do-nothing action.
Edit:
So I tried with an invisible button. It almost works as intended, however, advancing the story only happens when clicking outside the invisible screen. That could be confusing for players. Is there any way I could cause the invisible button to advance to the next line of conversation instead of doing nothing?
Here's an illustration of what I'm trying to achieve:

PS: I am not using image buttons at all for that game, it's a design decision that would be too complex to unwind. I could also set a blocking variable and use it with an 'if' clause on each button's action, but that would add a lot of clutter to the code, because there are lots of buttons...
Re: Preventing user clicking on screen during dialogue
I found the solution, and it was actually super easy! All I had to do was mapping the invisible button to the action 'Return()', and voila, the game advances when clicking. Thank you guys for your help.goldo wrote: So I tried with an invisible button. It almost works as intended, however, advancing the story only happens when clicking outside the invisible screen. That could be confusing for players. Is there any way I could cause the invisible button to advance to the next line of conversation instead of doing nothing?
Who is online
Users browsing this forum: Bing [Bot]