Running dialogue on a screen with modal [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
Deimos96
Regular
Posts: 26
Joined: Tue Nov 15, 2022 5:34 am
Contact:

Running dialogue on a screen with modal [Solved]

#1 Post by Deimos96 »

Hi, I'm trying to run dialogue that occurs on a screen that has modal True.

How do I make it so that when a dialogue is running, you can click anywhere on the screen to advance the dialogue. But the screen itself is insensitive, so you don't accidently click on some buttons while the characters are talking.

Here's a simplified version of the code.

Code: Select all

screen game_menu():
	modal True
	
	# Screen code, the code for activating the dialogue goes here.

label game_loop: # Start here
	show screen game_menu
	pause
	
label dialogue(sayer, dialogues):
	python:
		for line in dialogues.line:
			renpy.say(sayer, line)
	
	jump game_loop

Edit:
Solved it with help from renpy discord. If anyone happens to stumble here with a similar question here's the fix:

Code: Select all

screen game_menu():
	modal True
	
	# Screen code, the code for activating the dialogue goes here.

screen dialogue_screen():
	dismiss action Return()
	
label game_loop: # Start here
	show screen game_menu
	pause
	
label dialogue(sayer, dialogues):
	python:
		
		renpy.show_screen("dialogue_screen")
	
		for line in dialogues.line:
			renpy.say(sayer, line)
			
		renpy.hide_screen("dialogue_screen")
	
	jump game_loop
Basically pass another screen while the dialogue is active. Then use dismiss with a Return action().

Post Reply

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot]