Roll back after right click?

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
thelastsecret
Regular
Posts: 117
Joined: Tue Mar 01, 2022 1:32 pm
Completed: The Last Secret
Projects: Sweet Science – The Girls from Silversee Castle
itch: thelastsecret
Discord: TheLastSecret #5266
Contact:

Roll back after right click?

#1 Post by thelastsecret »

Right click be default shows the menu. That confused several test players (all VN beginners) a lot. I therefore took that out by removing it from the keymap with
$ config.keymap['game_menu'].remove('mouseup_3').
Now I got the request that right click should roll back one line. That also makes sense, but I am afraid that it will also lead to confusion. My amount of newbies for test playing is exhausted, so I just wanted to know if you have any experiences with that?
Moreover: how would I set this up? The obvious method of activating a screen that has
key 'mouseup_3' action Rollback()
did not work: it still goes to the menu then!

(Solved that part: the screen must be opened after start, not already at init.)

Thanks in advance for your help!

laure44
Regular
Posts: 84
Joined: Mon Mar 08, 2021 10:55 pm
Projects: Arkan'sTower, Gemshine Lorelei!
Location: France
Contact:

Re: Roll back after right click?

#2 Post by laure44 »

I suppose you could give your players the choice to configure the interaction themselves, through a persistent variable, in the preferences screen. For example, they could choose between:
- show pause menu
- perform a rollback
- do nothing at all

Now, I'm no expert on keymaps, but I've done some testing and this solution seems to work (but it requires a restart of the game for the setting to take effect)

In an init python block:

Code: Select all

init python:

    def pref_update_rightclick():
        List = [ "game_menu", "rollback" ]
        for i in List:
            if 'mouseup_3' in config.keymap[i]:
                config.keymap[i].remove('mouseup_3')
            if i == persistent.preferences_rightclick:
                config.keymap[i].append('mouseup_3')

    if not persistent.preferences_rightclick:
        persistent.preferences_rightclick = "game_menu"
    pref_update_rightclick()
And in your preferences screen:

Code: Select all

vbox:
    style_prefix "radio"
    label _("Action on right click")
    textbutton _("Pause menu") action SetVariable("persistent.preferences_rightclick", "game_menu")
    textbutton _("Roll back") action SetVariable("persistent.preferences_rightclick", "rollback")
    textbutton _("None") action SetVariable("persistent.preferences_rightclick", "none")
There might be better ways to do it though, but I hope it will help.

Post Reply

Who is online

Users browsing this forum: Google [Bot]