imagebuttons display text for map?

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
User avatar
jonharker
Newbie
Posts: 4
Joined: Fri May 13, 2022 4:36 pm
Projects: STATION 040
IRC Nick: kiliant
Tumblr: kiliant
Discord: kiliant#9923

imagebuttons display text for map?

#1 Post by jonharker »

hello! new to renpy and I'm making a visual novel. right now I'm trying to get this type of effect: https://youtu.be/uU6n9Am91P4?t=18 (warning for spookiness) so I can have the player explore certain areas. specifically the clicking on an item and having it display text or setting an event into action. (not the zoom in part tho, lol)
ive been trying to use image buttons that display text in the textbox but I cant seem to figure it out! it just gives me various errors or simply does not work.

here is my code right now, but I doubt its right:

Code: Select all

label truckstart:
    call screen truckcenter
    "It's your truck camper, in all its 8 am glory."

label kitchen:
    scene truck kitchen
    "It's a small kitchen. It smells like coffee and alcohol."
    call screen truckkitchen
label booth:
    scene truck booth
    "It's a booth like seat with a table."

Code: Select all

screen truckcenter():
    add "truck center"
    tag truckcenter
    imagebutton:
        xpos 0
        ypos 0
        unhovered "truckbooth_idle"
        hover "truckbooth_hover"
        action Jump ("booth")

screen truckbooth():
    add "truck booth"
    tag truckbooth
    imagebutton:
        xpos 0
        ypos 0
        unhovered "boothmap_idle"
        hover "boothmap_hover"
        action Jump ("kitchen")

User avatar
niho
Newbie
Posts: 21
Joined: Fri Apr 15, 2022 11:31 pm
itch: nihomi
Discord: niho#0953
Contact:

Re: imagebuttons display text for map?

#2 Post by niho »

It's a bit difficult to know what the exact issue is without the full traceback but at first glance it's probably a syntax error. See if this works:

Code: Select all

screen truckcenter():
    add "truck center"
    tag truckcenter
    imagebutton:
        xpos 0
        ypos 0
        idle "truckbooth_idle"
        hover "truckbooth_hover"
        action Jump ("booth")
Also note that you'll never see "It's your truck camper, in all its 8 am glory" because RenPy won't move onto the next line until the player interacts with 'truckcenter', which will take them to another label. So either show the screen instead or just put the dialogue before you call the screen. You could also add a return statement to 'booth' and use call instead of jump, so that it will return to 'truckstart' when the interaction is complete.

User avatar
jonharker
Newbie
Posts: 4
Joined: Fri May 13, 2022 4:36 pm
Projects: STATION 040
IRC Nick: kiliant
Tumblr: kiliant
Discord: kiliant#9923

Re: imagebuttons display text for map?

#3 Post by jonharker »

hey tysm! its been working, but i still dont know how to go about having a button display text within the textbox when you click it? they work when i have them jump to a label or to another screen though.

Code: Select all

 screen truckbooth():
    add "truck booth"
    tag truckbooth
    imagebutton:
        xpos 0
        ypos 0
        idle "boothmap_idle"
        hover "boothmap_hover"
        action #display text "Hey!"?????
    return ("truckbooth") 

User avatar
jonharker
Newbie
Posts: 4
Joined: Fri May 13, 2022 4:36 pm
Projects: STATION 040
IRC Nick: kiliant
Tumblr: kiliant
Discord: kiliant#9923

Re: imagebuttons display text for map?

#4 Post by jonharker »

i actually think i got it working! basically I added another label for the imagebutton to jump to:

Code: Select all

 label boothmap:
    "Hey!"
    show truck booth
    call screen truckbooth 
it kept showing a different image though, so i had it show the image that i needed it to and then had it go back to the original screen.

on one hand, i dont want to have to constantly make new labels, but i keep all my scripts very organized anyways LOL.
i am still having issues with having the textbox disappear when i click on something else, and i want it to stay permanent until you click on another imagebutton. i feel like using windowauto/show/hide is the way to go, but im unsure!

User avatar
jonharker
Newbie
Posts: 4
Joined: Fri May 13, 2022 4:36 pm
Projects: STATION 040
IRC Nick: kiliant
Tumblr: kiliant
Discord: kiliant#9923

Re: imagebuttons display text for map?

#5 Post by jonharker »

another update - yeah, using window show was the correct call!

User avatar
niho
Newbie
Posts: 21
Joined: Fri Apr 15, 2022 11:31 pm
itch: nihomi
Discord: niho#0953
Contact:

Re: imagebuttons display text for map?

#6 Post by niho »

Code: Select all

action #display text "Hey!"?????
Just to clarify, this wouldn't work because you can't start a new interaction from within an interaction (aka the screen). Like you said you would have to jump to a new label. I know it can be a bit tedious to create a whole new label for a few lines of dialogue but it does help keep things organized.

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: imagebuttons display text for map?

#7 Post by rayminator »

how they did it this way that they have two images one idle and one hover with image and text combined
Untitled-1.png
Untitled-2.png

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

Re: imagebuttons display text for map?

#8 Post by Imperf3kt »

rayminator wrote: Sun May 15, 2022 11:28 pm how they did it this way that they have two images one idle and one hover with image and text combined

Untitled-1.png
Untitled-2.png
I don't think this is what they're after.

I believe they want an image on screen they can click which first shows some dialogue in the normal say window, then upon mouse click, performs an action.
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
Ocelot
Lemma-Class Veteran
Posts: 2438
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: imagebuttons display text for map?

#9 Post by Ocelot »

niho wrote: Sun May 15, 2022 8:23 pm

Code: Select all

action #display text "Hey!"?????
Just to clarify, this wouldn't work because you can't start a new interaction from within an interaction (aka the screen).
Strictly speaking, you can display dialogue without interaction, like menu does.
< < insert Rick Cook quote here > >

Post Reply

Who is online

Users browsing this forum: Ocelot