SOLVED: How do I lock out clicking outside of hotspots?

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
webryder
Regular
Posts: 40
Joined: Thu Feb 06, 2014 9:46 pm
Contact:

SOLVED: How do I lock out clicking outside of hotspots?

#1 Post by webryder »

When the quick menu is up, clicking anywhere outside the quick menu moves the dialogue forward in a standard game.

If I want the game to only move forward if the player clicks on a hotspot, like the quick menu, how do I do that?

Thanks!
Last edited by webryder on Tue Feb 03, 2015 1:38 am, edited 1 time in total.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How do I lock out clicking outside of hotspots?

#2 Post by trooper6 »

Could I ask a few follow up questions?
When you say the quick menu, do you mean the official quick menu with "back," "save," "q.save," etc that is always visible? Or do you mean a custom menu that is visible sometimes but not visible others?

There is a slight difference in how I'd answer the question based on if you *never* want the player to be able to dismiss text by clicking or if you *sometimes* want to disable dismissing text by clicking and what exactly this quick menu is. Did you add a "click-to-continue" button to the quick menu?
Give me a bit more information please!

I ask because I've implemented this sort of function a couple of different ways in my game and I wanted to give you the best answer to your question.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

webryder
Regular
Posts: 40
Joined: Thu Feb 06, 2014 9:46 pm
Contact:

Re: How do I lock out clicking outside of hotspots?

#3 Post by webryder »

I meant the default quick menu with an added click to continue button.

It (the revised quick menu) is not always visible - it only shows when a specific screen is showing. I would only need to lock out clicking when the click to continue button is up.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How do I lock out clicking outside of hotspots?

#4 Post by trooper6 »

Oh, well that is pretty easy then.

Here is the quick and dirty way I'd do it. If you go to the list of renpy's keymap here http://www.renpy.org/doc/html/keymap.html
you'll see: dismiss = [ 'mouseup_1', 'K_RETURN', 'K_SPACE', 'K_KP_ENTER', 'joy_dismiss' ]

So you just need to get rid of the keybindings that allow people to dismiss while your revised quick menu is up. So...in your revised quick menu screen I'd add this:

Code: Select all

screen revised_quick_menu()"
    key "mouseup_1" action NullAction()
    key "K_RETURN" action NullAction()
    key "K_SPACE" action NullAction()
    key "K_KP_ENTER" action NullAction()
    key "joy_dismiss" action NullAction()
So, whenever your revised_quick_menu is showing, it will disable the ability for those keys dismiss. When the screen is not showing, the player has the ability to dismiss as normal.

I had originally done something like that for my game....but in reverse. But then I learned about config.say_allow_dismiss, which allows you to create a function that controls when a say text can be dismissed.

Which looks this:

Code: Select all

    def say_blocking():
        global can_cont
        return can_cont
    config.say_allow_dismiss = say_blocking
With this function the ability to dismiss is based on a can_cont variable (which for my game is changed based on character callbacks). If can_cont is True, then you can dismiss, if it isn't, then you can't. I have a couple other things going on in this case, but you probably are going to do with the first example rather than the second.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

webryder
Regular
Posts: 40
Joined: Thu Feb 06, 2014 9:46 pm
Contact:

Re: How do I lock out clicking outside of hotspots?

#5 Post by webryder »

The key bindings did the trick - thanks!

Post Reply

Who is online

Users browsing this forum: Google [Bot]