Continuing to need help with screens and styles
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.
- YamiiDenryuu
- Newbie
- Posts: 9
- Joined: Sun Mar 23, 2014 11:07 pm
- Projects: meduka meguca: the loop of infinity
- Contact:
Continuing to need help with screens and styles
I'm using the show text function to make some messages appear in my game, but as it is it looks... terrible.
What I can find about it talks about using styles, so there's apparently some way to change how it looks, but I can't seem to figure it out. What I'd like is to make it look something like the menu options- just add a box with a simple border behind the text. How can I do that? Is there a better function I could be using?
What I can find about it talks about using styles, so there's apparently some way to change how it looks, but I can't seem to figure it out. What I'd like is to make it look something like the menu options- just add a box with a simple border behind the text. How can I do that? Is there a better function I could be using?
Last edited by YamiiDenryuu on Thu Aug 21, 2014 6:34 pm, edited 2 times in total.
-
- Eileen-Class Veteran
- Posts: 1258
- Joined: Fri Sep 21, 2007 7:13 am
- Projects: a battle engine
- Contact:
Re: How to make "show text" look nicer
show text is mega limited (and also undocumented =P). I'd suggest using a screen, then you can do what you want.
You can then style the frame and text as you like with window and text style properties just like you style anything in a screen.
You can then show messages in the script using:
in the place of 'show text'
_transient=True puts the screen on the "transient" layer so the message disappears with the next click.
Code: Select all
screen message:
default txt = ""
frame align (0.5, 0.5):
text txt
You can then show messages in the script using:
Code: Select all
show screen message(_transient=True, txt="PLACEHOLDER REPLY GOES HERE")
_transient=True puts the screen on the "transient" layer so the message disappears with the next click.
- YamiiDenryuu
- Newbie
- Posts: 9
- Joined: Sun Mar 23, 2014 11:07 pm
- Projects: meduka meguca: the loop of infinity
- Contact:
Re: How to make "show text" look nicer
Okay, I'll try that out. Thanks!
- YamiiDenryuu
- Newbie
- Posts: 9
- Joined: Sun Mar 23, 2014 11:07 pm
- Projects: meduka meguca: the loop of infinity
- Contact:
Re: How to make "show text" look nicer
Oh... kay, I almost succeeded in creating the box I wanted, but then suddenly I broke Ren'py.
Before that, I was getting the usual type of error messages, about "mesbox" not being defined with this code:
init:
$ mp = MultiPersistent("medukameguca")
$ style.create("mesbox", default)
$ style.mesbox.textalign = 0.5
$ style.mesbox.background = "#000"
screen message(style=mesbox):
default txt = ""
frame align (0.5, 0.5):
text txt
The error was occurring on the line with "screen message(style=mesbox)".
The new supererror happened when I decided to try indenting the screen message block another tab to line up with the init block (my code is really badly organized... but that's a separate problem), and persisted even after I undid that. Please send help.
Okay, removing the init block fixed the crazy error, at least. So what am I doing wrong?
Before that, I was getting the usual type of error messages, about "mesbox" not being defined with this code:
init:
$ mp = MultiPersistent("medukameguca")
$ style.create("mesbox", default)
$ style.mesbox.textalign = 0.5
$ style.mesbox.background = "#000"
screen message(style=mesbox):
default txt = ""
frame align (0.5, 0.5):
text txt
The error was occurring on the line with "screen message(style=mesbox)".
The new supererror happened when I decided to try indenting the screen message block another tab to line up with the init block (my code is really badly organized... but that's a separate problem), and persisted even after I undid that. Please send help.
Okay, removing the init block fixed the crazy error, at least. So what am I doing wrong?
u wot m8
- fluxus
- Regular
- Posts: 133
- Joined: Thu Jun 19, 2014 8:06 am
- Projects: Animal Anaesthesia (a teaching game)
- Contact:
Re: UPDATE: Broke Ren'py with screens and styles. ):
Well, badly organized code and super-errors are never separate problems
In order to get good advice on tab placement though (and coding style in general), you need to use the code tags when copy-pasting your program code.
[/code]
By the way you can do
instead of
In order to get good advice on tab placement though (and coding style in general), you need to use the code tags when copy-pasting your program code.
Code: Select all
[code]
Your:
code here
By the way you can do
Code: Select all
init python:
code
code
Code: Select all
init:
$ code
$ code
- fluxus
- Regular
- Posts: 133
- Joined: Thu Jun 19, 2014 8:06 am
- Projects: Animal Anaesthesia (a teaching game)
- Contact:
Re: UPDATE: Broke Ren'py with screens and styles. ):
Hmm. I'm only beginning to look into styles myself, but, it looks like
is the standard way of defining a new style?
In your example that would be
I'm not really sure about this, and haven't tried it out myself. Currently I'm trying to find out for myself how to find out where to fetch the colours defined by the theme so that whatever I define things as, a theme change won't break everything :]
Have you looked at http://www.renpy.org/doc/html/style.html though?
Code: Select all
style my_text is text:
size 40
In your example that would be
Code: Select all
style mesbox is default:
align 0.5
Have you looked at http://www.renpy.org/doc/html/style.html though?
- YamiiDenryuu
- Newbie
- Posts: 9
- Joined: Sun Mar 23, 2014 11:07 pm
- Projects: meduka meguca: the loop of infinity
- Contact:
Re: UPDATE: Broke Ren'py with screens and styles. ):
@fluxus: Well, I used the tag because it said it was for code, but I guess [code] is the better tag. So let me try that again:
[code]init:
$ mp = MultiPersistent("medukameguca")
$ style.create("mesbox", default)
$ style.mesbox.textalign = 0.5
$ style.mesbox.background = "#000"
screen message(style=mesbox):
default txt = ""
frame align (0.5, 0.5):
text txt[/code]
As for the code I used, I found it on one of the Renpy wiki pages... I'll try your code next, though.
[code]init:
$ mp = MultiPersistent("medukameguca")
$ style.create("mesbox", default)
$ style.mesbox.textalign = 0.5
$ style.mesbox.background = "#000"
screen message(style=mesbox):
default txt = ""
frame align (0.5, 0.5):
text txt[/code]
As for the code I used, I found it on one of the Renpy wiki pages... I'll try your code next, though.
u wot m8
Re: UPDATE: Broke Ren'py with screens and styles. ):
Code: Select all
style mesbox_frame:
is default
align (0.5, 0.5)
background "#000" # Or path to a pretty background
style mesbox_text:
is text
align (0.5, 0.5)
screen message(txt):
frame:
style_group "mesbox"
text txt
label start:
show screen message("I am a Centered Text!")
"Meow"
- YamiiDenryuu
- Newbie
- Posts: 9
- Joined: Sun Mar 23, 2014 11:07 pm
- Projects: meduka meguca: the loop of infinity
- Contact:
Re: UPDATE: Broke Ren'py with screens and styles. ):
Awesome, thanks! It looks like it'll be easy to change the text color now, too, which is the last thing I needed to fix... I'll try that out tomorrow. (:
u wot m8
- fluxus
- Regular
- Posts: 133
- Joined: Thu Jun 19, 2014 8:06 am
- Projects: Animal Anaesthesia (a teaching game)
- Contact:
Re: UPDATE: Broke Ren'py with screens and styles. ):
xela: Ah.. so that's how you're supposed to use it. It makes more sense now. I think ^.^
- YamiiDenryuu
- Newbie
- Posts: 9
- Joined: Sun Mar 23, 2014 11:07 pm
- Projects: meduka meguca: the loop of infinity
- Contact:
Re: UPDATE: Broke Ren'py with screens and styles. ):
Could I make it start with the theme I'm using for the rest of the game (Diamond/Dreamscape) instead of default? That'd go a long way towards making it match the rest of the game and not look like poo.
Incidentally, I should probably open another thread asking for tips on organizing my code, especially the initial stuff (character declarations, variables, etc). I don't know what goes in an init block, what goes after label start and what just kinda hangs out there. :/
u wot m8
- fluxus
- Regular
- Posts: 133
- Joined: Thu Jun 19, 2014 8:06 am
- Projects: Animal Anaesthesia (a teaching game)
- Contact:
Re: Continuing to need help with screens and styles
I haven't really learned how to do things with styles as yet.
One way to costumize the textbox, though, is to draw a graphical frame (with pretty borders) and make the textbox use that as a background. There's a guide on how to do that here.
As for code organization, init sections are generally where you prepare your data and variables, making them ready to be used by the rest of the game.
Labels are generally code that describes a scene. It's not always true that one scene equals one label, but it's a good way to organize things for the most part.
All code organization is about making the code understandable. For the interpreter (Ren'Py, Python), for yourself, and for others.
If you have a long, complicated section and can see a way to divide it into smaller, more understandable bits, it's a good idea to do so.
One way to costumize the textbox, though, is to draw a graphical frame (with pretty borders) and make the textbox use that as a background. There's a guide on how to do that here.
As for code organization, init sections are generally where you prepare your data and variables, making them ready to be used by the rest of the game.
Labels are generally code that describes a scene. It's not always true that one scene equals one label, but it's a good way to organize things for the most part.
All code organization is about making the code understandable. For the interpreter (Ren'Py, Python), for yourself, and for others.
If you have a long, complicated section and can see a way to divide it into smaller, more understandable bits, it's a good idea to do so.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Draida