Jump to content

Drag & Drop \ Pixelsearch


Recommended Posts

Hi,

I am using the below code to find a color, drag it and drop it to a location. I keep getting an error that says "Line -1 Subset used with non-array value". Oddly enough, it works sometimes.

I don't get what I am doing wrong? :P

Global $StartX = 0
Global $StartY = 0
Global $Start = False
HotKeySet ("!1","Start")

Func start()
    $start = true
EndFunc

while 1
    if $start = True Then
    go()
    EndIf
WEnd
Func go()
$coord = PixelSearch(178,199,712,684,0xBCCC88)
    $StartX = $coord[0]
    $StartY = $coord[1]
    MouseClickDrag("Left",$startx,$starty,314,249,0)
    $start = False
EndFunc
Link to comment
Share on other sites

Ok, I got the above to work. New problem, My mouse click & drag is very sluggish - any way I can speed this up to take a second or less instead of 10+ seconds?

Global $StartX = 0
Global $StartY = 0
Global $Start = False
HotKeySet ("!1","Start")
HotKeySet ("!3","stop")

FUnc stop()
    Exit
    EndFunc

Func start()
    $start = true
EndFunc

while 1
    sleep(800)
    if $start = True Then
    go()
    go2()
    EndIf
WEnd
Func go()
$coord = PixelSearch(178,199,712,684,0x39221c)
If Not @error Then
    $StartX = $coord[0]
    $StartY = $coord[1]
;MouseClick("{Left Down}",$coord[0],$coord[1])
;MouseMove(314,249,0)
;MouseClick("{Left Up}")
    MouseClickDrag("Left",$startx,$starty,314,249,0)
    sleep(100)
    
    
EndIf
EndFunc


Func go2()
$x1 = 295
$y1 = 261
$x2 = 611
$y2 = 499

    $d = 0
    Do

MouseClickDrag("left",$x1,$y1,845,397,0)
    
    $x1 = $x1 + 4
    $y1 = $y1 + 4
    Until $x1 >= $x2 and $y1 >= $y2
EndFunc
Link to comment
Share on other sites

Alright, not to bump my own thread or anything but just an update...

I managed to speed it up significantly by using the Opt mouse click drag delay option setting to 0, but this still takes a matter of seconds to go through a 5x5 click rectangle. I have seen some that go through more clicks in literally a second or less with drag and drop - tested in Paint.

Anyone have any ideas to speed this up please? I have done a lot of troubleshooting and am not trying to leech :P

Link to comment
Share on other sites

It's an object that appears in a small rectangle at a random location. The color of the rectangle's background is inconsistent and the actual location it appears is random on the screen. I'm trying to detect a single color on the object (who's color is also inconsistent) that appears and drag it outside of the rectangle.

The problem is that it goes through each drag session slow - maybe 500~900ms each pull. The object sometimes disappears prior to the 'pull' grabbing it

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...