Mousemove in Minecraft

Ask gaming related questions (AHK v1.1 and older)
Its2Izzi
Posts: 6
Joined: 04 Jan 2020, 08:29

Mousemove in Minecraft

Post by Its2Izzi » 04 Jan 2020, 08:37

I wanted to ask how you can programm the mouse to move ingame, because on the screen it is on the same spot. Thanks for any replies

Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Mousemove in Minecraft

Post by Evil-e » 04 Jan 2020, 10:01

OK.... I have a specific script I wrote to clear TaskBar cache after my games are closed. I use a FOV changer on a number of them and that pesky little image is left down by the time and just erks me... lol

Code: Select all

#IfWinActive MX Vs ATV REFLEX ahk_class MX VS ATV
WinWait, MX Vs ATV REFLEX ahk_class MX VS ATV
WinWaitClose, MX Vs ATV REFLEX ahk_class MX VS ATV
sleep, 250
BlockInput, On
SendMode, Event
MouseMove, 1600,1060,20              ;1600 is horizontal & 1060 is vertical placement. 20 is speed mouse travels (lower number is faster)
sleep, 100
SendMode, Event
MouseMove, 1845,1060,20             ;1845 is immediately to the LH side of time display on Windows Desktop 
sleep, 50
SendMode, Event
MouseMove, 1000, 100
BlockInput, Off
sleep, 50
ExitApp
return
This particular one is due to a pair of AHK.exe files that I hot-swap between during game play. For whatever reason, different vehicles respond differently to the "lean forward" key. Anyway, when the game closes, BlockInput is switched on and the mouse travels down about 4" from the RH corner of the TaskBar and slowly drags toward the clock to clear the cache. Kinda silly, but when I switch vehicles a lot, I switch AHK.exe files a lot and can end up with 10 little AHK icons along the TaskBar......

In YOUR case, change 1600 to 800 and test it out to see if it works for you.

Wanna piss a kitty off...... leave a bunch of icon cache on the TaskBar :crazy:

NOTE: I have found if folders are OPEN, it may mess up how this works. For best results, minimize all folders so Desktop is clean.

:morebeard:
Last edited by Evil-e on 04 Jan 2020, 10:08, edited 1 time in total.
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)

Its2Izzi
Posts: 6
Joined: 04 Jan 2020, 08:29

Re: Mousemove in Minecraft

Post by Its2Izzi » 04 Jan 2020, 10:06

First, thanks for your attention. I thougt this would fix it but i remember that this isnt what i want. I search for an code to move the mouse ingame, so for exampe: the charakter is looking at the ground and i want him to look at a specific spot in front of him. But when i try he is looking into the sky and spin around his head☹

Its2Izzi
Posts: 6
Joined: 04 Jan 2020, 08:29

Re: Mousemove in Minecraft

Post by Its2Izzi » 04 Jan 2020, 10:23

I copied the command but he just spin around and int the end he look up

GeminiContractor
Posts: 17
Joined: 03 Jul 2016, 10:30

Re: Mousemove in Minecraft

Post by GeminiContractor » 04 Jan 2020, 11:22

Can you explain more about what the problem is?
Also, what version of Minecraft is having the issue (Bedrock or Java), and do you have any mods installed?

Its2Izzi
Posts: 6
Joined: 04 Jan 2020, 08:29

Re: Mousemove in Minecraft

Post by Its2Izzi » 04 Jan 2020, 11:27

I have no problem in generam. I only want to automize a progress where i have to click and look around. I play on the 1.8.9 on Java edition

GeminiContractor
Posts: 17
Joined: 03 Jul 2016, 10:30

Re: Mousemove in Minecraft

Post by GeminiContractor » 04 Jan 2020, 11:48

So, you want to automatically look somewhere and click?
I am not sure how to do that, exactly...
Out of curiosity though, what process are you trying to automate?

Its2Izzi
Posts: 6
Joined: 04 Jan 2020, 08:29

Re: Mousemove in Minecraft

Post by Its2Izzi » 04 Jan 2020, 12:36

Its just some annoying work with buying and crafting

Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Re: Mousemove in Minecraft

Post by Evil-e » 04 Jan 2020, 14:27

@Its2Izzi I don't think you are gonna find a script that will essentially play the game for you, if I am understanding correctly. If I am understanding correctly, I don't know why you would want that... :lol: There is just no way for AHK to understand what needs to be done in game.

Theoretically, if you had an exact map or path, you could spend about a gazillion years automating the process via press of the F1 key if you really wanted. As for looking at a specific location, this has come up once before and I suppose you could program AHK to move cursor, view or weapon to a specific location, but it would be so much easier just to move the mouse.

