Page 1 of 1

[SOLVED] Help With Imagebuttons

Posted: Tue Sep 19, 2017 1:16 am
by Braydxne
So I've decided to try and go for a more point n' click approach with my game, however the issue I'm having currently is this.

Code: Select all

label classexploration:
    $camera_move(0, 0, 0, 0, duration=0.35)
    $ change_cursor("1")
    hide window
    
    show screen interact1
    
    
screen interact1:
    if not checked_window:
        imagebutton:
            focus_mask True
            xpos 0 ypos 0
            idle "Interact1Window.png"
            hover "Interact1Window.png"
            action [SetVariable("checked_window", True), Hide("interact1"), Jump("window")] 
            hovered change_cursor("2")
            unhovered change_cursor("1")
                
            
label window:
    
    cothink "Why the hell is it {color=#fff200}boarded up{/color}?"
        
    jump classexploration
It seems to not wait for the window to be clicked and keeps jumping from the window label to classroomexploration. I'm not quite sure what's causing this.

Re: Help With Imagebuttons

Posted: Tue Sep 19, 2017 1:24 am
by Divona
See Call Screen.

Code: Select all

    call screen interact1

Re: Help With Imagebuttons

Posted: Tue Sep 19, 2017 10:43 am
by Braydxne
Divona wrote:
Tue Sep 19, 2017 1:24 am
See Call Screen.

Code: Select all

    call screen interact1
Thank you again! It really helps ^^

Re: Help With Imagebuttons

Posted: Tue Sep 19, 2017 10:46 am
by Braydxne
While we're at it... how would I go about changing the mouse cursor when hovering over the imagebutton? I tried one method I found on the forums but it didn't work...

Re: Help With Imagebuttons

Posted: Tue Sep 19, 2017 1:12 pm
by xela

Code: Select all

hovered SetField(config, "mouse", {"default": [(cursor, xoff, yoff)]}) # Where cursor is a path to an image, xoff and yoff offsets to place it correctly.
unhovered SetField(config, "mouse", None)

Re: Help With Imagebuttons

Posted: Tue Sep 19, 2017 7:03 pm
by Braydxne
xela wrote:
Tue Sep 19, 2017 1:12 pm

Code: Select all

hovered SetField(config, "mouse", {"default": [(cursor, xoff, yoff)]}) # Where cursor is a path to an image, xoff and yoff offsets to place it correctly.
unhovered SetField(config, "mouse", None)
Thank you so much! That's perfect! ^^ I have one final question concerning the mouse cursor, how would I go about changing it when the menu appears. I only care because if you pause while doing an investigation the cursor remains the big magnifying glass which is interesting to say the least. Thank you again for your help!

Re: Help With Imagebuttons

Posted: Tue Sep 19, 2017 11:00 pm
by Divona
Braydxne wrote:
Tue Sep 19, 2017 7:03 pm
how would I go about changing it when the menu appears. I only care because if you pause while doing an investigation the cursor remains the big magnifying glass which is interesting to say the least. Thank you again for your help!
screens.rpy

Code: Select all

screen game_menu(title, scroll=None):

    style_prefix "game_menu"

    on "show" action SetField(config, "mouse", None)
    
    . . .

Re: Help With Imagebuttons

Posted: Tue Sep 19, 2017 11:19 pm
by Braydxne
Divona wrote:
Tue Sep 19, 2017 11:00 pm
Braydxne wrote:
Tue Sep 19, 2017 7:03 pm
how would I go about changing it when the menu appears. I only care because if you pause while doing an investigation the cursor remains the big magnifying glass which is interesting to say the least. Thank you again for your help!
screens.rpy

Code: Select all

screen game_menu(title, scroll=None):

    style_prefix "game_menu"

    on "show" action SetField(config, "mouse", None)
    
    . . .
Thank you so much! You've been a big help! I'm grateful you took the time to tell me the code.

Re: Help With Imagebuttons

Posted: Tue Sep 19, 2017 11:33 pm
by Braydxne
Braydxne wrote:
Tue Sep 19, 2017 11:19 pm
Divona wrote:
Tue Sep 19, 2017 11:00 pm
Braydxne wrote:
Tue Sep 19, 2017 7:03 pm
how would I go about changing it when the menu appears. I only care because if you pause while doing an investigation the cursor remains the big magnifying glass which is interesting to say the least. Thank you again for your help!
screens.rpy

Code: Select all

screen game_menu(title, scroll=None):

    style_prefix "game_menu"

    on "show" action SetField(config, "mouse", None)
    
    . . .
Thank you so much! You've been a big help! I'm grateful you took the time to tell me the code.
Although the code doesn't appear to be working when put in screens.rpy. Is there a specific place I should put it? I put it near the top and it didn't work. It doesn't crash or anything it just doesn't change the mouse.

Re: Help With Imagebuttons

Posted: Wed Sep 20, 2017 12:07 am
by Imperf3kt

Code: Select all

screen game_menu(title, scroll=None):

    style_prefix "game_menu"
These lines already exist in screens.rpy
If you use Editra, hold CTRL and press F
Start typing one of the lines, it will find it.

Now paste the rest below that.

Re: Help With Imagebuttons

Posted: Wed Sep 20, 2017 6:46 pm
by Braydxne
Imperf3kt wrote:
Wed Sep 20, 2017 12:07 am

Code: Select all

screen game_menu(title, scroll=None):

    style_prefix "game_menu"
These lines already exist in screens.rpy
If you use Editra, hold CTRL and press F
Start typing one of the lines, it will find it.

Now paste the rest below that.
Ahhh.. Okay! Thank you for clarifying!