[SOLVED] Disable arrow keys on imagemaps only
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.
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.
- Kinmoku
- Miko-Class Veteran
- Posts: 591
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: VIDEOVERSE
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
- Contact:
[SOLVED] Disable arrow keys on imagemaps only
Hi all,
I want to disable the arrow keys from rotating through hotspots in my imagemaps. Using arrow keys makes it too easy to find secret/ hidden items that I'm hoping only sharp eyes will notice!
I only want left, right, up, down disabled for the imagemaps, though. I know how to disable keymaps in general, but not for just one screen. How do I do this? Is there something I can add to the screen itself?
I want to disable the arrow keys from rotating through hotspots in my imagemaps. Using arrow keys makes it too easy to find secret/ hidden items that I'm hoping only sharp eyes will notice!
I only want left, right, up, down disabled for the imagemaps, though. I know how to disable keymaps in general, but not for just one screen. How do I do this? Is there something I can add to the screen itself?
Last edited by Kinmoku on Mon May 20, 2019 5:20 am, edited 4 times in total.
- Matalla
- Veteran
- Posts: 202
- Joined: Wed Mar 06, 2019 6:22 pm
- Completed: Max Power and the Egyptian Beetle Case, The Candidate, The Last Hope, El cajón del viejo escritorio, Clementina y la luna roja, Caught in Orbit, Dirty Business Ep 0, Medianoche de nuevo, The Lost Smile
- itch: matalla-interactive
- Location: Spain
- Contact:
Re: Disable arrow keys on imagemaps
Maybe running the code to disable/enable them with on "show"/"hide" statements in the imagemap screen(s)?
Re: Disable arrow keys on imagemaps
Try to add this code into your imagemap screen
https://www.renpy.org/doc/html/screens.html#key
https://www.renpy.org/doc/html/keymap.html#keymap
https://www.renpy.org/doc/html/screen_a ... NullAction
Code: Select all
key "focus_left" action NullAction()
key "focus_right" action NullAction()
key "focus_up" action NullAction()
key "focus_down" action NullAction()
https://www.renpy.org/doc/html/keymap.html#keymap
https://www.renpy.org/doc/html/screen_a ... NullAction
- Kinmoku
- Miko-Class Veteran
- Posts: 591
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: VIDEOVERSE
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
- Contact:
Re: Disable arrow keys on imagemaps
Ah! NullAction! I forgot.Alex wrote: ↑Tue May 14, 2019 11:47 am Try to add this code into your imagemap screenhttps://www.renpy.org/doc/html/screens.html#keyCode: Select all
key "focus_left" action NullAction() key "focus_right" action NullAction() key "focus_up" action NullAction() key "focus_down" action NullAction()
https://www.renpy.org/doc/html/keymap.html#keymap
https://www.renpy.org/doc/html/screen_a ... NullAction
Thanks very much, Alex
- Kinmoku
- Miko-Class Veteran
- Posts: 591
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: VIDEOVERSE
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
- Contact:
Re: [SOLVED] Disable arrow keys on imagemaps
Okay, so it does what I originally asked but I have an issue... There are buttons on the screen with the imagemap which I'd like to stay selectable with the directional keys.
Here's my current code:
Is there a way to be selective about this? I thought using the "shelves_buttons" screen within the imagemap screen would help, but it acts the same as before Any ideas how I can get "shelves_buttons" to stay selectable by keys?
Here's my current code:
Code: Select all
screen shelves_imagemap:
imagemap:
ground "shelves"
hover "shelvesmap"
hotspot (256, 407, 125, 161) clicked Return("photoframe") activate_sound "sounds/item.ogg"
hotspot (440, 139, 276, 399) clicked Return("mirror") activate_sound "sounds/item.ogg"
hotspot (630, 547, 272, 49) clicked Return("laptop") activate_sound "sounds/item.ogg"
hotspot (158, 596, 746, 484) clicked Return("drawers") activate_sound "sounds/item.ogg"
hotspot (985, 357, 192, 42) clicked Return("dvd") activate_sound "sounds/book.ogg"
hotspot (1143, 207, 121, 150) clicked Return("bear") activate_sound "sounds/wallet.ogg"
hotspot (943, 405, 700, 428) clicked Return("books") activate_sound "sounds/magazines.ogg"
hotspot (1719, 482, 182, 575) clicked Return("guitar") activate_sound "sounds/item.ogg"
hotspot (1265, 127, 142, 219) clicked Return("shirt") activate_sound "sounds/clothes.ogg"
hotspot (952, 833, 679, 247) clicked Return("vinyl") activate_sound "sounds/item.ogg"
hotspot (725, 484, 177, 62) clicked Return("makeup") activate_sound "sounds/item.ogg"
use shelves_buttons
use no_arrows
screen shelves_buttons:
imagebutton idle "images/left1.png" hover "leftbutton" clicked Return('farmap') xpos 20 ypos 420 focus_mask True activate_sound "sounds/button.ogg"
imagebutton idle "images/leave_button1.png" hover "leavebutton" clicked Return('leaveattempt') xanchor 0.5 xpos 0.5 ypos 910 focus_mask True activate_sound "sounds/button.ogg"
imagebutton idle "images/right1.png" hover "rightbutton" clicked Return('nearmap') xanchor 1.0 xpos 1900 ypos 420 focus_mask True activate_sound "sounds/button.ogg"
screen no_arrows:
key "focus_left" action NullAction()
key "focus_right" action NullAction()
key "focus_up" action NullAction()
key "focus_down" action NullAction()
Re: [SOLVED] Disable arrow keys on imagemaps
Never use it myself, but you could try to replace imagemap with a bunch of imagebuttons and set their keyboard_focus property to False - https://www.renpy.org/doc/html/style_pr ... oard_focus
So you won't need to disable focus mechanism at all.
- Kinmoku
- Miko-Class Veteran
- Posts: 591
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: VIDEOVERSE
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
- Contact:
Re: Help! Disable arrow keys on imagemaps only
Thanks Alex! Unfortunately, it's behaving a little...naughty. I think that's the best way to describe it.Alex wrote: ↑Fri May 17, 2019 11:15 am Never use it myself, but you could try to replace imagemap with a bunch of imagebuttons and set their keyboard_focus property to False - https://www.renpy.org/doc/html/style_pr ... oard_focus
So you won't need to disable focus mechanism at all.
For this test, I'm using another screen which is already set up with imagebuttons (instead of imagemap):
Code: Select all
screen yourside_imagebuttons:
add "yourside"
imagebutton idle Solid("#0000", xysize=(426, 232)) hover "jeansbutton" clicked Return('jeans') xpos 213 ypos 220 focus_mask None activate_sound "sounds/clothes.ogg" keyboard_focus False
imagebutton idle Solid("#0000", xysize=(591, 216)) hover "clothesbutton" clicked Return('clothes') xpos 0 ypos 0 focus_mask None activate_sound "sounds/clothes.ogg" keyboard_focus False
imagebutton idle Solid("#0000", xysize=(167, 57)) hover "flyerbutton" clicked Return('flyer') xpos 625 ypos 163 focus_mask None activate_sound "sounds/paper.ogg" keyboard_focus False
imagebutton idle Solid("#0000", xysize=(337, 170)) hover "phonebutton" clicked Return('phone') xpos 899 ypos 325 focus_mask None activate_sound "sounds/item.ogg" keyboard_focus False
imagebutton idle Solid("#0000", xysize=(681, 476)) hover "magazinesbutton" clicked Return('magazines') xpos 1239 ypos 28 focus_mask None activate_sound "sounds/magazines.ogg" keyboard_focus False
imagebutton idle "images/left1.png" hover "leftbutton" clicked Return('shelfmap') xpos 20 ypos 420 focus_mask True activate_sound "sounds/button.ogg"
imagebutton idle "images/leave_button1.png" hover "leavebutton" clicked Return('leaveattempt') xanchor 0.5 xpos 0.5 ypos 910 focus_mask True activate_sound "sounds/button.ogg"
- Kinmoku
- Miko-Class Veteran
- Posts: 591
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: VIDEOVERSE
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
- Contact:
Re: Help! Disable arrow keys on imagemaps only
Who is online
Users browsing this forum: No registered users