Sign in to follow this  
Followers 0
TerryisBroke

Pixel Checking?

6 posts in this topic

#1 ·  Posted (edited)

Hey i am trying to make a script for a game that allows me to constantly do the same thing over and over again until something starts attacking me and than after i kill the thing it goes back to what it was doing. I'm not really sure how to work the pixel check along with the looping. I have been reading the help documents and testing things but it doesn't really turn out that well.

Run("C:\Program Files\Dofus\Dofus.exe")
Sleep(3000)
WinMove("Dofus", "", 0, 0,1024,768 )
Sleep(3000)
MouseClick("left", 201, 293, 1)
Send("Blank")
MouseClick("left", 256, 371, 1)
Send("Blank")
Send("{ENTER}")
Sleep(10000)
Do
MouseClick("left", 186, 434, 1)
MouseClick("left", 186, 434, 1)
Sleep(10000)
MouseClick("left", 215, 458, 1)
MouseClick("left", 215, 458, 1)
Sleep(10000)
MouseClick("left", 786, 174, 1)
MouseClick("left", 813, 202, 1)
Sleep(16000)
MouseClick("left", 756, 145, 1)
MouseClick("left", 781, 175, 1)
Sleep(16000)
MouseClick("left", 610, 175, 1)
MouseClick("left", 637, 215, 1)
Sleep(16000)
Mouseclick("Left", 653, 170, 1)
MouseClick("left", 679, 210, 1)
Sleep(16000)
MouseClick("left", 251, 244, 1)
MouseClick("left", 276, 280, 1)
Sleep(16000)
MouseClick("left", 213, 261, 1)
MouseClick("left", 243, 298, 1)
Sleep(16000)
MouseClick("left", 213, 392, 1)
MouseClick("left", 239, 430, 1)
Sleep(16000)
MouseClick("left", 176, 360, 1)
MouseClick("left", 201, 396, 1)
Sleep(16000)
Mouseclick("left", 175, 418, 1)
MouseClick("left", 195, 457, 1)
Sleep(16000)
MouseClick("left", 140, 391, 1)
MouseClick("left", 169, 433, 1)
Sleep(16000)
MouseClick("left", 139, 338, 1)
MouseClick("left", 165, 378, 1)
Sleep(16000)
MouseClick("left", 99, 377, 1)
MouseClick("left", 122, 419, 1)
Until
Edited by TerryisBroke

Share this post


Link to post
Share on other sites



use

@DesktopHeight - Height of the desktop screen in pixels. (vertical resolution)

@DesktopWidth - Width of the desktop screen in pixels. (horizontal resolution)

To Check Pixel of screen ?


