Text in custom displayables
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.
Text in custom displayables
I want to add a text object to the custom displayable I'm writing; but can't find an example to work from. Adding images is simple enough, using the example in the manual, but I'm foxed at trying to add text. Using renpy.displayable() seems to require the displayable to be registered in renpy, and that's not going to be feasible. I swear I found a way to draw to a screen directly one time, but I can't find an example anywhere.
Re: Text in custom displayables
At what time is is appropriate to say "WTF"?
I've thrown a clearcut example of that at you just a day or two ago: http://lemmasoft.renai.us/forums/viewto ... xt#p407163
I've thrown a clearcut example of that at you just a day or two ago: http://lemmasoft.renai.us/forums/viewto ... xt#p407163
Re: Text in custom displayables
None of that is usage within a custom Displayable object. Surely nothing involving a show method is applicable? What I think I need is the pure python invocation of creating a text object, but that's what I can't find any documentation of.
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
...
File "game/battle.rpy", line 34, in render
name=Text(chars_name[self.index]) # No
...
NameError: global name 'Text' is not defined
Re: Text in custom displayables
Can you show the code where such an absurdity occurs?
Text is bound in Ren'Py's store to a renpy.text.text.Text. There is nothing you can do to delete it from global namespace except of explicitly unbind the binding by del Text. This error:
==>
Meaning that I can write a UDD for you that uses the Text binding from global namespace directly that will work with ANY fresh Ren'Py project for which Text was introduced many years ago.
Text is bound in Ren'Py's store to a renpy.text.text.Text. There is nothing you can do to delete it from global namespace except of explicitly unbind the binding by del Text. This error:
is one of the last errors I'd expect from the engineNameError: global name 'Text' is not defined
==>
Meaning that I can write a UDD for you that uses the Text binding from global namespace directly that will work with ANY fresh Ren'Py project for which Text was introduced many years ago.
Re: Text in custom displayables
It's inside the render() method of a class extending Displayable; so bare renpy directives didn't work.
worked perfectly, however! Many thanks.
And now I can put the instantiation somewhere more sensible and just put the rendering portion in the render method. I still feel like there should be a more elegant way of handling it, grabbing the code that renders text directly rather than creating a child object, but that'll do for now.
Code: Select all
def render(self, width, height, st, at):
child_render=renpy.render(self.child, width, height, st, at)
self.width, self.height = child_render.get_size()
self.width+=40
self.height+=40
name=renpy.text.text.Text(chars_name[self.index])
render = renpy.Render(self.width, self.height)
render.blit(child_render, (20,20))
render.blit(renpy.render(name,self.width,height, st ,at),(0,0),False)
return render
And now I can put the instantiation somewhere more sensible and just put the rendering portion in the render method. I still feel like there should be a more elegant way of handling it, grabbing the code that renders text directly rather than creating a child object, but that'll do for now.
Re: Text in custom displayables
From .rpy file, it should work (in most cases) but as long as you got it to fly, I don't expect any further issues
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot]