Jump to content

Mouse Wont Click The Color in the Rectangle


Recommended Posts

I'm Using Pixel search to find a color of an object, that a user puts a box around. However, even when I put the color in the box it wont start clicking. Heres the code ...

If PixelSearch($smallx+2,$smally+42,$smallx+2+$smallScanWidth,$smally+42+$smallScanHeight,$DropColor,$Sens) = $DropColor Then
        
    ;Wield Pickaxe in #1 Inventory Slot
            MouseMove( 835, 370)
            MouseClick("left", 835, 370)

        ;Wield Pickaxe in #2 Inventory Slot
            MouseMove( 880, 370)
            MouseClick( "left" , 880, 370 )
            

        ;Wield Pickaxe in #3 Inventory Slot
            MouseMove( 925, 370)
            MouseClick( "left" , 925, 370 )

        ;Wield Pickaxe in #4 Inventory Slot
            MouseMove( 970, 370)
            MouseClick( "left" , 970, 370 )

            
        ;drop #5 inventory spot
            MouseMove( 835, 475)
            MouseClick("right", 835, 475)
            MouseMove( 835, 520)
            MouseClick( "left" , 835, 520)
            
        ;drop #6 inventory spot
            MouseMove( 880, 475)
            MouseClick("right", 880, 475)
            MouseMove( 880, 520)
            MouseClick( "left" , 880, 520)
            
        ;drop #7 inventory spot
            MouseMove( 925, 475)
            MouseClick("right", 925, 475)
            MouseMove( 925, 520)
            MouseClick( "left" , 925, 520)
            
This is where the color is, but it does the above first. It is done this way so that when this object is picked up, the sequence of events begins until the object is deleted.
        ;drop #8 inventory spot
            MouseMove( 970, 475)
            MouseClick("right", 970, 475)
            MouseMove( 970, 520)
            MouseClick( "left" , 970, 520)
    Endif

Please enlighten me =)

Link to comment
Share on other sites

I'm Using Pixel search to find a color of an object, that a user puts a box around. However, even when I put the color in the box it wont start clicking. Heres the code ...

If PixelSearch($smallx+2,$smally+42,$smallx+2+$smallScanWidth,$smally+42+$smallScanHeight,$DropColor,$Sens) = $DropColor Then
        
;Wield Pickaxe in #1 Inventory Slot
            MouseMove( 835, 370)
            MouseClick("left", 835, 370)

    ;Wield Pickaxe in #2 Inventory Slot
            MouseMove( 880, 370)
            MouseClick( "left" , 880, 370 )
            

    ;Wield Pickaxe in #3 Inventory Slot
            MouseMove( 925, 370)
            MouseClick( "left" , 925, 370 )

    ;Wield Pickaxe in #4 Inventory Slot
            MouseMove( 970, 370)
            MouseClick( "left" , 970, 370 )

            
    ;drop #5 inventory spot
            MouseMove( 835, 475)
            MouseClick("right", 835, 475)
            MouseMove( 835, 520)
            MouseClick( "left" , 835, 520)
            
    ;drop #6 inventory spot
            MouseMove( 880, 475)
            MouseClick("right", 880, 475)
            MouseMove( 880, 520)
            MouseClick( "left" , 880, 520)
            
    ;drop #7 inventory spot
            MouseMove( 925, 475)
            MouseClick("right", 925, 475)
            MouseMove( 925, 520)
            MouseClick( "left" , 925, 520)
            
This is where the color is, but it does the above first. It is done this way so that when this object is picked up, the sequence of events begins until the object is deleted.
    ;drop #8 inventory spot
            MouseMove( 970, 475)
            MouseClick("right", 970, 475)
            MouseMove( 970, 520)
            MouseClick( "left" , 970, 520)
    Endif

Please enlighten me =)

PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step]] )

Return Value

Success: Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y)

Failure: Sets @error to 1 if color is not found.

so you beter done something like

