Locate a photo in the game Mu Online

Ask gaming related questions (AHK v1.1 and older)
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: Locate a photo in the game Mu Online

13 May 2023, 16:28

Jorge wrote: can you give me an example of what this loop would look like?
With your image files named image1.png, image2.png, etc., in a folder named "images" inside your script directory:

Code: Select all

loop, Files, images\image*.png
{
	ImageSearch, foundX, foundY, 0, 0, A_ScreenWidth, A_ScreenHeight, % A_LoopFileFullPath
	if ErrorLevel
		MsgBox, % "Image " A_LoopFileName " not found"
	else
		MsgBox, % "Image " A_LoopFileName " found at " foundX "," foundY
}
Jorge
Posts: 34
Joined: 11 Apr 2023, 09:01

Re: Locate a photo in the game Mu Online

14 May 2023, 07:49

@boiler

Showw, I will test. One question, if it finds the corresponding image, does it close the loop? or are you going to keep fetching all the images? Is there a way to do it when you find the corresponding image, exit the loop?
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: Locate a photo in the game Mu Online

14 May 2023, 08:29

Code: Select all

loop, Files, images\image*.png
{
	ImageSearch, foundX, foundY, 0, 0, A_ScreenWidth, A_ScreenHeight, % A_LoopFileFullPath
	if ErrorLevel
		MsgBox, % "Image " A_LoopFileName " not found"
	else
	{
		MsgBox, % "Image " A_LoopFileName " found at " foundX "," foundY
		break
	}
}
Jorge
Posts: 34
Joined: 11 Apr 2023, 09:01

Re: Locate a photo in the game Mu Online

15 May 2023, 06:17

@boiler

Perfect, I did the test here, and it worked just fine.

Now a continuity, after finding the image, I needed him to move the mouse and click on it, the move stop is working, but the click does not, it does not click.

This same click scheme works in the game because I created a script to move the mouse and click to walk, and it's ok, but in the inventory clicking on the item will not work.

Here's my current code.

Code: Select all

#NoEnv
#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
#WinActivateForce
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, 30, 30
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, 500

F5::
  ; captura uma imagem da tela inteira
  CoordMode, Mouse, Pixel, Screen

  ; captura uma imagem da tela inteira
  ImageSearch, foundX, foundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *5 images\testesd.png

  ; verifica se a imagem foi encontrada
  
  if ErrorLevel = 2
  {
    MsgBox Could not conduct the search.
  }
  else if ErrorLevel = 1
  {
    MsgBox Image could not be found on the screen.
  }
  else
  {
    ; move o mouse para a posição da imagem
    MouseMove, foundX, foundY, 0

    ; adiciona um pequeno atraso antes de clicar
    Sleep, 200

    ; clica na posição da imagem
    ControlClick, 50 100, , , , Left, 1, D
  }
Return
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: Locate a photo in the game Mu Online

15 May 2023, 06:34

It could be that you’re missing the right spot to click on because the found location is the upper-left corner of your reference image, which could be just off of item itself. Try something like:

Code: Select all

 MouseMove, foundX + 20, foundY + 20, 0
Jorge
Posts: 34
Joined: 11 Apr 2023, 09:01

Re: Locate a photo in the game Mu Online

15 May 2023, 06:58

@boiler


But then wouldn't it be moving the mouse? That way he improved the position of the move, it was well centered on the item, but it doesn't click
User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: Locate a photo in the game Mu Online

15 May 2023, 07:09

I don't understand what you're asking. You already had a MouseMove statement in there. I just changed the location by 20 pixels in each direction.
Jorge
Posts: 34
Joined: 11 Apr 2023, 09:01

Re: Locate a photo in the game Mu Online

15 May 2023, 07:22

@boiler

Yes yes, that part understood what you did.

It's just that my problem is not moving the mouse, the script is locating the image and moving the mouse correctly to it, but it can't click on it.

What I need, it will identify the item that came out in the machine's fusion, and it will move the mouse to it, click on it, then it will be stuck on the mouse, then I will move the mouse to another place and I will click again to drop the item, in this case taking it from the machine and putting it in my inventory.

The problem it doesn't click, it moves the mouse to the item on the machine and it doesn't click on it.

It could be something in the game blocking, or something like that, but I already did this same move and click scheme to walk around the map and it works, it just isn't working when clicking on the item.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Rohwedder and 62 guests