Problem with button

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
tosmate
Newbie
Posts: 1
Joined: Fri Jan 19, 2018 5:18 pm
Contact:

Problem with button

#1 Post by tosmate »

I'm trying to make a button to open a screen:

Code: Select all

screen phoneOptions: 
    imagemap:
        ground "mapa1.png"
            hover "mapa2.png"

     hotspot (553, 285, 194, 194) action Return("house") 
and this is the button:

Code: Select all

init python: 
    def phoneButton():
        if phoneButton == True:
            ui.imagebutton("Phone.png", clicked = action Show ("phoneOptions"), xpos=1051, ypos= 411)
    
    config.overlay_functions.append(phoneButton)
shows me this error :
error.JPG

Can someone help me? i don't know what to do, i searched all over the internet and didn't find anything :( .

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Problem with button

#2 Post by Alex »

Try something like this

Code: Select all

screen phoneButton():
    imagebutton:
        idle "Phone.png"
        hover "Phone.png"
        action Show ("phoneOptions")
        pos (1051, 411)

screen phoneOptions(): 
    imagemap:
        ground "mapa1.png"
        hover "mapa2.png"
        hotspot (553, 285, 194, 194) action Return("house")

label start:
    "..."
    show screen phoneButton # the phone button should appear onscreen
    "?"

https://www.renpy.org/doc/html/index.html

https://www.renpy.org/doc/html/screens.html
https://www.renpy.org/doc/html/screen_actions.html

Post Reply

Who is online

Users browsing this forum: Google [Bot]