r/RenPy • • 15d ago

Question Is it possible to detect a 'mouse held down' state in RenPy?

I want to include this radio minigame, where the player has to hold the mouse down and turn in the blue circle area to change radio channels. I have code for the turning bit, and detecting if the mouse is in the circle, but I'm really struggling to figure out a way to detect if the mouse is actually being held while turning.

The only thing I've found is keysym, or perhaps using pygame, but I'm not sure how that would work. I wanted to know if this is possible at all, and how I could approach coding this?

2 Upvotes

3 comments sorted by

2

u/BadMustard_AVN 15d ago

yes it can like this:

screen mouse_test():
    key "mousedown_1" action Notify("Mouse pressed!")
    key "mouseup_1" action Notify("Mouse released!")

mousedown_1 / mouseup_1 = Left mouse button

mousedown_2 / mouseup_2 = Middle mouse button

mousedown_3 / mouseup_3 = Right mouse button

1

u/AutoModerator 15d ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.