-= [font="Verdana"]A Men Who believes in himself and not circumstances is the real Winner =-[/font]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This is what I would do (well I would use more time but you can do so because you know exactly what you want to do... Thanks appreciated :(

(and BTW it worked for me (I removed the .exe and stuff and made the pixelsearch one spot on my background... I went up to the top corner for 30-60 sec and then came down to the spot)

Tell me if it works! :P and its really sloppy maybe you could fix it muttley

and I added start and exit hotkeys.. change them if you want :)

And because I didnt know how often that thing would come I just added it in randomly... Just copy/paste it inbetween sleep and mousemove if its a normal thing... or else remove you could remove the other ones

#RequireAdmin;Remove this if you are not running vista!
Opt("GuiOnEventMode",1)
#include <GUIConstants.au3>

HotKeySet( "{ESC}","_Exit");escape = exit
hotkeyset("{F2}","_Pause");F2 = pause
hotkeyset("{F1}", "_start");F1 = start
GUISetOnEvent(-1,"Loop")

While 1;keeps the autoscript running by just looping sleep until something that changes the script comes along :)
    sleep(10)
WEnd



func _Exit(); if you clicked Esc then this is the func that comes
    Exit
EndFunc

func _pause()
    while 1
        sleep(10)
    WEnd
    loop();Goes to the loop function..
EndFunc

    



func _start();All the script that you have written!
    Run("C:\Program Files\Dofus\Dofus.exe")
    Sleep(3000)
    WinMove("Dofus", "", 0, 0,1024,768 )
    Sleep(3000)
    MouseClick("left", 201, 293, 1)
    Send("Blank")
    MouseClick("left", 256, 371, 1)
    Send("Blank")
    Send("{ENTER}")
    Sleep(10000)
    Loop();Goes to the function "Loop"
EndFunc



func Loop()
;The pixelsearch color here (the 0xBLABLA               (under here) is the name of the color go through the help file or search pixelsearch on the forums.
    $Attacker=Pixelsearch(0, 0, @DesktopWidth, @DesktopHeight,0xD0D0D0,2,2)
;Pixelsearch(0, 0, @DesktopWidth, @DesktopHeight,Your color![Hex code],Enter how much color difference,Enter how many pixels the pixelsearch will skip (to use less resources from the PC))
    If IsArray $Attacker=1 Then
        $x=$Attacker[0]
        $y=$Attacker[1]
        mouseclick("left",$Attacker[0],$Attacker[1],1,10);Clicks the pixel that the pixelsearch found.
;Enter whatever you do to kill that monster or whatever.....
        
        
        Loop();back to the start of the script
    Else;If the pixelsearch didnt find anything then= it does all your stuff....
        MouseClick("left", 186, 434, 1)
        MouseClick("left", 186, 434, 1)
        Sleep(10000)
        MouseClick("left", 215, 458, 1)
        MouseClick("left", 215, 458, 1)
        Sleep(10000)
        MouseClick("left", 786, 174, 1)
        MouseClick("left", 813, 202, 1)
        Sleep(16000)
        MouseClick("left", 756, 145, 1)
        MouseClick("left", 781, 175, 1)
        Sleep(16000)
        
        $Attacker2=Pixelsearch(0, 0, @DesktopWidth, @DesktopHeight,0xD0D0D0,2,2);I dont know how often the thing comes but if it attacks i Guess you will be dead within 200 seconds...
;But you can spam this Pixelsearch thing between MouseClick("left", 781, 175, 1) and sleep(16000/10000)
;just copy and paste
        if not @error then
        $x=$Attacker2[0]
        $y=$Attacker2[1]
        mouseclick("left",$Attacker2[0],$Attacker2[1],1,10)
;ADD whatever you do to kill the mob here!
        EndIf
        
        MouseClick("left", 610, 175, 1)
        MouseClick("left", 637, 215, 1)
        Sleep(16000)
        Mouseclick("Left", 653, 170, 1)
        MouseClick("left", 679, 210, 1)
        Sleep(16000)
        MouseClick("left", 251, 244, 1)
        MouseClick("left", 276, 280, 1)
        Sleep(16000)
        
        
        $Attacker3=Pixelsearch(0, 0, @DesktopWidth, @DesktopHeight,0xD0D0D0,2,2);I dont know how often the thing comes but if it attacks i Guess you will be dead within 200 seconds...
;But you can spam this Pixelsearch thing between MouseClick("left", 781, 175, 1) and sleep(16000/10000)
;just copy and paste
        if not @error then
        $x=$Attacker3[0]
        $y=$Attacker3[1]
        mouseclick("left",$Attacker3[0],$Attacker3[1],1,10)
;ADD whatever you do to kill the mob here!
    EndIf
    
    
        MouseClick("left", 213, 261, 1)
        MouseClick("left", 243, 298, 1)
        Sleep(16000)
        MouseClick("left", 213, 392, 1)
        MouseClick("left", 239, 430, 1)
        Sleep(16000)
        MouseClick("left", 176, 360, 1)
        MouseClick("left", 201, 396, 1)
        Sleep(16000)
        
        
        $Attacker4=Pixelsearch(0, 0, @DesktopWidth, @DesktopHeight,0xD0D0D0,2,2);I dont know how often the thing comes but if it attacks i Guess you will be dead within 200 seconds...
;But you can spam this Pixelsearch thing between MouseClick("left", 781, 175, 1) and sleep(16000/10000)
;just copy and paste
        if not @error then
        $x=$Attacker4[0]
        $y=$Attacker4[1]
        mouseclick("left",$Attacker4[0],$Attacker4[1],1,10)
;ADD whatever you do to kill the mob here!
        EndIf
    
    
        Mouseclick("left", 175, 418, 1)
        MouseClick("left", 195, 457, 1)
        Sleep(16000)
        MouseClick("left", 140, 391, 1)
        MouseClick("left", 169, 433, 1)
        Sleep(16000)
        MouseClick("left", 139, 338, 1)
        MouseClick("left", 165, 378, 1)
        Sleep(16000)
        MouseClick("left", 99, 377, 1)
        MouseClick("left", 122, 419, 1)
        Loop()
    EndIf
    Loop()
EndFunc
Edited by pwnt

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ok i understand how this would work but the script wont run.

EDIT: Nevermind i modified a couple things and it works perfect thank you muttley

Edited by TerryisBroke

Share this post


Link to post
Share on other sites

Ok i got a new problem now uhhh everytime i run the script it just cuts out and gives me this error

If IsArray $Attacker=1 Then
If ^ ERROR
>Exit code: 1   Time: 38.156

Share this post


Link to post
Share on other sites

add

#include<Array.au3>


-= [font="Verdana"]A Men Who believes in himself and not circumstances is the real Winner =-[/font]

Share this post


Link to post
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
Sign in to follow this  
Followers 0