that toke me almost one day , the script need some tweak i dont have time to finish it . it really easy to make it a one button script you define the area to search with printscreen for the left top corner and pause for the right bottom .
with the auto it info you can take the color of the item you want to loot , there is a protection against looping on the same item too.
Read the comment into the script.
with the auto it info you can take the color of the item you want to loot , there is a protection against looping on the same item too.
Read the comment into the script.
Code:
;Author cyberheter0
Opt("MouseCoordMode", 0) ; relative coord to the active windows
Opt("MouseClickDragDelay", 250) ; drag speed
If Not FileExists(@ScriptDir&"\Bcoord.ini") Then
IniWrite(@ScriptDir&"\Bcoord.ini","Bcoord","X","0")
IniWrite(@ScriptDir&"\Bcoord.ini","Bcoord","Y","0")
Sleep(500)
EndIf
Global $bpCoordSetX = IniRead(@ScriptDir&"\Bcoord.ini","Bcoord","X","0")
Global $bpCoordSetY = IniRead(@ScriptDir&"\Bcoord.ini","Bcoord","Y","0")
Global $pKP = 0
Global $aPKP = 0
Global $xyRB
Global $xyLT
Global $pSX
Global $pSY
Global $count
Global $zcount
Global $error
HotKeySet("{F1}","setBCoord") ;set the coordinate bag
HotKeySet("{PRINTSCREEN}","lTGetCoord") ;left top x, y
HotKeySet("{PAUSE}","rBGetCoord") ; right bottom x, y
HotKeySet("{END}","Terminate")
WinWaitActive("Darkfall Online")
while 1
if ($aPKP == 1) AND ($pKP == 1) then
$getRB= StringSplit($xyRB, '_', 2)
$getLT= StringSplit($xyLT, '_', 2)
$pColor = "0x757878_0xB6BCBC_0xB9C986_0x8B8F8F" ;separate each value by an underscore color value of item
$color= StringSplit($pColor, '_', 2)
;MsgBox(0, "X and Y are LT :", $color[0] & "," & $color[1])
;MsgBox(0, "X and Y are RB :", $getRB[0] & "," & $getRB[1])
$count = 0
Do
;MsgBox(0, "count ", $count & "," & $color[$count])
$zcount = 0
Do
$coord = PixelSearch( $getLT[0], $getLT[1], $getRB[0], $getRB[1], $color[$count], 30, 1) ;0x757878 ;0xB6BCBC 0xb9c986 $getLT[0]+303, $getLT[1]+225
If Not @error Then
;if (($coord[0] <> $pSX) And ($coord[1] <> $pSY)) Then
MouseClickDrag("left", $coord[0], $coord[1], $bpCoordSetX+Random(10,20,1), $bpCoordSetY+Random(10,20,1), 0)
MouseMove($getLT[0], $getLT[1], 0)
$pSX = $coord[0]
$pSY = $coord[1]
$zcount += 1
;MsgBox(0, "count ", $zcount)
$error = @error
if ($coord[0] == $pSX) And ($coord[1] == $pSY) And ($zcount ==1) Then
$error = 1
;MsgBox(0, "count ", "in the loop")
EndIf
;MsgBox(0, "Coord check", $coord[0] & "," & $coord[1])
EndIf
;if @error Then
;MsgBox(0, "Attention", "ERROR")
;EndIf
Until $error = 1
$count += 1
;MsgBox(0, "Attention", "passe le controle d'Erreur")
Until $count = UBound($color)
MsgBox(0, "Attention", "STOP")
$pKP = 0
$aPKP = 0
EndIf
WEnd
Func setBCoord()
$getPos = MouseGetPos()
IniWrite(@ScriptDir&"\Bcoord.ini","Bcoord","X", $getPos[0])
IniWrite(@ScriptDir&"\Bcoord.ini","Bcoord","Y", $getPos[1])
$bpCoordSetX = $getPos[0]
$bpCoordSetY = $getPos[1]
EndFunc
Func rBGetCoord()
Sleep(100)
ToolTip("the right bottom coord", 0, 0)
Sleep(200)
ToolTip("")
$posRB = MouseGetPos()
$xyRB = $posRB[0] & "_" & $posRB[1]
$pKP = 1
return $xyRB
EndFunc
Func lTGetCoord()
Sleep(100)
ToolTip("the left top coord", 0, 0)
Sleep(200)
$posLT = MouseGetPos()
$xyLT = $posLT[0] & "_" & $posLT[1]
$aPKP = 1
return $xyLT
EndFunc
Func Terminate()
Sleep(100)
ToolTip("script terminated", 0, 0)
Sleep(200)
Exit 0
EndFunc