Page 1 of 1
Creating a text displayable in a Pythonblock
Posted: Mon Oct 17, 2016 11:21 am
by kampmichi
I want to display and animate both a string and an icon whenever I gain an increase in a stat.
I figured out how to do the icon.
Code: Select all
image g_ame4 = "game.png"
init python:
some_function:
renpy.show("g_ame4",at_list=[metal_gear] , layer="extra", what=None, zorder=9001, tag=None, behind=[])
this works, metal_gear is the name of a transform.
the problem comes with the string because it should display the nummber the stat increases.
and I don't know how to make that a displayable.
I think this might be relevant:
https://www.renpy.org/doc/html/text.html#Text
But I can't get it to work...
Re: Creating a text displayable in a Pythonblock
Posted: Wed Oct 19, 2016 1:56 am
by Kia
I suggest using screen language instead, it's ideal for showing stats and animation
https://www.renpy.org/doc/html/screens.html
Re: Creating a text displayable in a Pythonblock
Posted: Wed Oct 19, 2016 12:50 pm
by kampmichi
I need a function to signal the start of the animation and as far as I know the screenlanguage doesn't allow me to do that...
What I want to do is this:
You press a button
that starts a few thing in the background
and every 0.4 - 0.6 sec you get a stat increase.
Each time that happens the amount of the increase get's displayed
like: +5 [str_icon]
and that display moves upwards and than vanishes.
Re: Creating a text displayable in a Pythonblock
Posted: Wed Oct 19, 2016 12:56 pm
by Kia
I'm not sure what are you trying to do but I think screen can handle that as well, in other hand if your code is already working in python you can pass the variables to the screen and only use the screen to show the result
Re: Creating a text displayable in a Pythonblock
Posted: Wed Oct 19, 2016 2:46 pm
by kampmichi
I could create a displayable in the screan language but how do I apply a transformation to it from the outside?
The thing is... the animation shouldn't trigger on hover or a buttonpress but when another function says it should.
I don't know how to do that.
on the other hand I know how to use the show statement in a python block and you can give it a transform in that.
the only thing I am missing is how to make a text displayable
https://www.renpy.org/doc/html/text.htm ... splayables
that section should describe it as stated above the problem is that I can't get it to work ... and there is no example that helps
I don't want to give up just yet and restructure things just because I can't understand the documentation or an error in it.
...
There has to be a way to make sense of this!
renpy.ParameterizedText(style='default', **properties)
This is a displayable that can be shown with an additional string parameter, which then shows that string as if it was an image. This is usually used as part of the pre-defined text image.
For example, one can do:
Code: Select all
show text "Hello, World" at truecenter
with dissolve
pause 1
hide text
with dissolve
You can use ParameterizedText directly to define similar images with different style properties. For example, one can write:
Code: Select all
image top_text = ParameterizedText(xalign=0.5, yalign=0.0)
Re: Creating a text displayable in a Pythonblock
Posted: Wed Oct 19, 2016 3:23 pm
by Kia
you can feed values to your transforms and you can find a good example here:
viewtopic.php?f=8&t=40777
all you have to do is set up few variables and pass them to your screen to use as both text value and transfer value.