Use either key "strings" for button?

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
wyverngem
Miko-Class Veteran
Posts: 594
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Use either key "strings" for button?

#1 Post by wyverngem » Tue Apr 17, 2018 12:52 am

Can I use "key" in the screen language to setup two different keys for the same action? Let's say I wanted the player to either select by pressing 1 or by pressing num_pad 1?

Code: Select all

key "K_KP" + str(n) action i.action
Makes it so I can hit the num_pad.

Code: Select all

key str(n) action i.action
Makes it so that I use the regular number keys at the top of the letters.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1433
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy
Contact:

Re: Use either key "strings" for button?

#2 Post by xavimat » Tue Apr 17, 2018 3:46 am

Try it. That will work.
Renpy does not bother about different elements triggering the same action. They can be buttons/textbuttons/imagebuttons/hotsposts in imagemaps/keys/timers (I think that's all).
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
wyverngem
Miko-Class Veteran
Posts: 594
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Use either key "strings" for button?

#3 Post by wyverngem » Wed Apr 18, 2018 1:18 am

Hrm, it does, but not sure if there's a consequence for using it like this or if there's a better way.

Post Reply

Who is online

Users browsing this forum: isobellesophia, Rydetox, timepatches, zankizuna