[SOLVED] Keymap (CTRL+N) for Toggle_Skip doesn't work :/

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
Pierrou
Regular
Posts: 53
Joined: Fri Dec 05, 2014 8:25 pm
Projects: Togainu no Chi, DMMD, Omerta, ...
Skype: pierrouney
Location: France
Contact:

[SOLVED] Keymap (CTRL+N) for Toggle_Skip doesn't work :/

#1 Post by Pierrou » Tue Jan 27, 2015 6:06 pm

Hi :P (sorry again for my bad english :( )

I'm trying to add a new keymap for the toggle_skip but it doesn't work.

I need to put "CTRL + N".

I added in renpy/display/behavior.py :

Code: Select all

    if part[0] == "ctrl":
        part.pop(0)
        rv += " and (ev.mod & %d)" % pygame.KMOD_CTRL
    else:
        rv += " and not (ev.mod & %d)" % pygame.KMOD_CTRL
And now i can create something like this :

Code: Select all

key "ctrl_K_b" action FileLoad(recent_save_name, confirm=True, page=recent_save_page)
It works fine :)

But if i try to do this :

Code: Select all

    $ config.keymap['toggle_skip'].append('ctrl_K_n')
It doesn't work... Nothing append, no error, ... It just doesn't work...


So, how can i put the "toggle_skip" in an action of a key like key "ctrl_K_n" action toggle_skip() ?

Can you help me please ? Thank you in advance ! :oops:
Last edited by Pierrou on Thu Jan 29, 2015 2:01 am, edited 1 time in total.
Sorry for my english, it's not my native language. :s

philat
Eileen-Class Veteran
Posts: 1853
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Keymap (CTRL+N) for Toggle_Skip doesn't work :/

#2 Post by philat » Wed Jan 28, 2015 6:22 pm

Auto-forward mode and skip are not the same. toggle_skip literally toggles skip on and off -- for practical purposes, unless you're skipping boatloads of text, there wouldn't be much difference between holding down ctrl 3 seconds or pressing it twice to turn it on and off.

Anyway, assuming you're using the quick menu screen, stick this somewhere in it. Or any other screen where you need it, I guess.

Code: Select all

key "ctrl_K_n" action Preference("auto-forward", "toggle")

User avatar
Pierrou
Regular
Posts: 53
Joined: Fri Dec 05, 2014 8:25 pm
Projects: Togainu no Chi, DMMD, Omerta, ...
Skype: pierrouney
Location: France
Contact:

Re: Keymap (CTRL+N) for Toggle_Skip doesn't work :/

#3 Post by Pierrou » Wed Jan 28, 2015 8:43 pm

philat wrote:Auto-forward mode and skip are not the same. toggle_skip literally toggles skip on and off -- for practical purposes, unless you're skipping boatloads of text, there wouldn't be much difference between holding down ctrl 3 seconds or pressing it twice to turn it on and off.

Anyway, assuming you're using the quick menu screen, stick this somewhere in it. Or any other screen where you need it, I guess.

Code: Select all

key "ctrl_K_n" action Preference("auto-forward", "toggle")

I already have a key for auto-forward mode ^^

Code: Select all

    key "a" action Preference("auto-forward", "toggle")
I really need to use the toggle_skip mode ;)
Sorry for my english, it's not my native language. :s

User avatar
PyTom
Ren'Py Creator
Posts: 15893
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: Keymap (CTRL+N) for Toggle_Skip doesn't work :/

#4 Post by PyTom » Wed Jan 28, 2015 9:34 pm

I think the problem is that since ctrl is already skip, once you type ctrl-n, releasing ctrl turns skip off.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

User avatar
Pierrou
Regular
Posts: 53
Joined: Fri Dec 05, 2014 8:25 pm
Projects: Togainu no Chi, DMMD, Omerta, ...
Skype: pierrouney
Location: France
Contact:

Re: Keymap (CTRL+N) for Toggle_Skip doesn't work :/

#5 Post by Pierrou » Wed Jan 28, 2015 9:52 pm

PyTom wrote:I think the problem is that since ctrl is already skip, once you type ctrl-n, releasing ctrl turns skip off.

Oh sorry :oops: i forgot to say i disabled many keymap :oops:

Now "skip" os on "shift" key

Code: Select all

init:
#créé de nouveaux raccourcis pour des fonctions existantes
    $ config.keymap['quit'].append('K_ESCAPE')

    $ config.keymap['skip'].append('K_LSHIFT')
    $ config.keymap['skip'].append('K_RSHIFT')

    $ config.keymap['hide_windows'].append('K_SPACE')

#    $ config.keymap['toggle_skip'].append('ctrl_K_n') #<= doesn't work...