:morebeard: is being kind of a dick here, sorry :cry:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)

GeminiContractor
Posts: 17
Joined: 03 Jul 2016, 10:30

Re: Mousemove in Minecraft

Post by GeminiContractor » 05 Jan 2020, 03:54

Evil-e wrote:
04 Jan 2020, 14:27
@Its2Izzi I don't think you are gonna find a script that will essentially play the game for you, if I am understanding correctly. If I am understanding correctly, I don't know why you would want that... :lol: There is just no way for AHK to understand what needs to be done in game.

Theoretically, if you had an exact map or path, you could spend about a gazillion years automating the process via press of the F1 key if you really wanted. As for looking at a specific location, this has come up once before and I suppose you could program AHK to move cursor, view or weapon to a specific location, but it would be so much easier just to move the mouse.

:morebeard: is being kind of a dick here, sorry :cry:
What they want is way beyond my ability (I am a novice to AutoHotkey), but I remember seeing some features that might help.
A script like that would probably require quite a few "If/Else" statements though, and I have no idea how to deal with screen coordinates...
https://www.autohotkey.com/docs/commands/PixelSearch.htm
https://www.autohotkey.com/docs/commands/MouseMove.htm
https://www.autohotkey.com/docs/commands/MouseClick.htm
https://www.autohotkey.com/docs/commands/MouseClickDrag.htm
This link has a slightly similar script, which might give an idea on how to make the script that they want:
https www.reddit.com /r/AutoHotkey/comments/egpis6/help_needed_with_a_minecraft_script/ Broken Link for safety

Its2Izzi, when you buy, are you buying from a villager or from something that does not move?
Also, do you have to move your character, your view or both?
Lastly, do you want the script so that you can buy/craft in bulk, and is what you want it for something that you do often after going to do other things (gathering, building, etc.) or is it something that you will only do once/once in a while?

Its2Izzi
Posts: 6
Joined: 04 Jan 2020, 08:29

Re: Mousemove in Minecraft

Post by Its2Izzi » 05 Jan 2020, 05:42

I buy it from a villager who doesnt move. I need the script quite often, because he sells blocks for building. First I would walk in front of him and then activate the script. It should click on the villager, buy stuff, go out of the menu, look around to a crafting table, then click on it and finally craft the things i need. So in conclusion the character only needs to move the view. And thats the problem where I stuck. With the MouseMove command it spin around his head and end up looking in the sky. With other commands nothing happens

BlackStar912
Posts: 1
Joined: 27 Dec 2021, 14:15

Re: Mousemove in Minecraft

Post by BlackStar912 » 27 Dec 2021, 14:21

Hi,
I am trying to make the same thing, did you found a way to move the mouse ingame with a macro ?
I want to make an automine and when I try the view goes on the ground and spin, it is weird.

Thanks,

Sorry for my grammar which is not very good, I'm french xD

ahnakin
Posts: 6
Joined: 10 Aug 2022, 18:08

Re: Mousemove in Minecraft

Post by ahnakin » 16 Jan 2023, 11:45

It seems that mouse input to Minecraft is very tricky!

So far the best I have come up with is:

Code: Select all

 MouseMove, 63, 0, 100, R
I had to use relative movement to avoid the spinning in all directions issue. I also had to slow the mouse to minimum speed to get any sort of consistency. The above is only about 75% effective... the rest of the time it wind up turning and looking at the sky or winding up looking the same direction it started.

But for some reason, it seems that it locks to looking at a specific direction. The above does a 180 turn, but I have not been able to find anything yet to reverse that turn... if I executed it a second time it does a 360 instead of a 180!

off
Posts: 176
Joined: 18 Nov 2022, 21:54

Re: Mousemove in Minecraft

Post by off » 05 Feb 2023, 22:03

First of all, minecraft camera movement is depends on your sensitivity, there is 2 way to make the mouse movement run by the script works fine:
1. Lower your sensitivity
2. Lower the mouse movement on the script

AFAIK Minecraft always put the mouse in the middle screen, and it counts how far you move the cursor into the game.

You can test the script by using

Code: Select all

x:: ; press "x" to move the cursor
MouseGetPos, xp, yp
xp:=xp
yp-=1
MouseMove, %xp%, ,%yp% 0 ; move the mouse 1 pixel up (Y Coord in screen)
return
negative value on X will move the cursor leftward
negative value on Y will move the cursor upward

after you have the value you need, you can use in the script.

note:
the second 0 is for movement speed, 0 for fastest, 100 for slowest.

Post Reply

Return to “Gaming Help (v1)”