$data = PixelSearch($smallx+2,$smally+42,$smallx+2+$smallScanWidth,$smally+42+$smallScanHeight,$DropColor,$Sens)
if $data <> 1 then
        
    ;Wield Pickaxe in #1 Inventory Slot
            MouseMove( 835, 370)
            MouseClick("left", 835, 370)

        ;Wield Pickaxe in #2 Inventory Slot
            MouseMove( 880, 370)
            MouseClick( "left" , 880, 370 )
            

        ;Wield Pickaxe in #3 Inventory Slot
            MouseMove( 925, 370)
            MouseClick( "left" , 925, 370 )

        ;Wield Pickaxe in #4 Inventory Slot
            MouseMove( 970, 370)
            MouseClick( "left" , 970, 370 )

            
        ;drop #5 inventory spot
            MouseMove( 835, 475)
            MouseClick("right", 835, 475)
            MouseMove( 835, 520)
            MouseClick( "left" , 835, 520)
            
        ;drop #6 inventory spot
            MouseMove( 880, 475)
            MouseClick("right", 880, 475)
            MouseMove( 880, 520)
            MouseClick( "left" , 880, 520)
            
        ;drop #7 inventory spot
            MouseMove( 925, 475)
            MouseClick("right", 925, 475)
            MouseMove( 925, 520)
            MouseClick( "left" , 925, 520)
            
        ;drop #8 inventory spot
            MouseMove( 970, 475)
            MouseClick("right", 970, 475)
            MouseMove( 970, 520)
            MouseClick( "left" , 970, 520)
Endif

or im reading something wrong in help file ^^

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

This line is wrong:

If PixelSearch($smallx+2,$smally+42,$smallx+2+$smallScanWidth,$smally+42+$smallScanHeight,$DropColor,$Sens) = $DropColor ThenoÝ÷ ØÏ¥Iæ«r¬²çz˺X­Â)e­ën®v§jºÚÉ»­êÞÊ­ç(«x"¶Úrh¬ìµæjëh×6If IsArray(PixelSearch($smallx+2,$smally+42,$smallx+2+$smallScanWidth,$smally+42+$smallScanHeight,$DropColor,$Sens)) Then
Link to comment
Share on other sites

with variable you can get the position of PixelSearch

so whats the point of checking if the data is IsArray or not if you dont load it in a variable? :)

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

with variable you can get the position of PixelSearch

so whats the point of checking if the data is IsArray or not if you dont load it in a variable? :)

$PixelXY = PixelSearch($smallx+2,$smally+42,$smallx+2+$smallScanWidth,$smally+42+$smallScanHeight,$DropColor,$Sens)If IsArray($PixelXY)Then

Edited by weaponx
Link to comment
Share on other sites

If IsArray? I know what they are, but can you tech my how to implement them in my code?

if your screen resolution is 800*600 and you need to scan it all to finde your color

global $color = "0xFFFFFF" ;<== put heare your pixel color 4 search
$PixelXY = PixelSearch (0,0,800,600,$color) ;<== 
If IsArray($PixelXY)Then
    
    
    
    ;<== you dont need this part
    MsgBox(0,"PixelSearch", "color "&$color&" finded on locaton x="&$PixelXY[0]&" y="&$PixelXY[1],5)
    TrayTip("Look at the mouse...", "...and youl see the location on where is that pixel", 5, 1)
    sleep(5000)
    
    MouseMove($PixelXY[0],$PixelXY[1],100)
    
    sleep(5000)
    TrayTip("clears any tray tip","",0)
    ;<== but its good to know where your pixel is finded ^^
    
    
    
    MouseMove( 835, 370)
    MouseClick("left", 835, 370)
    MouseMove( 880, 370)
    MouseClick( "left" , 880, 370 )
    
    MouseMove( 925, 370)
    MouseClick( "left" , 925, 370 )
    MouseMove( 970, 370)
    MouseClick( "left" , 970, 370 )
    
    MouseMove( 835, 475)
    MouseClick("right", 835, 475)
    MouseMove( 835, 520)
    MouseClick( "left" , 835, 520)
    
    MouseMove( 880, 475)
    MouseClick("right", 880, 475)
    MouseMove( 880, 520)
    MouseClick( "left" , 880, 520)
    
    MouseMove( 925, 475)
    MouseClick("right", 925, 475)
    MouseMove( 925, 520)
    MouseClick( "left" , 925, 520)
    
    MouseMove( 970, 475)
    MouseClick("right", 970, 475)
    MouseMove( 970, 520)
    MouseClick( "left" , 970, 520)
Endif

If Not IsArray($PixelXY)Then
    MsgBox(0,"PixelSearch", "Sry but we dident finde your color "&$color,5)
EndIf

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
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...