How to make if statement out of screen? [solved]

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
Spoons
Newbie
Posts: 10
Joined: Tue Nov 13, 2018 4:39 am
Contact:

How to make if statement out of screen? [solved]

#1 Post by Spoons »

I'm very new to Ren'Py, but became hooked on it when I played an interactive game and wanted to dabble in it myself.

Code: Select all

screen phone_look:
    imagemap:
        auto "imagemap_%s.png"
        hotspot(592,339,46,36,) action Jump("phone_lookat")
How do I make an if statement out of this? (So; if player has clicked the image/hotspot > jump to a label else do nothing if the player just clicks anywhere other than the hotspot.)

I've read online about it, but all the examples I've found are very outdated.

Thank you.


Edit: I managed to figure it out randomly (Not sure if it's correct, but it works so i'll leave it here if anyone else has the same issue.)

Code: Select all

call screen phone_look

screen phone_look:
    imagemap:
        auto "imagemap_%s.png"
        hotspot(595, 417, 76, 40) action Return("phone")


$ result = _return

if result == "phone":
    jump phone_lookat
else:
    "Nope"

Post Reply

Who is online

Users browsing this forum: Google [Bot]