Jump to content

Gui read pixel colour problem.


Recommended Posts

Hi i need some help with a hp/mp monitor for a game.

Thanks if you can help.

Firstly what is wrong with this code.

PixelGetColor(GUICtrlRead($mpbotpercent)) = $pixelmp

And here is the whole script.

Thanks again in advance.

;*********************************************|Variables Defined|*********************************************
$currentColor = 0
Dim $Width, $Height, $pixel, $Runbot, $hpbot, $mpbot, $Aboutbot, $aboutbot, $begin, $dif, $Channel3x, $Channel3y, $Runbot, $hpbot, $mpbot, $Screen, $hpbotpercent, $mpbotpercent
$count = 0  
;*********************************************|Variables Defined|*********************************************

;*********************************************|GUI|*********************************************
    #include <GUIConstants.au3>
Fileinstall("C:\Program Files\RoseBots\Images\Background.jpg","C:\Program Files\RoseBots\Images\Background.jpg")
Fileinstall("C:\Program Files\RoseBots\Images\LS.bmp","C:\Program Files\RoseBots\Images\LS.bmp")
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
Opt("GUIOnEventMode",1)
GUICreate ( "Life Support Bot By ScoreKeeper", 400,335)
GUISetBKcolor(6119597)
GUICtrlCreatePic("C:\Program Files\RoseBots\Images\Background.jpg",0,0,400,335,$WS_EX_TRANSPARENT) 
$1 = GUICtrlCreateLabel ( "1. Login to ROSE and Alt-Tab back here", 20, 10, 195, 15)
$2 = GUICtrlCreateLabel ( "2. Select desired Hp Shotcut and %.", 20, 25, 180, 15)
$3 = GUICtrlCreateLabel ( "3. Select desired Mp Shotcut and %.", 20, 85, 180, 15)
$4 = GUICtrlCreateLabel ( "4. Select screen mode.", 20, 145, 110, 15)
$6 = GUICtrlCreateLabel ( "The Esc button will exit the script.", 20, 250, 160, 15)
$7 = GUICtrlCreateLabel ( "The Pause button will pause the script.", 20, 265, 185, 15)
$8 = GUICtrlCreateLabel ( "Life Support Bot by ScoreKeeper AKA Darren Willows !", 20, 295, 270, 15)
$9 = GUICtrlCreateLabel ( "www.GamerzPlanet.net Copyright© 2005", 20, 310, 200, 15)
GUICtrlSetColor($1,16768341)
GUICtrlSetColor($2,16768341)
GUICtrlSetColor($3,16768341)
GUICtrlSetColor($4,16768341)
GUICtrlSetColor($6,16768341)
GUICtrlSetColor($7,16768341)
GUICtrlSetColor($8,16768341)
GUICtrlSetColor($9,16768341)
GUICtrlCreatePic("C:\Program Files\RoseBots\Images\LS.bmp",315,250,85,85,0,$WS_EX_STATICEDGE)
;*********************************************|GUI|*********************************************

;*********************************************|settings|********************************************


*

