Jump to content

Pixel Searching


Recommended Posts

Ok ok ok i have a lot of questions for this program. This one if answered should occupy me for a looooooong time :evil: I play this game RoseOnline and I use pixel search to point out monsters and i have it double click them to attack. The problem is that i get the colors down, but there are so many on the monster, and there are the same colors almost everywhere else.... If I dont search the entire screen I most likely not pick out a monster. If I only search a certain area i still end up clicking absolutely nothing. I have no idea how find the monster any other ways besides random mouseclick and we all know that won't work... well here ill just give you the scripts i've written for this.

Dim $ClickMouse, $MousePrimary, $MouseSecondary, $ExitKey
Dim $Color, $Left, $Top, $Right, $Bottom, $SearchResult, $CheckSwap

$CheckSwap = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
If $CheckSwap = 1 Then
    $MousePrimary = "right"
    $MouseSecondary = "left"
Else
    $MousePrimary = "left"
    $MouseSecondary = "right"
EndIf

; *************************************************;
; Change your settings here                     ;
; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv;
$Color = 0x8C2800
$Left = 0
$Top = 0
$Right = 1024
$Bottom = 768
$ClickMouse = $MousePrimary
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^;
; Change your settings here                     ;
; *************************************************;


While 1
    MouseClickDrag("right", 1000, 400, 100, 400)
    $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color)
    If Not @error Then
        MouseClick($ClickMouse, $SearchResult[0], $SearchResult[1], 2, 0);seach and attack monster
    EndIf
    Sleep(20000);kill time
    Send("{F3}");pick up drops
WEnd

thats for finding and killing a monster...

this ones for searching my health bar and pressing a key to heal (problem - wont heal)

Dim $ClickMouse, $MousePrimary, $MouseSecondary, $ExitKey
Dim $Color, $Left, $Top, $Right, $Bottom, $SearchResult, $CheckSwap

$CheckSwap = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
If $CheckSwap = 1 Then
    $MousePrimary = "right"
    $MouseSecondary = "left"
Else
    $MousePrimary = "left"
    $MouseSecondary = "right"
EndIf

; *************************************************;
; Change your settings here                     ;
; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv;
$Color = 0xFF9E63
$Left = 66
$Top = 60
$Right = 90
$Bottom = 75
$ClickMouse = $MousePrimary
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^;
; Change your settings here                     ;
; *************************************************;


While 1
    $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color);supoosed to search health bar to tell when health is low and heal
    If @error Then
        Send("{F4}");hotkey for health item
    Else
        Sleep(100)
    EndIf
WEnd

and don't worry, i have a main window that starts these so they dont just run all crazy... but ive tried about everything that ive seen and heard of. So theres anything i havent done please tell me.... this is so frustrating (if you wonder why i keep recking my brain over this, well look at my signature :) )

[quote]I don't like to think, Therefore I ChEaT[/quote]

Link to comment
Share on other sites

  • Moderators

Ok ok ok i have a lot of questions for this program. This one if answered should occupy me for a looooooong time  :evil:  I play this game RoseOnline and I use pixel search to point out monsters and i have it double click them to attack. The problem is that i get the colors down, but there are so many on the monster, and there are the same colors almost everywhere else.... If I dont search the entire screen I most likely not pick out a monster. If I only search a certain area i still end up clicking absolutely nothing. I have no idea how find the monster any other ways besides random mouseclick and we all know that won't work... well here ill just give you the scripts i've written for this.

Dim $ClickMouse, $MousePrimary, $MouseSecondary, $ExitKey
Dim $Color, $Left, $Top, $Right, $Bottom, $SearchResult, $CheckSwap

$CheckSwap = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
If $CheckSwap = 1 Then
    $MousePrimary = "right"
    $MouseSecondary = "left"
Else
    $MousePrimary = "left"
    $MouseSecondary = "right"
EndIf

; *************************************************;
; Change your settings here                    ;
; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv;
$Color = 0x8C2800
$Left = 0
$Top = 0
$Right = 1024
$Bottom = 768
$ClickMouse = $MousePrimary
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^;
; Change your settings here                    ;
; *************************************************;
While 1
    MouseClickDrag("right", 1000, 400, 100, 400)
    $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color)
    If Not @error Then
        MouseClick($ClickMouse, $SearchResult[0], $SearchResult[1], 2, 0);seach and attack monster
    EndIf
    Sleep(20000);kill time
    Send("{F3}");pick up drops
WEnd

thats for finding and killing a monster...

this ones for searching my health bar and pressing a key to heal (problem - wont heal)

Dim $ClickMouse, $MousePrimary, $MouseSecondary, $ExitKey
Dim $Color, $Left, $Top, $Right, $Bottom, $SearchResult, $CheckSwap

