Jump to content

PixelSearch in fullscreen mode


Recommended Posts

Hey guys, i've been working on a bot for an online game. Up until the other day, you could run the game in windowed mode, but the recent update removed that ability. The bot that i've made worked great in window mode, but when the game is in full screen, it doesn't work at all.

The code below isn't the bot, just a part of it that i made to test the color detection functions.

;Globals go here

Global $DemonColor = False
Global $DemonHealth = False
Global $PlayerHealth = False

;End of globals

HotKeySet("{F2}", "Getdc")
HotKeySet("{F3}", "Getdh")
HotKeySet("{F4}", "Getph")
HotKeySet("{ESC}", "Gexit")

While $DemonColor = False
    Sleep(100)
WEnd

While $DemonHealth = False
    Sleep(100)
WEnd

While $PlayerHealth = False
    Sleep(100)
WEnd

;MsgBox(0, "Colors", $DemonColor & " - " &  $DemonHealth & " - " & $PlayerHealth)

While 1
    
    $GetD = SearchDemon()
    
    If $GetD = False Then
        MsgBox(0, "Info", "Found Nothing. " & $DemonColor)
    Else
        ;MsgBox(0, "Info", "Found: " & $GetD[0] & ", " & $GetD[1])
        ControlClick("KalOnline", "", "", "main", 1, $GetD[0], $GetD[1])
    EndIf
    
WEnd

Func SearchDemon()
    
    $initial = PixelSearch(0, 100, 800, 600, $DemonColor, 25)
    
    if @error Then
        Return False
    Else
        Return $initial
    EndIf
EndFunc


Func Getdc()
    
    $dc = MouseGetPos()
    $DemonColor = PixelGetColor($dc[0], $dc[1]) 
    $DemonColor = Hex($DemonColor, 6)
    
EndFunc

Func Getdh()
    
    $dh = MouseGetPos()
    $DemonHealth = PixelGetColor($dh[0], $dh[1])
    $DemonHealth = Hex($DemonHealth, 6)
    
    
EndFunc

Func Getph()
    
    $ph = MouseGetPos()
    $PlayerHealth = PixelGetColor($ph[0], $ph[1])
    $PlayerHealth = Hex($PlayerHealth, 6)
    
EndFunc

Func Gexit()
    Exit 0
EndFunc

Half the time after it does the $GetD = SearchDemon() function, it returns pixel coordinates but they're completely off. The color i pick is pink (the demons are pink because i deleted the textures for them), and it clicks on a tree (brown)... There was an event where SearchDemon() returned false and the msgbox said the color that i picked for the demons was C4C4C4, which is light gray.

Basically, i'm asking what's going on here?

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