$hpbot = GUICtrlcreatecombo( "F1", 75, 50, 100)
GUICtrlSetData(-1,"F2")
GUICtrlSetData(-2,"F3")
GUICtrlSetData(-3,"F4")
GUICtrlSetData(-4,"F5")
GUICtrlSetData(-5,"F6")
GUICtrlSetData(-6,"F7")
GUICtrlSetData(-7,"F8")
$hpbotpercent = GUICtrlcreatecombo( "10%", 200, 50, 100)
GUICtrlSetData(-1,"20%")
GUICtrlSetData(-2,"30%")
GUICtrlSetData(-3,"40%")
GUICtrlSetData(-4,"50%")
GUICtrlSetData(-5,"60%")
GUICtrlSetData(-6,"70%")
GUICtrlSetData(-7,"80%")
$mpbot = GUICtrlcreatecombo( "F1", 75, 110, 100)
GUICtrlSetData(-1,"F2")
GUICtrlSetData(-2,"F3")
GUICtrlSetData(-3,"F4")
GUICtrlSetData(-4,"F5")
GUICtrlSetData(-5,"F6")
GUICtrlSetData(-6,"F7")
GUICtrlSetData(-7,"F8")
$mpbotpercent = GUICtrlcreatecombo( "10%", 200, 110, 100)
GUICtrlSetData(-1,"20%")
GUICtrlSetData(-2,"30%")
GUICtrlSetData(-3,"40%")
GUICtrlSetData(-4,"50%")
GUICtrlSetData(-5,"60%")
GUICtrlSetData(-6,"70%")
GUICtrlSetData(-7,"80%")
$Screen = GUICtrlcreatecombo( "F1", 75, 110, 100)
GUICtrlSetData(-1,"F2")
GUICtrlSetData(-2,"F3")
GUICtrlSetData(-3,"F4")
GUICtrlSetData(-4,"F5")
GUICtrlSetData(-5,"F6")
GUICtrlSetData(-6,"F7")
;*********************************************|settings|********************************************


*
$Mode = GUICtrlcreatecombo( "Fullscreen", 75, 170, 100)
GUICtrlSetData(-1,"Windowed")
$Aboutbot = GUICtrlCreateButton ( "About", 115, 220, 75)
GUICtrlSetOnEvent($Aboutbot,"About")
$Runbot = GUICtrlCreateButton ( "Run bot", 20, 220, 75)
GUICtrlSetOnEvent($Runbot,"Runbot")
GUISetState(@SW_SHOW)
;*********************************************| GUI |*********************************************

;*********************************************|Run About |*********************************************
Func About()
Run ("C:\Program Files\RoseBots\Images\LS BOT.txt")
EndFunc
;*********************************************|Run About |*********************************************

;*********************************************|screen|*********************************************
Func OnChannel1()
    WinActivate("ROSE online")
    $Size = WinGetPos("ROSE online")
    $Width = $Size[2]
    $Height = $Size[3]
    If GUICtrlRead($Screen) = "Fullscreen" Then
        $Winx = 0
        $Winy = 0
    Else
        $Winx = 4
        $Winy = 30
        $Width = $Width - 8
        $Height = $Height - 34
    Endif
;*********************************************|screen|*********************************************

;*********************************************| pix hp |*********************************************
Func _hpbotpercent()
    Select
              Case GUICtrlRead($hpbotpercent) = "10%"
            ConsoleWrite(GUICtrlRead($hpbotpercent) & @LF)
           Send("86,75")
        Case GUICtrlRead($hpbotpercent) = "20%"
            ConsoleWrite(GUICtrlRead($hpbotpercent) & @LF)
         Send("99,75")      
        Case GUICtrlRead($hpbotpercent) = "30%"
            ConsoleWrite(GUICtrlRead($hpbotpercent) & @LF)
            Send("115,75")  
        Case GUICtrlRead($hpbotpercent) = "40%"
            ConsoleWrite(GUICtrlRead($hpbotpercent) & @LF)
            Send("124,75")
        Case GUICtrlRead($hpbotpercent) = "50%"
            ConsoleWrite(GUICtrlRead($hpbotpercent) & @LF)
            Send("160,75")
        Case GUICtrlRead($hpbotpercent) = "60%"
            ConsoleWrite(GUICtrlRead($hpbotpercent) & @LF)
           Send("171,75")
        Case GUICtrlRead($hpbotpercent) = "70%"
            ConsoleWrite(GUICtrlRead($hpbotpercent) & @LF)
            Send("184,75")  
        Case GUICtrlRead($hpbotpercent) = "80%"
            ConsoleWrite(GUICtrlRead($hpbotpercent) & @LF)
            Send("192,75")
    EndSelect
EndFunc
;*********************************************| pix hp |*********************************************

