Does something like "renpy.show_text" exists?

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.
Post Reply
Message
Author
jacob_ax
Regular
Posts: 32
Joined: Thu Jan 31, 2019 9:21 am
Contact:

Does something like "renpy.show_text" exists?

#1 Post by jacob_ax »

Hi guys!
I'm trying to make some code like this run in a python function:

Code: Select all

show text "hey this is some new text!!" at truecenter with dissolve
renpy.pause(2)
hide text with dissolve
the thing is that I don't know how to implement the:

Code: Select all

show text "...."
hide text
I've tried this one:

Code: Select all

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?


Thanks for your help :)

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Does something like "renpy.show_text" exists?

#2 Post by Remix »

Code: Select all


    show expression Text("words") as my_text at truecenter

    "..."

    hide my_text
Frameworks & Scriptlets:

jacob_ax
Regular
Posts: 32
Joined: Thu Jan 31, 2019 9:21 am
Contact:

Re: Does something like "renpy.show_text" exists?

#3 Post by jacob_ax »

Remix wrote: Tue May 21, 2019 10:32 am

Code: Select all


    show expression Text("words") as my_text at truecenter

    "..."

    hide my_text
Hi remix, thanks for your answer, but I need to put that code inside a python function. Is there a way to do that?

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Does something like "renpy.show_text" exists?

#4 Post by Remix »

Simplest way then is probably to create a screen and pass the string as a parameter, much like renpy.notify does

... or just use renpy.notify and tweak it to your needs...
Frameworks & Scriptlets:

strayerror
Regular
Posts: 159
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: Does something like "renpy.show_text" exists?

#5 Post by strayerror »

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]

Code: Select all

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

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Majestic-12 [Bot], piinkpuddiin