Have text show with imagebutton click?

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
renpyhelp
Regular
Posts: 71
Joined: Tue Feb 27, 2018 2:01 am
Contact:

Have text show with imagebutton click?

#1 Post by renpyhelp »

I'd like some small text to show up when clicking on an image button. Sounds simple enough, but I can't figure it out.

something simple as:

p "I can't do that right now."

ReDZiX
Regular
Posts: 32
Joined: Thu Jan 04, 2018 12:42 pm
Contact:

Re: Have text show with imagebutton click?

#2 Post by ReDZiX »

You can use Notify screen action.

Code: Select all

imagebutton idle "button.png":
    action Notify("I can't do that right now.")

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Have text show with imagebutton click?

#3 Post by Imperf3kt »

I'd do it differently. "I can't do that right now" doesn't really belong in a notify window, but a say window, unless its an information blurb.

In any case, here's one way to do it.

Try this:

Code: Select all

screen my_button():
    modal False
    hbox:
        xpos #
        ypos #

        imagebutton blah blah action Call("beam_me_up_scottie")


label start:
    e "I'm talking"
    show screen my_button


    return

label beam_me_up_scottie:
    P "I can't do that right now."
    return
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Have text show with imagebutton click?

#4 Post by Milkymalk »

Agreed. Notify should be used for system messages, like "screenshot taken" or "quicksave done".
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

renpyhelp
Regular
Posts: 71
Joined: Tue Feb 27, 2018 2:01 am
Contact:

Re: Have text show with imagebutton click?

#5 Post by renpyhelp »

That was some big help! But I do have a problem... The last "scene" picture I used takes place of the screen and imagebuttons oddly enough. I don't really know how to avoid that. Once I hit enter to pass the text I put in, it goes back to the screen, but I can't have it work unless I specifically tell it to show the screen image and imagebutton image within the label.

Hope that makes sense.

ReDZiX
Regular
Posts: 32
Joined: Thu Jan 04, 2018 12:42 pm
Contact:

Re: Have text show with imagebutton click?

#6 Post by ReDZiX »

My apologies, when you said small text I misunderstood thinking you wanted to show a small information blurb, didn't realize you wanted a dialogue window, even though I should have, thank you Milkymalk and Imperfekt I completely agree, again I'm really sorry :oops: .

Post Reply

Who is online

Users browsing this forum: Sugar_and_rice