;*********************************************| pix mp |*********************************************
Func _hpbotpercent()
    Select
              Case GUICtrlRead($mpbotpercent) = "10%"
            ConsoleWrite(GUICtrlRead($mpbotpercent) & @LF)
         Send("86,88")
        Case GUICtrlRead($mpbotpercent) = "20%"
            ConsoleWrite(GUICtrlRead($mpbotpercent) & @LF)
         Send("99,88")      
        Case GUICtrlRead($mpbotpercent) = "30%"
            ConsoleWrite(GUICtrlRead($mpbotpercent) & @LF)
           Send("115,88")   
        Case GUICtrlRead($mpbotpercent) = "40%"
            ConsoleWrite(GUICtrlRead($mpbotpercent) & @LF)
           Send("124,88")
        Case GUICtrlRead($mpbotpercent) = "50%"
            ConsoleWrite(GUICtrlRead($mpbotpercent) & @LF)
            Send("160,88")
        Case GUICtrlRead($mpbotpercent) = "60%"
            ConsoleWrite(GUICtrlRead($mpbotpercent) & @LF)
           Send("171,88")
        Case GUICtrlRead($mpbotpercent) = "70%"
            ConsoleWrite(GUICtrlRead($mpbotpercent) & @LF)
            Send("184,88")  
        Case GUICtrlRead($mpbotpercent) = "80%"
            ConsoleWrite(GUICtrlRead($mpbotpercent) & @LF)
            Send("192,88")
    EndSelect
EndFunc

;*********************************************| pix mp |*********************************************

;*********************************************| Shortcut hp |*********************************************
$pixelhp = PixelGetColor(35,42)