#supprime les raccourcis claviers existants
    $ config.keymap['rollback'].remove('K_PAGEUP')

    $ config.keymap['screenshot'].remove('s')

    $ config.keymap['toggle_fullscreen'].remove('alt_K_RETURN')
    $ config.keymap['toggle_fullscreen'].remove('alt_K_KP_ENTER')
    $ config.keymap['toggle_fullscreen'].remove('K_F11')

    $ config.keymap['game_menu'].remove('K_ESCAPE')
    $ config.keymap['game_menu'].remove('mouseup_3')
    $ config.keymap['game_menu'].remove('joy_menu')

    $ config.keymap['hide_windows'].remove('mouseup_2')
    $ config.keymap['hide_windows'].remove('joy_hide')
    $ config.keymap['hide_windows'].remove('h')

    $ config.keymap['launch_editor'].remove('E')

    $ config.keymap['reload_game'].remove('R')

    $ config.keymap['inspector'].remove('I')

    $ config.keymap['developer'].remove('D')

    $ config.keymap['quit'].remove('meta_q')
    $ config.keymap['quit'].remove('alt_K_F4')
    $ config.keymap['quit'].remove('alt_q')

    $ config.keymap['iconify'].remove('meta_m')
    $ config.keymap['iconify'].remove('alt_m')

    $ config.keymap['help'].remove('K_F1')
    $ config.keymap['help'].remove('meta_shift_/')

    $ config.keymap['choose_renderer'].remove('G')

    $ config.keymap['rollforward'].remove('mousedown_5')
    $ config.keymap['rollforward'].remove('K_PAGEDOWN')

    $ config.keymap['dismiss'].remove('K_RETURN')
    $ config.keymap['dismiss'].remove('K_SPACE')
    $ config.keymap['dismiss'].remove('joy_dismiss')

    $ config.keymap['focus_left'].remove('K_LEFT')
    $ config.keymap['focus_left'].remove('joy_left')

    $ config.keymap['focus_right'].remove('K_RIGHT')
    $ config.keymap['focus_right'].remove('joy_right')

    $ config.keymap['focus_up'].remove('K_UP')
    $ config.keymap['focus_up'].remove('joy_up')

    $ config.keymap['focus_down'].remove('K_DOWN')
    $ config.keymap['focus_down'].remove('joy_down')

    $ config.keymap['button_ignore'].remove('mousedown_1')

    $ config.keymap['button_select'].remove('K_RETURN')
    $ config.keymap['button_select'].remove('K_KP_ENTER')
    $ config.keymap['button_select'].remove('joy_dismiss')

    $ config.keymap['button_alternate'].remove('mouseup_3')

    $ config.keymap['button_alternate_ignore'].remove('mousedown_3')

    $ config.keymap['viewport_drag_start'].remove('mousedown_1')

    $ config.keymap['viewport_drag_end'].remove('mouseup_1')

    $ config.keymap['skip'].remove('K_LCTRL')
    $ config.keymap['skip'].remove('K_RCTRL')
    $ config.keymap['skip'].remove('joy_holdskip')

    $ config.keymap['toggle_skip'].remove('K_TAB')
    $ config.keymap['toggle_skip'].remove('joy_toggleskip')

    $ config.keymap['fast_skip'].remove('>')

    $ config.keymap['drag_activate'].remove('mousedown_1')

    $ config.keymap['drag_deactivate'].remove('mouseup_1')

    $ config.keymap['console'].remove('shift_O')

    $ config.keymap['console_older'].remove('K_UP')

    $ config.keymap['console_newer'].remove('K_DOWN')

    $ config.keymap['toggle_music'].remove('m')


screen keymap_screen:
    key "s" action ShowMenu('save')
    key "l" action ShowMenu('load')
    key "c" action ShowMenu('preferences')
    key "t" action ShowMenu('main_menu')
    key "b" action ShowMenu('text_history')
    key "a" action Preference("auto-forward", "toggle")
    $ recent_save = renpy.newest_slot(r"\d+")
    if (recent_save is not None):
        $ recent_save_page, recent_save_name = recent_save.split("-")
        key "ctrl_K_b" action FileLoad(recent_save_name, confirm=True, page=recent_save_page)
Sorry for my english, it's not my native language. :s

philat
Eileen-Class Veteran
Posts: 1853
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Keymap (CTRL+N) for Toggle_Skip doesn't work :/

#6 Post by philat » Wed Jan 28, 2015 10:31 pm

Huh. While I confess I still don't see the point of toggle_skip, I don't know why it's not working for you.

Code: Select all

init:
    $ config.keymap['toggle_skip'].append('ctrl_K_n')
    $ config.keymap['skip'].remove('K_LCTRL')
    $ config.keymap['skip'].remove('K_RCTRL')

# The game starts here.
label start:

    e "You've created a new Ren'Py game."

    e "Once you add a story, pictures, and music, you can release it to the world!"
This is working perfectly for me in a clean project (as indicated by the skip indicator in the top left corner). Did you change anything in the renpy common files besides adding the ctrl behavior?

Alternatively, you could add this to the keymap screen.

Code: Select all

key "ctrl_K_n" action toggle_skipping

User avatar
Pierrou
Regular
Posts: 53
Joined: Fri Dec 05, 2014 8:25 pm
Projects: Togainu no Chi, DMMD, Omerta, ...
Skype: pierrouney
Location: France
Contact:

Re: Keymap (CTRL+N) for Toggle_Skip doesn't work :/

#7 Post by Pierrou » Thu Jan 29, 2015 2:01 am

philat wrote:Alternatively, you could add this to the keymap screen.

Code: Select all

key "ctrl_K_n" action toggle_skipping
It works fine :) Thank you for your help !
Sorry for my english, it's not my native language. :s

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]