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.
init python:
my_text = "some random text" + a_variable_string
renpy.show("my_text", what=my_text) #not really sure how it works, it's definetly wrong. Also I don't know how to use "with dissolve" here
renpy.pause(2)
renpy.hide("my_text")
The problem here is that it appears the "Elaine/missing image" image with the string my_text inside. How can I solve this?
It's unclear if you expect to be able to continue dialogue as this displays, for this I'm assuming not since your initial example makes use of pause. This is (more or less) the python version of the one-liner Remix gave. [edit]However the suggestion to use notify is potentially much more suitable depending on what you're aiming to do.[/edit]
init python:
def foo(a_variable_string):
# build message
my_text = 'some random text: ' + a_variable_string
# define the displayable, tag it, position it and queue it for showing
renpy.show('my_text', what=Text(my_text), at_list=(truecenter,))
# Tell the show to use dissolve
renpy.with_statement(dissolve)
renpy.pause(2)
renpy.hide('my_text')
# if you don't want fade out, remove the line below
renpy.with_statement(dissolve)
label start:
pause 1
$ foo('hello world')
pause
return