I have been reading a lot of very useful and helpful posts in this forum. I am amazed how powerful Ren'Py can become. I am currently at a very basic level of knowledge of python but learning very quickly thanks to every one here.
I came across an old thread Link -> "Is this text behaviour possible in Ren'py" and I found it really awesome to implement it into my project. I am using the "ScrollSay.zip" from "Kinsman" Link-> Post# 5 (Thank you by the way! *tip my hat*).
I would like the characters names to appear with the text box on mine. I have followed the instructions written in the "script.rpy" file.
Code: Select all
Comments from the "script.rpy" file of the "ScrollSay.zip"
# You can place the script of your game in this file.
# To move what was done here to your own project:
#
# Copy the bottom part of options.rpy, the three variables
# Copy "say_aware", found here in script.rpy
# Make sure your Character objects have "callback=say_aware" added
# Copy "screen say" in screens.rpy
# Copy "transform say_enter" and "transform say_exit" in screens.rpy
# Copy "crossfade" too, if the character dissolving was important to your project
Code: Select all
# ScrollSay START
init python:
old_text = ""
new_text = ""
say_lock = True
# ScrollSay END
Code: Select all
# ScrollSay START
init python:
def say_aware(event,interact,type):
global old_text
global new_text
global say_lock
if event == "begin":
say_lock = False
if event == "end":
say_lock = True
old_text = new_text
def crossfade(oldface,newface):
trans = Dissolve(0.5,old_widget=ImageReference(oldface),new_widget=ImageReference(newface),alpha=True)
return trans()
# ScrollSay END
Code: Select all
define e = Character("Eileen", who_color="#c8ffc8", callback=say_aware)
Code: Select all
# ScrollSay START
transform say_enter:
alpha 0 yoffset -40
linear 0.5 alpha 1.0 yoffset 0
transform say_exit:
yoffset 0 alpha 1.0
linear 0.5 alpha 0.0 yoffset 40
screen say:
# Defaults for side_image and two_window
default side_image = None
default two_window = False
# Let's make the say screen itself simple,
# discarding things like who and two_window
$global new_text
$new_text = what
if say_lock == False:
window:
id "window"
text new_text id "what" at say_enter
window:
style "say_window"
background "#0000"
text old_text style "say_dialogue" at say_exit
else:
window:
id "window"
text old_text id "what"
# ScrollSay END
Code: Select all
## Say screen ##################################################################
##
## The say screen is used to display dialogue to the player. It takes two
## parameters, who and what, which are the name of the speaking character and
## the text to be displayed, respectively. (The who parameter can be None if no
## name is given.)
##
## This screen must create a text displayable with id "what", as Ren'Py uses
## this to manage text display. It can also create displayables with id "who"
## and id "window" to apply style properties.
##
## https://www.renpy.org/doc/html/screen_special.html#say
screen say(who, what):
style_prefix "say"
window:
id "window"
if who is not None:
window:
id "namebox"
style "namebox"
text who id "who"
text what id "what"
## If there's a side image, display it above the text. Do not display on the
## phone variant - there's no room.
if not renpy.variant("small"):
add SideImage() xalign 0.0 yalign 1.0
Code: Select all
## Make the namebox available for styling through the Character object.
I know in the comments of "# discarding things like who and two_window" that is written in the "screen.rpy" tells me that the "who" is not written. What would be the code that needs to be added to show the "who"?
Thank you for your time!
- edited the title!