Cursor change when dialogue ends?

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
ourdecemberdreams
Regular
Posts: 58
Joined: Sat Apr 15, 2017 3:26 pm
Projects: The Last December
Tumblr: ourdecemberdreams
Deviantart: ourdecemberdreams
itch: ourdecemberdreams
Contact:

Cursor change when dialogue ends?

#1 Post 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.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Cursor change when dialogue ends?

#2 Post 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.
Frameworks & Scriptlets:

ourdecemberdreams
Regular
Posts: 58
Joined: Sat Apr 15, 2017 3:26 pm
Projects: The Last December
Tumblr: ourdecemberdreams
Deviantart: ourdecemberdreams
itch: ourdecemberdreams
Contact:

Re: Cursor change when dialogue ends?

#3 Post 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?

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Cursor change when dialogue ends?

#4 Post 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.
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: Google [Bot]