Cancel button with imagemaps

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
kostek00
Regular
Posts: 131
Joined: Wed Mar 28, 2018 5:54 pm
Contact:

Cancel button with imagemaps

#1 Post by kostek00 »

I know how to do confirm button for options "hotspot (x,x,x,x) action Return()" but how do I make cancel button for options that will discard changes? Is it "action Return(value=None)" or is there completely different action for that?

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2404
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Cancel button with imagemaps

#2 Post by Ocelot »

Do either Return(True) for confirmation or Return(False) for canceling. In calling code inspect returned value and act accordingly.
< < insert Rick Cook quote here > >

User avatar
kostek00
Regular
Posts: 131
Joined: Wed Mar 28, 2018 5:54 pm
Contact:

Re: Cancel button with imagemaps

#3 Post by kostek00 »

Thanks.

User avatar
kostek00
Regular
Posts: 131
Joined: Wed Mar 28, 2018 5:54 pm
Contact:

Re: Cancel button with imagemaps

#4 Post by kostek00 »

I checked this and it's actually not working. Both buttons works like OK. What's more after pressing them they start new game instead of returning to previous menu or to game. I'm pretty sure I'm missing something but what?

P.S. Noob here.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Cancel button with imagemaps

#5 Post by kivik »

Did you call the screen instead of showing it?

Code: Select all

call screen my_screen
if _return:
    # do stuff
"resume game here"

User avatar
kostek00
Regular
Posts: 131
Joined: Wed Mar 28, 2018 5:54 pm
Contact:

Re: Cancel button with imagemaps

#6 Post by kostek00 »

I didn't. This is my options menu where I want it to use:

Code: Select all

screen options:
    tag menu
    add "gui/menu_ground.png"

    imagemap:
        ground "gui/options_ground.png"
        idle "gui/options_idle.png"
        hover "gui/options_hover.png"
        selected_idle "gui/options_selected_idle.png"
        selected_hover "gui/options_selected_hover.png"

        alpha False

        hotspot(75,151,93,32) action Preference("display", "window")
        hotspot(194,151,130,32) action Preference("display", "fullscreen")
        hotspot(68,271,132,32) action Preference("skip", "seen")
        hotspot(228,271,103,32) action Preference("skip", "all")
        hotspot(573,113,38,32) action Preference("music mute", "disable")
        hotspot(624,113,49,32) action Preference("music mute", "enable")
        hotspot(573,233,38,32) action Preference("sound mute", "disable")
        hotspot(624,233,49,32) action Preference("sound mute", "enable")
        hotspot(685,233,51,32) action Play("sound","sound/SE002.ogg")
        hotspot(573,353,38,32) action Preference("voice mute", "disable")
        hotspot(624,353,49,32) action Preference("voice mute", "enable")
        hotspot(685,353,51,32) action Play("voice","voice/nana0213.ogg")
        hotspot(456,489,137,40) action Return(True)
        hotspot(648,489,100,40) action Return(False)
I honestly don't know where to bite it.

Post Reply

Who is online

Users browsing this forum: Google [Bot]