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: 615
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 »

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: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Use either key "strings" for button?

#2 Post by xavimat »

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!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
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 »

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: Bing [Bot]