Floating Text?
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.
-
- Newbie
- Posts: 16
- Joined: Fri Sep 23, 2011 8:07 pm
- Contact:
Floating Text?
Hey there, guys. I wanted to add floating text (I.E. Outside of the bottom text box, at various points on the screen) to my game, but I currently have no clue how I'd do something like this. I managed to get text that was completely centered on the screen, but I want to figure out how to put it at all places on the screen.
- Camille
- Eileen-Class Veteran
- Posts: 1227
- Joined: Sat Apr 23, 2011 2:43 pm
- Completed: Please see http://trash.moe
- Projects: the head well lost
- Organization: L3
- Tumblr: narihira
- Deviantart: crownwaltz
- itch: lore
- Contact:
Re: Floating Text?
You'd have to make a screen with text on it.
-
- Newbie
- Posts: 16
- Joined: Fri Sep 23, 2011 8:07 pm
- Contact:
Re: Floating Text?
Well, I tried something here:
And got this:
Code: Select all
screen tennisclub:
text "Please join the tennis club!" size 40
xpos 0.3 ypos 0.3
Code: Select all
File "game/script.rpy", line 20: Expected a screen language statement.
xpos 0.3 ypos 0.3
^
Re: Floating Text?
There are two ways to do this.
Either you write everything on the same line:
or you add a colon and indent:
Either you write everything on the same line:
Code: Select all
screen tennisclub:
text "Please join the tennis club!" size 40 xpos 0.3 ypos 0.3
Code: Select all
screen tennisclub:
text "Please join the tennis club!":
size 40
xpos 0.3 ypos 0.3
-
- Newbie
- Posts: 16
- Joined: Fri Sep 23, 2011 8:07 pm
- Contact:
Re: Floating Text?
Wow, that was simple enough. I feel stupid now.Another wrote:There are two ways to do this.
Either you write everything on the same line:or you add a colon and indent:Code: Select all
screen tennisclub: text "Please join the tennis club!" size 40 xpos 0.3 ypos 0.3
Code: Select all
screen tennisclub: text "Please join the tennis club!": size 40 xpos 0.3 ypos 0.3
Thank you very much either way, though.
As for another question; Is there a way to give a border to the text? Like, white text with a black border? Just so that it doesn't blend in with my background and is actually readable?
- Camille
- Eileen-Class Veteran
- Posts: 1227
- Joined: Sat Apr 23, 2011 2:43 pm
- Completed: Please see http://trash.moe
- Projects: the head well lost
- Organization: L3
- Tumblr: narihira
- Deviantart: crownwaltz
- itch: lore
- Contact:
Re: Floating Text?
That would be outline, and yes you can. Just add text style properties next to (or under, depends on which system you're using) your xpos and ypos stuff.
-
- Newbie
- Posts: 16
- Joined: Fri Sep 23, 2011 8:07 pm
- Contact:
Re: Floating Text?
The code I'm using:Camille wrote:That would be outline, and yes you can. Just add text style properties next to (or under, depends on which system you're using) your xpos and ypos stuff.
Code: Select all
screen tennisclub:
text "Please join the tennis club!" size 40 xpos 0.3 ypos 0.3 outlines (20, color("#000000"), 0, 0)
Code: Select all
File "game/script.rpy", line 352, in script
call screen tennisclub
File "renpy-6.12.0-mainline/common/00statements.rpy", line 532, in python
File "game/script.rpy", line 29, in python
text "Please join the tennis club!" size 40 xpos 0.3 ypos 0.3 outlines (20, color("#000000"), 0, 0)
TypeError: object of type 'int' has no len()
- PyTom
- Ren'Py Creator
- Posts: 16093
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Floating Text?
Outlines takes a list. Write it as:
Code: Select all
screen tennisclub:
text "Please join the tennis club!" size 40 xpos 0.3 ypos 0.3 outlines [ (20, "#000", 0, 0) ]
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Newbie
- Posts: 16
- Joined: Fri Sep 23, 2011 8:07 pm
- Contact:
Re: Floating Text?
Thanks!PyTom wrote:Outlines takes a list. Write it as:
Code: Select all
screen tennisclub: text "Please join the tennis club!" size 40 xpos 0.3 ypos 0.3 outlines [ (20, "#000", 0, 0) ]
It worked to display it, but the only problem is is that it doesn't allow the user to go past after the screen is displayed.
Re: Floating Text?
The answer depends on the way you called your screen.
With show screen, you'll usually use hide screen:
But since show screen wouldn't prevent the player from continuing, I presume you used call screen. Here, things get a bit more complicated. Indeed, the screen is waiting for an interaction. You should thus add a button or a timer to your screen. Example:
With show screen, you'll usually use hide screen:
Code: Select all
screen tennisclub:
text "Please join the tennis club!" size 40 xpos 0.3 ypos 0.3 outlines [(20, "#000", 0, 0)]
label start:
me "What should I do?"
show screen tennisclub
""
hide screen tennisclub
me "All right..."
Code: Select all
screen tennisclub:
vbox xpos 0.3 ypos 0.3:
text "Please join the tennis club!" size 40 outlines [(20, "#000", 0, 0)]
textbutton "Ok" action Jump("continue")
label start:
me "What should I do?"
call screen tennisclub
label continue:
me "All right..."
-
- Newbie
- Posts: 16
- Joined: Fri Sep 23, 2011 8:07 pm
- Contact:
Re: Floating Text?
Ahh, yes, using "Show Screen" as opposed to "Call Screen" made it work perfectly fine.Another wrote:The answer depends on the way you called your screen.
With show screen, you'll usually use hide screen:But since show screen wouldn't prevent the player from continuing, I presume you used call screen. Here, things get a bit more complicated. Indeed, the screen is waiting for an interaction. You should thus add a button or a timer to your screen. Example:Code: Select all
screen tennisclub: text "Please join the tennis club!" size 40 xpos 0.3 ypos 0.3 outlines [(20, "#000", 0, 0)] label start: me "What should I do?" show screen tennisclub "" hide screen tennisclub me "All right..."
Code: Select all
screen tennisclub: vbox xpos 0.3 ypos 0.3: text "Please join the tennis club!" size 40 outlines [(20, "#000", 0, 0)] textbutton "Ok" action Jump("continue") label start: me "What should I do?" call screen tennisclub label continue: me "All right..."
Thanks very much!
-
- Veteran
- Posts: 277
- Joined: Sun Sep 04, 2011 1:36 am
- Projects: A thingie without a title. With messy code.
- Contact:
Re: Floating Text?
Sorry to jump into the conversation, but is there a way to use the outline around the text when using text in an ui?
I'm using the love measuring bars but they're extremely hard to see against some of my backgrounds.
I found in another thread how to replace the bar with images, but I'm stupidly getting stuck on the text with the names being invisible against many of my backgrounds.
So I'll have to either replace that by an image (aaargghh!! yet more images to make!!) or figure out how to make the outline code work within the ui thing.
I'm using the love measuring bars but they're extremely hard to see against some of my backgrounds.
Code: Select all
ui.text("{font=font02.ttf}Bob's love for you:{/font} ")
ui.bar(Bob_max, Bob_points)
ui.text("Larry's love for you: ")
ui.bar(Larry_max, Larry_points)
ui.close() # for the vbox
So I'll have to either replace that by an image (aaargghh!! yet more images to make!!) or figure out how to make the outline code work within the ui thing.
(I drew my avatar especially to express the scary feeling I get from the code as I type it... XD)
- PyTom
- Ren'Py Creator
- Posts: 16093
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Floating Text?
Yes. You can do:
And then remove it from other places.
Code: Select all
init python:
style.default.outlines = [ (1, "#000", 0, 0) ]
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Veteran
- Posts: 277
- Joined: Sun Sep 04, 2011 1:36 am
- Projects: A thingie without a title. With messy code.
- Contact:
Re: Floating Text?
Thank you PyTom!!
And not for another epic noob moment, but... how do you remove that style from the other places? ^^;;;
And not for another epic noob moment, but... how do you remove that style from the other places? ^^;;;
Last edited by Soraminako on Tue Sep 27, 2011 3:46 pm, edited 1 time in total.
(I drew my avatar especially to express the scary feeling I get from the code as I type it... XD)
- PyTom
- Ren'Py Creator
- Posts: 16093
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Floating Text?
Which places do you want it in, and which not?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Who is online
Users browsing this forum: No registered users