button jumps to where I want but hotspot doesn't. [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
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

button jumps to where I want but hotspot doesn't. [solved]

#1 Post by namastaii »

It's strange because if I choose to use a button to jump to a scene or call in a screen, it has no problem doing so. But if I'm using a hotspot action to jump or call something, it just returns to the previous scene no matter what.. Is there something I'm missing?

Code: Select all

hotspot (37, 685, 285, 50) action Jump("this_label")
or

Code: Select all

hotspot (37, 685, 285, 50) action ui.callsinnewcontext("this_screen_label")
Neither of these are working for me. I'm not sure why..
Last edited by namastaii on Sun Jan 31, 2016 5:53 pm, edited 1 time in total.

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: button jumps to where I want but hotspot doesn't.

#2 Post by PyTom »

What does the target label look like?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: button jumps to where I want but hotspot doesn't.

#3 Post by namastaii »

Okay so the label used to jump straight to the screen (or that's what I wanted it to do anyway) but now I added a transition because I want one anyway and I was hoping it'd fix the problem too somehow but it didn't. Let me first just say that for whatever reason, this specific screen and the hotspots are being kind of weird. They aren't overlapping or anything but I mean, I had some of the hotspots working to where I could hover and click them and now only like one hotspot remains clickable haha I have no idea what I could have done, it just happened instantly with each hotspot every time. I guess I'll just show you the process in order.

Code: Select all

screen myface_home:
    
    
    imagemap:
        alpha False
        cache False
        ground "computer/myface/myface_home.png"
        hover "computer/myface/myface_home_hover.png"
        
        hotspot (37, 210, 274, 280) action Jump("testing_screen") #ignore this
        
        
        
        hotspot (37, 623, 285, 50) action Jump("testing_screen") activate_sound "sounds/click1.mp3" #ignore this
        hotspot (37, 685, 285, 50) action Jump("myface_logout_label") activate_sound "sounds/click1.mp3" #this is the problem I'm looking at now
I have also tried:

Code: Select all

hotspot (37, 685, 285, 50) action ui.callsinnewcontext("myface_logout_label") activate_sound "sounds/click1.mp3"
Only buttons seem to get me where I need with my screens for this. but anyway..

Code: Select all

label myface_logout_label:
    call screen myface_logout
    return
calls this screen:

Code: Select all

screen myface_logout:
    add "animate_myface_logout"
    timer 1.5 action ui.callsinnewcontext("myface_signup_label")
Then calls in this screen after 1.5 seconds:

Code: Select all

screen myface_signup:
    
    
    imagemap:
        alpha False
        cache False
        ground "computer/myface/myface_welcome.png"
        if username == " ":
            hbox xpos 568 ypos 370:
            
                button:
                    id "username_input"
                    xysize (250, 25)
                    action NullAction()
                    #hover_sound "sounds/writing2.mp3"
                
        
                    add Input(font="Mecha.ttf", size=30, color="#000", default=username, changed=username_func, length=14, button=renpy.get_widget("name_input", "username_input")) yalign 1.0
            
            
            imagebutton:
                xpos 700 ypos 500
                idle "computer/myface/signup_button.png"
                hover "computer/myface/signup_button_hover.png"
                action Jump("myface_load_label")
                activate_sound "sounds/click1.mp3"
        else:
            
            hbox xpos 580 ypos 375:
                text "{color=#000}{size=30}{font=Mecha.ttf}[username]" 
            
            #imagebutton:
                #xpos 700 ypos 500
                #idle "computer/myface/signup_button.png"
                #hover "computer/myface/signup_button_hover.png"
                #action Jump("myface_load_label")
                #activate_sound "sounds/click1.mp3"
            textbutton "log in" action ui.callsinnewcontext("myface_home_label") xpos 568 ypos 420
Sorry, it's kind of an unorganized mess right now but you get the idea.

I know that this order of operation works because I have it elsewhere (with buttons) and it works fine.
for example:

Code: Select all

label browser:
    #scene bg browser
    hide screen mini_phone
    show screen browser
    
    d "la la la"

Code: Select all

screen browser:
    
    imagemap:
        ground "computer/browser.png"
        alpha False
        cache False
        if account == True:
            textbutton "MyFace.com" action ui.callsinnewcontext("myface_home_label") style "link_button"
        else:
            textbutton "MyFace.com sign up" action ui.callsinnewcontext("myface_signup_label") style "link_button"
        #hotspot (1270,0,10,10) action Close()
        #imagebutton:
            
            #idle "computer/exit_button.png"
            #hover "computer/exit_button_hover.png" 
            #action Return

Code: Select all

screen myface_signup:
    
    
    imagemap:
        alpha False
        cache False
        ground "computer/myface/myface_welcome.png"
        if username == " ":
            hbox xpos 568 ypos 370:
            
                button:
                    id "username_input"
                    xysize (250, 25)
                    action NullAction()
                    #hover_sound "sounds/writing2.mp3"
                
        
                    add Input(font="Mecha.ttf", size=30, color="#000", default=username, changed=username_func, length=14, button=renpy.get_widget("name_input", "username_input")) yalign 1.0
            
            
            imagebutton:
                xpos 700 ypos 500
                idle "computer/myface/signup_button.png"
                hover "computer/myface/signup_button_hover.png"
                action Jump("myface_load_label")
                activate_sound "sounds/click1.mp3"
        else:
            
            hbox xpos 580 ypos 375:
                text "{color=#000}{size=30}{font=Mecha.ttf}[username]" 
            
            #imagebutton:
                #xpos 700 ypos 500
                #idle "computer/myface/signup_button.png"
                #hover "computer/myface/signup_button_hover.png"
                #action Jump("myface_load_label")
                #activate_sound "sounds/click1.mp3"
            textbutton "log in" action ui.callsinnewcontext("myface_home_label") xpos 568 ypos 420

label myface_signup_label:
    call screen myface_signup
    return

Code: Select all

screen myface_home:
    
    
    imagemap:
        alpha False
        cache False
        ground "computer/myface/myface_home.png"
        hover "computer/myface/myface_home_hover.png"
        
        hotspot (37, 210, 274, 280) action Jump("testing_screen")
        
        #hotspot (37, 555, 285, 50) action Jump("testing_screen")
        
        hotspot (37, 623, 285, 50) action Jump("testing_screen") activate_sound "sounds/click1.mp3"
        hotspot (37, 685, 285, 50) action Jump("myface_logout_label") activate_sound "sounds/click1.mp3"
        
        
        textbutton "[username]" xpos 37 ypos 100
        
        if profile_pic_choice == 0:
            #add "computer/myface/profile_background/choose_photo.png" #xpos 50 ypos 225
            add "profile_pic_1" xpos 50 ypos 225
                
        if profile_pic_choice == 1:
            add "profile_pic_1" xpos 50 ypos 225
        if profile_pic_choice == 2:
            add "profile_pic_2" xpos 50 ypos 225
        #textbutton "[username]" #style "user_button" xpos 1000 ypos 129 #action Show("drop_down_menu")
        #textbutton "Messages" 
        hbox xpos 491 ypos 76:
            text "[username]" font "Euphemia.ttf" color "000" size 24
        
label myface_home_label:
    call screen myface_home
^ and then I started using hotspots and it doesn't work. So I guess I must be missing something lol

*edit: and what happens when I click the hotspot to 'logout' is that it just closes all screens and takes me back to my scene, which in this case would be the testing page I set up that has a menu of routes to take to edit and test.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: button jumps to where I want but hotspot doesn't.

#4 Post by namastaii »

I don't know if it'll make a difference but I do need to update to the latest version, so I'll do that.

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: button jumps to where I want but hotspot doesn't.

#5 Post by namastaii »

Honestly, I think it's because I'm using that hotspot tool. I'm not sure if it's because my images and game are sized a certain way but the hotspot coordinates are off. So it could be clicking on the wrong hotspot.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]