How to force move mouse?
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.
- AHAKuo
- Regular
- Posts: 41
- Joined: Tue Feb 06, 2018 11:10 am
- Projects: SoUnd Is ToxIc
- Organization: AHAKuo
- Tumblr: ahakuo
- Deviantart: ahakuo
- Contact:
How to force move mouse?
I have seen this done on Doki Doki Literature Club when the mouse gets forcefully moved to a location.
How does it happen? How can I make the mouse move to a place by force?
How does it happen? How can I make the mouse move to a place by force?
Working on:
- IrinaLazareva
- Veteran
- Posts: 399
- Joined: Wed Jun 08, 2016 1:49 pm
- Projects: Legacy
- Organization: SunShI
- Location: St.Petersburg, Russia
- Contact:
Re: How to force move mouse?
You can use MouseMove() action.
https://www.renpy.org/doc/html/screen_a ... #MouseMove
https://www.renpy.org/doc/html/screen_a ... #MouseMove
- AHAKuo
- Regular
- Posts: 41
- Joined: Tue Feb 06, 2018 11:10 am
- Projects: SoUnd Is ToxIc
- Organization: AHAKuo
- Tumblr: ahakuo
- Deviantart: ahakuo
- Contact:
Re: How to force move mouse?
Thanks for the response!IrinaLazareva wrote: ↑Thu Feb 22, 2018 12:44 pm You can use MouseMove() action.
https://www.renpy.org/doc/html/screen_a ... #MouseMove
Hmm. And how would that code be implemented so that the mouse forcefully moves to a choice?
Working on:
Re: How to force move mouse?
Probably with something like this:
Code: Select all
#A WARNING: The x and y positions given are roughly the center of my screen,
#where I placed the exit button,
#you might have to test and change it to your own resolution for your game.
screen force_mouse_move():
on "show":
action MouseMove(x=650, y=350, duration=.3)
timer .5 repeat True action MouseMove(x=650, y=350, duration=.3)
textbutton "Click Me" xalign .5 yalign .5 action Return()
label start:
scene black #Thi is just so I can see the button crearly
call screen force_mouse_move
"..."
- IrinaLazareva
- Veteran
- Posts: 399
- Joined: Wed Jun 08, 2016 1:49 pm
- Projects: Legacy
- Organization: SunShI
- Location: St.Petersburg, Russia
- Contact:
Re: How to force move mouse?
Just to select the value of coordinates.
One more example:
Code: Select all
screen myscreen():
style_prefix 'choice'
vbox:
align(.5, .5)
spacing 30
textbutton "No" action NullAction()
textbutton "Yep" action Hide('myscreen')
textbutton "Nope" action NullAction()
on 'show' action MouseMove(config.screen_width/2, config.screen_height/2, 3)
label start:
'?'
show screen myscreen
'!'
return
- MilywayObree
- Newbie
- Posts: 17
- Joined: Sun Jan 28, 2018 11:24 am
- Completed: None so far, pending to be exact
- Projects: DDLC, The notebook and other secret projects
- Organization: Vocastin/Oriaa Pro-Creations
- Deviantart: MexicoRPelino
- Github: HizashiroTakahashi
- Skype: PixelMINEGaming
- Location: Philippines
- Contact:
Re: How to force move mouse?
You could do it like this...
now define a screen to do this certain action...
once you did all of those...
Hope it helped!
Code: Select all
default currposition = 0
init python:
def MoveMouseFunc():
currposition = renpy.get_mouse_pos()
tpos = [640, 345]
if currposition[1] < tpos[1]:
renpy.display.draw.set_mouse_pos((currposition[0] * 9 + tpos[0]) / 10.0, (currposition[1] * 9 + tpos[1]) / 10.0)
Code: Select all
screen riggedmousescreen():
timer 1.0/30.0 repeat True action Function(MoveMouseFunc)
Code: Select all
label start:
show screen riggedmousescreen
e "I am controlling your mouse"
return
Just Monika.
- AHAKuo
- Regular
- Posts: 41
- Joined: Tue Feb 06, 2018 11:10 am
- Projects: SoUnd Is ToxIc
- Organization: AHAKuo
- Tumblr: ahakuo
- Deviantart: ahakuo
- Contact:
Re: How to force move mouse?
ReDZiX wrote: ↑Thu Feb 22, 2018 2:00 pm Probably with something like this:
Code: Select all
#A WARNING: The x and y positions given are roughly the center of my screen, #where I placed the exit button, #you might have to test and change it to your own resolution for your game. screen force_mouse_move(): on "show": action MouseMove(x=650, y=350, duration=.3) timer .5 repeat True action MouseMove(x=650, y=350, duration=.3) textbutton "Click Me" xalign .5 yalign .5 action Return() label start: scene black #Thi is just so I can see the button crearly call screen force_mouse_move "..."
OMG THIS IS THE BEST CODE!
Thank you so much for this help! It really saved me BIG THANKS! <3
Working on: