Sign in to follow this  
Followers 0
Golbez

help plz

6 posts in this topic

is there a command to make my script to look for a picture?

this is my script:

$Restart = 1
      
  $monster = Iniread ("GolBot.ini", "Settings", "monster", "")
  $top = Iniread ("GolBot.ini", "Settings", "top", "")
  $bottom = Iniread ("GolBot.ini", "Settings", "bottom", "")
  $left = Iniread ("GolBot.ini", "Settings", "left", "")
  $right = Iniread ("GolBot.ini", "Settings", "right", "")
  $Server = Iniread ("GolBot.ini", "Account", "Server", "")
  $SRoadPath = Iniread ("GolBot.ini", "Account","SRoadPath", "")
  $SRoadExe = Iniread ("GolBot.ini", "Account","SRoadExe", "")
  $Launcher = Iniread ("GolBot.ini", "Account", "Launcher", "")
  $Client = Iniread ("GolBot.ini", "Account", "Client", "")
  $Account = Iniread ("GolBot.ini", "Account", "Account", "")
  $Password = Iniread ("GolBot.ini", "Account", "Password", "")
  $LauncherDelay = Iniread ("GolBot.ini", "Account", "LauncherDelay", "")
  $ClientDelay = Iniread ("GolBot.ini", "Account", "ClientDelay", "")
  $RestartDelay = Iniread ("GolBot.ini", "Account", "RestartDelay", "")
  $AccountDelay = Iniread ("GolBot.ini", "Account", "AccountDelay", "")
  $PasswordDelay = Iniread ("GolBot.ini", "Account", "PasswordDelay", "")
  
  Func _iPixelSearch($i_left, $i_top, $i_right, $i_bottom, $i_color, $i_shade = 0, $i_step = 1)
      Local $av_ret[3]
      Local $ai_coords = PixelSearch($i_left, $i_top, $i_right, $i_bottom, $i_color, $i_shade, $i_step)
      If @error Then
          Return 0
      EndIf
      $av_ret[0] = PixelGetColor($ai_coords[0], $ai_coords[1])
      $av_ret[1] = $ai_coords[0]
      $av_ret[2] = $ai_coords[1]
         ;{$av_ret} return[0] = the found pixel color
         ;{$av_ret} return[1] = x coord
         ;{$av_ret} return[2] = y coord
      Return $av_ret
  EndFunc;==>_iPixelSearch
  
  
  $window = Iniread ("GolBot.ini", "Account", "Client", "")
  WinActivate($window, "")
  AutoItSetOption ( "PixelCoordMode", 2 )
  AutoItSetOption ( "MouseCoordMode", 2 )
     ;0 = relative coords to the active window
     ;1 = absolute screen coordinates (default)
     ;2 = relative coords to the client area of the active window
      
  $coord = PixelSearch( $left, $top, $right, $bottom, $monster, 10, 10)
  If Not @error Then
      If IsArray($coord) Then mouseclick("left", $coord[0], $coord[1], 1)
  EndIf
     ;MsgBox(4, "coord[0]", $coord[0], .5)
     ;MsgBox(4, "coord[1]", $coord[1], .5)

.ini

[Account]
    Server =  0
    SRoadPath = "C:\Program Files\<game>"
    SRoadExe = "<game>.exe"
    Launcher = "<game> Online Launcher"
    Client = "<game>t"
    Account = "myaccount"
    Password = "mypassword"
    
  ; ******************************
  ;* DONT TOUCH UNDER THIS POINT! *
  ; ******************************
    LauncherDelay = 1000  ;DONT TOUCH THIS!
    ClientDelay = 2000  ;DONT TOUCH THIS!
    RestartDelay = 1000  ;DONT TOUCH THIS!
    AccountDelay = 1000  ;DONT TOUCH THIS!
    PasswordDelay = 500  ;DONT TOUCH THIS!
    
    [Settings]
    monster = 0xD33C26
    
  ; ******************************
  ;* DONT TOUCH UNDER THIS POINT! *
  ; ******************************
   top = 0        ;y        DONT TOUCH THIS!
   bottom = 784   ;Hight        DONT TOUCH THIS!
    left = 0      ;x        DONT TOUCH THIS!
   right = 1024   ;Weith        DONT TOUCH THIS!

and this is the pic i would like it to look for:

Posted Image

the backround of the pic should be clear but i save it at the wroung file type. i can easly fix with this with photoshop.

but, its out of the same and i need the bot to find it.. the pixelsearch is not working be cause i realized the monsters change color on the distance from your are from the monster. the name of the monster is the only thing that stays constant.

Share this post


Link to post
Share on other sites



Does your ini work like the way you have it set up?

You could get the value of the Picture with PixelCheckSum(), and search for the value in a certain area.

Before you ask "how", take a look at the help file.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

yes my ini works

Edit: so this "PixelCheckSum()" will say if smethin changes?

Edit: i dont understand how it will find my pic.

Edit: i dont no if this will help you guys but heres a pic from the game

Posted Image

Edited by Golbez

Share this post


Link to post
Share on other sites

so i guess no one can help me on this? or theres no command that can do it?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

so i guess no one can help me on this? or theres no command that can do it?

Have you tried to 'help yourself' first? You seem to always post stuff like this without anything you attempted!

Golbez... what picture specifically are you trying to find? Is it that whole thing?

PixelCheckSum will give you a value of an area, if you check that area, and the value is the same, then the picture is the same.

; Wait until something changes in the region 0,0 to 50,50

; Get initial checksum
$checksum = PixelChecksum(0,0, 50,50)

; Wait for the region to change, the region is checked every 100ms to reduce CPU load
While $checksum = PixelChecksum(0,0, 50, 50)
  Sleep(100)
WEnd

MsgBox(0, "", "Something in the region has changed!")
In the helpfile example, it will show you if the value of an area has changed, there for you know that it isn't the same as before, but If I'm looking for something specific such as a picture (Very Time Consuming, and could be a drain on the CPU), then I would approach it just a bit different.

1. When I have my picture I want, I would use the AutoInfo Tool to find the Coords where I want to get my value on that picture. Let's say, my picture is 100 pixels wide and 100 pixels high.

2. I would get that value that I'm looking for on that picture, and paste it to my clipboard, so I have a definate value, without having to write it down (I'm lazy, or just don't have the time).

Example:

$CHECKSUM = PixelChecksum(0,0, 100,100)
ClipPut($CHECKSUM); open notepad and paste the value
;MsgBox(0, '', "The Value of the area your looking for is: " & $CHECKSUM)

3. Now that I have my value for my picture, I'll want to use it in my code, where it applies.

Dim $PIC1 = 4213575378; value of my picture

If PixelCheckSum(0, 0, 100, 100) == $PIC1 Then
  ; Do something
EndIf

4. Always remember, that it is not a "quick" process, therefore the larger the area to cover, the longer it will take to return a result.

Edit:

Since I used the value in a variable, I just replaced the value I had after PixelCheckSum() with the variable name rather than the actual value.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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