Do 
Until PixelGetColor(GUICtrlRead($hpbotpercent) = $pixelhp
Then
;*********************************************| Shortcut hp |*********************************************  
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Send("{ESC}")
        Case    GUICtrlRead ($hpbot) = "F1"
            ConsoleWrite(GUICtrlRead($hpbot) & @LF)
            Send("{F1}")
        Case    GUICtrlRead ($hpbot) = "F2"
            ConsoleWrite(GUICtrlRead($hpbot) & @LF)
            Send("{F2}")
        Case    GUICtrlRead ($hpbot) = "F3"
            ConsoleWrite(GUICtrlRead($hpbot) & @LF)
            Send("{F3}")
        Case    GUICtrlRead ($hpbot) = "F4"
            ConsoleWrite(GUICtrlRead($hpbot) & @LF)
            Send("{F4}")
        Case    GUICtrlRead ($hpbot) = "F5"
            ConsoleWrite(GUICtrlRead($hpbot) & @LF)
            Send("{F5}")
        Case    GUICtrlRead ($hpbot) = "F6"
            ConsoleWrite(GUICtrlRead($hpbot) & @LF)
            Send("{F6}")
        Case    GUICtrlRead ($hpbot) = "F7"
            ConsoleWrite(GUICtrlRead($hpbot) & @LF)
            Send("{F7}")
        Case    GUICtrlRead ($hpbot) = "F8"
            ConsoleWrite(GUICtrlRead($hpbot) & @LF)
            Send("{F8}")
    EndSelect
WEnd
;*********************************************| Shortcut hp |*********************************************
Sleep (2500)

$pixelmp = PixelGetColor(36,58)


If PixelGetColor(GUICtrlRead($mpbotpercent)) = $pixelmp
Then
;*********************************************| Shortcut mp |*********************************************
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Send("{ESC}")
        Case    GUICtrlRead ($mpbot) = "F1"
            ConsoleWrite(GUICtrlRead($mpbot) & @LF)
            Send("{F1}")
        Case    GUICtrlRead ($mpbot) = "F2"
            ConsoleWrite(GUICtrlRead($mpbot) & @LF)
            Send("{F2}")
        Case    GUICtrlRead ($mpbot) = "F3"
            ConsoleWrite(GUICtrlRead($mpbot) & @LF)
            Send("{F3}")
        Case    GUICtrlRead ($mpbot) = "F4"
            ConsoleWrite(GUICtrlRead($mpbot) & @LF)
            Send("{F4}")
        Case    GUICtrlRead ($mpbot) = "F5"
            ConsoleWrite(GUICtrlRead($mpbot) & @LF)
            Send("{F5}")
        Case    GUICtrlRead ($mpbot) = "F6"
            ConsoleWrite(GUICtrlRead($mpbot) & @LF)
            Send("{F6}")
        Case    GUICtrlRead ($mpbot) = "F7"
            ConsoleWrite(GUICtrlRead($mpbot) & @LF)
            Send("{F7}")
        Case    GUICtrlRead ($mpbot) = "F8"
            ConsoleWrite(GUICtrlRead($mpbot) & @LF)
            Send("{F8}")
    EndSelect
WEnd

;*********************************************| Shortcut mp |*********************************************
Sleep (4000)

$begin = TimerInit()
do
$dif = TimerDiff($begin)
until $dif>7200000
Exit

;*********************************************|Process|*********************************************



Func Runbot()
    WinActivate("ROSE online")
    $Size = WinGetPos("ROSE online")
    $Width = $Size[2]
    $Height = $Size[3]
EndFunc ;==>Runbot


Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("")
EndFunc

Func Terminate()
Exit 0
EndFunc

ty. :(

Fou-Lu - Bof4 "...Wouldst thou fight a god?"
Link to comment
Share on other sites

  • Moderators

You need X, Y Coords for PixelGetColor:

Help File:

PixelGetColor

--------------------------------------------------------------------------------

Returns a pixel color according to x,y pixel coordinates.

PixelGetColor ( x , y )

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

No.

here is an image.

Posted Image

look at this part of the script

$pixelhp = PixelGetColor(35,42)

Do 
Until PixelGetColor(GUICtrlRead($hpbotpercent)) = $pixelhp
Then

what this is supossed to do is once input coord $mpbotpercent/$hpbotpercent is the same as set colour coord $pixelhp.

Press set heal/item key.

Refer to the whole script above for extra info.

I also cant use pixel get colour because thw use has to set the coord at a certain %.

Edited by Scorekeeper
Fou-Lu - Bof4 "...Wouldst thou fight a god?"
Link to comment
Share on other sites

You are only passing ONE parameter with this code:

PixelGetColor(GUICtrlRead($hpbotpercent))

You need to pass two.

Even if the GUICtrlRead returns "32,45" it still looks like this:

PixelGetColor("32,45")

When it needs to be

PixelGetColor(32, 45)

See the difference?

In your case it's not working at all, because it's looking like this:

PixelGetColor("10%")

You cannot just use $hpbotpercent, as it is NOT returning a number.

What you need to do, is calculate where the bar will be at 10%, and then have those correspond to the numbers.

Something like this:

Select
     Case GuiCtrlRead($hpbotpercent) = '10%'
          $pixelGetX = 35
          $pixelGetY = 42
     Case GuiCtrlRead($hpbotpercent) = '20%'
          $pixelGetX = 45
          $pixelGetY = 42
     [...repeat for other percents...]
EndSelect

$pixelhp = PixelGetColor(35,42)

Do
     $pixelCheck = PixelGetColor($pixelGetX, $pixelGetY)
Until $pixelCheck = $pixelhp

Also, all of these:

GUICtrlSetData(-1,"F2")
GUICtrlSetData(-2,"F3")
GUICtrlSetData(-3,"F4")
GUICtrlSetData(-4,"F5")
GUICtrlSetData(-5,"F6")
GUICtrlSetData(-6,"F7")
GUICtrlSetData(-7,"F8")

Can just be:

GUICtrlSetData(-1,"F2")
GUICtrlSetData(-1,"F3")
GUICtrlSetData(-1,"F4")
GUICtrlSetData(-1,"F5")
GUICtrlSetData(-1,"F6")
GUICtrlSetData(-1,"F7")
GUICtrlSetData(-1,"F8")

Or hell, they can all be -32 or -50 as far as that goes.

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