$CheckSwap = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
If $CheckSwap = 1 Then
    $MousePrimary = "right"
    $MouseSecondary = "left"
Else
    $MousePrimary = "left"
    $MouseSecondary = "right"
EndIf

; *************************************************;
; Change your settings here                    ;
; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv;
$Color = 0xFF9E63
$Left = 66
$Top = 60
$Right = 90
$Bottom = 75
$ClickMouse = $MousePrimary
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^;
; Change your settings here                    ;
; *************************************************;
While 1
    $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color);supoosed to search health bar to tell when health is low and heal
    If @error Then
        Send("{F4}");hotkey for health item
    Else
        Sleep(100)
    EndIf
WEnd

and don't worry, i have a main window that starts these so they dont just run all crazy... but ive tried about everything that ive seen and heard of. So theres anything i havent done please tell me.... this is so frustrating (if you wonder why i keep recking my brain over this, well look at my signature :) )

<{POST_SNAPBACK}>

Just out of curiousity, did you try doing a screen shot when the monster is on the screen, and save it to .bmp? This way you could take your time to go through the monster and try to find a unique color from the rest of the screen?

P.S.

$ClickMouse = $MousePrimary ; Rather redundant don't you think?

Sorry I can't be of more help, but this is not a game I play, however, I do remember someone putting a lot of script questions up about it about a month ago.

Have you tried Search "RoseOnline" in the forum? Might give you more ideas than I've given.

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.

Link to comment
Share on other sites

Yeah, ive taken plenty of screenshots to find a unique pixel color. The only problem is when i do find one and i put it in the $color spot and i do the search threw the game it wont find it. Its such a small spot that it just passes it up and this is a 3d game so its not like the pixel will always show up in the right spot everytime, so i was wondering how you would search many pixels and for it to click the 1st one it finds

i thought maybe like this

$Color = 0x500000 + 0x005000 + 0x000050
PixelSearch($Left, $Top, $Right, $Bottom, $Color)

somtin like that maybe?

[quote]I don't like to think, Therefore I ChEaT[/quote]

Link to comment
Share on other sites

Being a 3D game it would seem quite likely that no exact pixel colour would ever be guaranteed to appear due to all sorts of factors such as lighting, angles, rotation etc.

You could try taking a screenshot of the monster at one point and then another screen shot a mere frame or two later, and most likely you'll have a quite different set of pixel colours on the monster.

Link to comment
Share on other sites

True, i used this

#include <file.au3>

HotKeySet("{HOME}", "Go")

While 1
   Sleep(1)
WEnd

Func Go()
$x = Random(670, 700, 1)
$y = Random(500, 585, 1)
$Pixel = PixelGetColor ( $x , $y )

MsgBox(0,"The hex color is", Hex($Pixel, 6))


_FileWriteLog(@ScriptDir & "\my.log", Hex($Pixel, 6))
EndFunc

then i do a lil editing to log file adding key = and [section1] make it an .ini and i use about 500 colors, but its still not workin so good, i guess theres just no way..

[quote]I don't like to think, Therefore I ChEaT[/quote]

Link to comment
Share on other sites

  • Moderators

I was thinking looking at your code, if what LxP says is true (and he's usually right), that you need to add a shade variation at the end of your PixelSearch().

Below, you'll see that I find my colour "Not @error", then take the Coords + -1 to see the colour next to it with a shade variation color on that, then if "Not @error", do another search to the other side to see if I can find another variation of the other color we are looking for.

If all 3 are "Not @error" then we should have our monster as long as we have the right "shade variations".

Example:

; *************************************************;
; Change your settings here                   ;
; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv;
$Color = 0x8C2800
$Color2 = 0xFFD700; just an example Colour 1 pixel off
$Color3 = 0x999999; again just an example of color one pixel off
$Left = 0
$Top = 0
$Right = 1024
$Bottom = 768
$ClickMouse = $MousePrimary
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^;
; Change your settings here                   ;
; *************************************************;
While 1
   MouseClickDrag("right", 1000, 400, 100, 400)
   $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color, 10)
   If Not @error Then
      $SResult2 = PixelSearch($SearchResult[0] + -1, $SearchResult[1] + -1, $SearchResult[0] + -1, $SearchResult[1] + -1, $Color2, 10)
      If Not @error Then
         $Sresult3 = PixelSearch($SearchResult[0] + 1, $SearchResult[1] + 1, $SearchResult[0] + 1, $SearchResult[1] + 1, $Color3, 10)
         If Not @error Then
            MouseClick($ClickMouse, $SearchResult[0], $SearchResult[1], 2, 0);seach and attack monster
         EndIf
      EndIf
   EndIf
   Sleep(20000);kill time
   Send("{F3}");pick up drops
WEnd

It's late and I'm tired, but it makes sense to me... Good Luck.

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.

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