Page 1 of 1

Cursor change when dialogue ends?

Posted: Mon Mar 19, 2018 1:49 am
by ourdecemberdreams
Hi, I'm looking to have my game cursor change into an arrow when the dialogue finishes, so as to prompt the user to click for the next line, same concept as ctc, but instead of it displaying in the textbox, I want it to display as my mouse instead. I've put together some codes I found from around the forum, but it wouldn't work. Any help will be appreciated!

Code: Select all

init 1 python:
    def change_cursor(type="default"):
        persistent.mouse = type
        if type == "default":
            setattr(config, "mouse", None)
        elif type == "1":
            setattr(config, "mouse", {"default": [("gui/mouse_default.png", 0, 0)]})
        elif type == "2":
            setattr(config, "mouse", {"default": [("gui/mouse_click.png", 0, 0)]})
            
    if not hasattr(persistent, "mouse"):
        change_cursor()
    else:
        change_cursor(persistent.mouse)
        

init -2:
    image mouse_change:
        $ change_cursor("1")
        
        
        
define dee = Character("Dee", window_background="gui/textbox_dee.png", ctc= "mouse_change")

This code would give me an error, pointing to the following line:

Code: Select all

$ change_cursor("1")
stating that:

Code: Select all

expected 'comma or end of line' not found.

Re: Cursor change when dialogue ends?

Posted: Mon Mar 19, 2018 8:52 am
by Remix

Code: Select all

init python:   
    config.mouse = {
        # default cursor
        'default' : [("gui/mouse_default.png", 0, 0)],

        # default say cursor
        'say' : [("gui/mouse_click.png", 0, 0)],

        # cursor based on character.mode
        'dee' : [("gui/mouse_click_dee_only.png", 0, 0)]
    }
   
define dee = Character("Dee", window_background="gui/textbox_dee.png", mode="dee")
Note though that these swap at the recognized mode and not just at the end, so the cursor would show from the beginning of a dialogue and not just at end.
Hope it helps anyway.

Re: Cursor change when dialogue ends?

Posted: Tue Mar 20, 2018 7:26 am
by ourdecemberdreams
Remix wrote: Mon Mar 19, 2018 8:52 am

Code: Select all

init python:   
    config.mouse = {
        # default cursor
        'default' : [("gui/mouse_default.png", 0, 0)],

        # default say cursor
        'say' : [("gui/mouse_click.png", 0, 0)],

        # cursor based on character.mode
        'dee' : [("gui/mouse_click_dee_only.png", 0, 0)]
    }
   
define dee = Character("Dee", window_background="gui/textbox_dee.png", mode="dee")
Note though that these swap at the recognized mode and not just at the end, so the cursor would show from the beginning of a dialogue and not just at end.
Hope it helps anyway.
I've tried the code out, but I'm not sure what does the 'dee' mode cursor do? Nothing changes. And also, one problem for this code will be if I use an arrow for the 'say' cursor, it will look weird when the user hover over on the quick menus, any idea how to solve that?

Re: Cursor change when dialogue ends?

Posted: Tue Mar 20, 2018 7:18 pm
by Remix
The 'dee' cursor was an example for if you wanted different cursors for different characters... setting mode="dee" in the character definition should (untested) switch to that mode when that character speaks and thus change the cursor due to it being set in config.mouse.

I've never used cursor changes myself, so cannot really advise any further.