How to move say box programmatically

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
RewindTheGame
Regular
Posts: 54
Joined: Thu Dec 31, 2020 3:37 pm
Contact:

How to move say box programmatically

#1 Post by RewindTheGame »

Hello,

I know this is probably a simple thing but it's been driving me nuts. What I want to do is have my say screen appear at different places on the screen depending on the contents of the who parameter. So if the who parameter is "nobody" then the say text will appear 50 pixels from the top of the screen, but if the who parameter is anything else then it appears 50 pixels from the bottom of the screen. I can't work out how to do this.

In any other computer language, you'd just say something like:

style say_dialogue:
if who != "nobody":
ypos gui.dialogue_ypos+50
else:
ypos 50

but that doesn't work because I suppose you can't use IF in styles, so I'm at a loss how to do it. Help!

I mean, this would generally be important as well to move the say screen depending on the graphic behind it, so that it doesn't cover something important.

TIA,
Simon

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Contact:

Re: How to move say box programmatically

#2 Post by hell_oh_world »

try...

Code: Select all

define nobody = Character("Nobody", window_ypos=50)

RewindTheGame
Regular
Posts: 54
Joined: Thu Dec 31, 2020 3:37 pm
Contact:

Re: How to move say box programmatically

#3 Post by RewindTheGame »

Thank you very much, that's a lot easier than the convoluted solution I came up with about an hour ago :)

Post Reply

Who is online

Users browsing this forum: Google [Bot]