How can I add a visible highlight to dialogue text?

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
CrowdControlHS
Newbie
Posts: 1
Joined: Sat Jul 14, 2018 2:48 pm
Contact:

How can I add a visible highlight to dialogue text?

#1 Post by CrowdControlHS » Sat Jul 14, 2018 2:58 pm

A few of my characters are meant to speak with a colored highlight to their text, like you could add to text in a Google Doc. How can I do this in Ren'Py? Preferably, I would like to know how to attach a string of code to the characters themselves that would add a highlight to everything they say automatically (like how you can assign the color of the character's name.) Thank you.

P.S. I'll also add that I'm not talking about outlining text, in case there's any confusion.

User avatar
MaydohMaydoh
Regular
Posts: 101
Joined: Mon Jul 09, 2018 5:49 am
Projects: Fuwa Fuwa Panic
Tumblr: maydohmaydoh
Location: The Satellite of Love
Contact:

Re: How can I add a visible highlight to dialogue text?

#2 Post by MaydohMaydoh » Sat Jul 14, 2018 6:11 pm

Don't think there is a way to do it, but you could edit the say screen and put the "what" text into a frame which gets a background color from a dictionary.

Code: Select all

define saycolors = { "Frank" : "#ff0000", "Sara" : "#00ff00" }
define frank = Character("Frank")
define sara = Character("Sara")
You have to make sure the names in the dictionary are the same as the characters' names in Character.

Code: Select all

frame xfill False:
	if who in saycolors.keys():
		background saycolors[who]
	else:
		background None
	text what id "what"
Then you put the "what" text in the say screen inside a frame. The if statement then checks if the name is in the dictionary and if it is then it applies the background color relating to the dictionary entry to the frame. Then you can mess around with the frame's style to get it just right.
Of course it's not perfect as if you have more than one line and the line stops half way, you'll get empty space with the background color.

Post Reply

Who is online

Users browsing this forum: No registered users