Need Help/Info/Script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
NightBringer21
Posts: 2
Joined: 10 Oct 2019, 11:00

Need Help/Info/Script

10 Oct 2019, 11:26

Hello everyone, I am fairly new to AHK

Now this may be a question to people who know how to make scripts ect, Im just wondering how and if it is possible:

Usually I put in the mouse coordinates in a ahk script that looks something like this:

F1::
click, 1888 817
click, 1897 903
click, 1974 827
click, 1985 901
return

F2::

click, 1888 817
click, 1897 903
click, 1974 827
click, 1985 901
send {F3}
click, 2177 827
return

So the above is basically clicking on the coordinates that I have inputted into AHK and is there anyway to make it so instead for example click, 1888 817. Would be a picture that's in the game that I play so I wouldn't have to change the coordinates if I move the item ingame to another location. Is there a way to make a script that identifies a image and clicks it instead of having to use what I been using previously?
https www.youtube.com /watch?v=_5Fi8U5Z6j4 Broken Link for safety
This youtube video above explains exactly what I want

Just wondering if theres some person out there that can point me in the right direction.

Thanks
MannyKSoSo
Posts: 440
Joined: 28 Apr 2018, 21:59

Re: Need Help/Info/Script

10 Oct 2019, 12:46

It depends on the game. If that game leaves the cursor to roam around the screen then its easier to code, but if the game forces your cursor to stay at the center of the screen then it becomes more of an issue since you can't use mouse movements normally as the game doesn't look for those, it instead looks at the vector the mouse is moving in. If you let us know the game we could tell you which kind of code you would be looking for, but also know that sometimes autohotkey and games don't play well together and the game may ignore your script inputs.
NightBringer21
Posts: 2
Joined: 10 Oct 2019, 11:00

Re: Need Help/Info/Script

10 Oct 2019, 12:49

MannyKSoSo wrote:
10 Oct 2019, 12:46
It depends on the game. If that game leaves the cursor to roam around the screen then its easier to code, but if the game forces your cursor to stay at the center of the screen then it becomes more of an issue since you can't use mouse movements normally as the game doesn't look for those, it instead looks at the vector the mouse is moving in. If you let us know the game we could tell you which kind of code you would be looking for, but also know that sometimes autohotkey and games don't play well together and the game may ignore your script inputs.
Hi thankyou for the reply the game this refers to is Oldschool Runescape. The game doesn't force the cursor to stay at the centre. If you saw the video in youtube its something like that but then binded to a F-Key
MannyKSoSo
Posts: 440
Joined: 28 Apr 2018, 21:59

Re: Need Help/Info/Script

10 Oct 2019, 13:17

As a starting point you can use https://www.autohotkey.com/docs/commands/ImageSearch.htm
This will allow you to use an image as an input and you set the box for it to look. The smaller the search area the better. If it finds a match it will return an x and y you can use to get a click from. The first test would be to get an image of the backpack icon and save it in the same folder as your script. Then give it a little larger of an area than the image you saved to search (if you make the area small than the picture then it will never find it). Once that is done simply run the script and see if it finds it (this is basically doing what the example is, but just at a basic scale). Once that is done you can expand it further. Also know that the smaller the search area the faster the script will be.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 317 guests