Jump to content


Photo

Script for ragnarok, find and hit a mob


  • Please log in to reply
2 replies to this topic

#1 flordelarosa

flordelarosa
  • Members
  • 5 posts

Posted 10 July 2012 - 07:00 PM

Good day,

I have make a script for looking for and hit a mob found before. The code is:

$F1::  ;Key for start
$F2:: ;Key for skill in the game(teleport).
cuenta = 0 ; my own var for the time of search.
Loop
{
    if not GetKeyState("F1", "P")
        break
     PixelSearch, Px, Py, 4, 27, 1002, 691, 0xc6bdef, 1, fast
     if ErrorLevel 
     cuenta++ 				;That color was not found in the region.
     else
       Click X%Px% Y%Py%		;A color was found at X%Px% Y%Py%.
   if (cuenta>=60000)                    ; if after 1 minute of search don't find nothing.
	break
 	send {F2}{enter}                  ;Then teleport.
	cuenta = 0	
}
return

The script run, but it only makes teleport, and never hit nothing.

I try with the search pixel part apart and work fine, it finding the color.

When the script run, the mouse in the screen is static, it don't move anywhere.

I hope your help and suggestions for make that the cursor moving to the desired position, found in pixel search. Also if the problem is another thing that I don't see yet.

Thanks from now

PD: I speak spanish, but know english as a foreign lenguage.

#2 TakeNoPrisoners

TakeNoPrisoners
  • Guests

Posted 10 July 2012 - 07:47 PM

[color=#FF0000]Click %Px% %Py%      ;A color was found at X%Px% Y%Py%.[/color]


#3 flordelarosa

flordelarosa
  • Members
  • 5 posts

Posted 10 July 2012 - 08:52 PM

Ohh, I see now.

I delete the x and y surplus, and the mouse itself move at the perfect site :)

But the teleport is very fast, and it don't reached to hit, but I improved the script add a time after the else sentence:

$F1::
$F2::
cuenta = 0
Loop
{
    if not GetKeyState("F1", "P")
        break
     PixelSearch, Px, Py, 4, 27, 1002, 691, 0xc6bdef, 1, fast
     if ErrorLevel 
     cuenta++ 				;That color was not found in the region.
     else
       Click %Px% %Py%		;A color was found at X%Px% Y%Py%.
   if (cuenta>=60000)
	break
 	send {F2}{enter}
	sleep 1000
	cuenta = 0	
}
return

And now work fine.

Very thanks you TakeNoPrisoners.