Sign in to follow this  
Followers 0
Perd

My first go at this. Getting error with pixel portion of script.

8 posts in this topic

$portraitx = 865; x value for target check - top right of the incline above #5 slot
$portraity = 825; y value for target check
$atk1x = 644; x value for attack 1 pixel
$atk1y = 835; y value for attack 1 pixel
$atk2x = 696
$atk2y = 835
$atk3x = 748
$atk3y = 835

    
$CombatCheck = PixelGetColor(($portraitx), ($portraity));~ Set $CombatCheck to our non-combat color
$attackkey1 = PixelGetColor(($atk1x), ($atk1y)); Set $attackkey1 to non-combo color for attack key 1
$attackkey2 = PixelGetColor(($atk2x), ($atk2y)); Set $attackkey2 to non-combo color for attack key 2
$attackkey3 = PixelGetColor(($atk3x), ($atk3y)); Set $attackkey3 to non-combo color for attack key 3

So this is what the portion of the script looks like. I figured I was supposed to replace the "PixelGetColor" with the actual hex code for the particular color but no matter where I put the color I get an error. For example the CombatCheck color is 111614. I have seen other scripts on here putting 0x in front of it but that didnt work either. Any help would be greatly appreciated.

Thanks

Share this post


Link to post
Share on other sites



Just look in the help file

PixelGetColor() only uses two mouse coordinates

Maybe you want...

PixelSearch ( left, top, right, bottom, color [, shade-variation [, step [, hwnd]]] )

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

$portraitx = 865; x value for target check - top right of the incline above #5 slot
$portraity = 825; y value for target check
$atk1x = 644; x value for attack 1 pixel
$atk1y = 835; y value for attack 1 pixel
$atk2x = 696
$atk2y = 835
$atk3x = 748
$atk3y = 835

    
$CombatCheck = PixelGetColor(($portraitx), ($portraity));~ Set $CombatCheck to our non-combat color
$attackkey1 = PixelGetColor(($atk1x), ($atk1y)); Set $attackkey1 to non-combo color for attack key 1
$attackkey2 = PixelGetColor(($atk2x), ($atk2y)); Set $attackkey2 to non-combo color for attack key 2
$attackkey3 = PixelGetColor(($atk3x), ($atk3y)); Set $attackkey3 to non-combo color for attack key 3

So this is what the portion of the script looks like. I figured I was supposed to replace the "PixelGetColor" with the actual hex code for the particular color but no matter where I put the color I get an error. For example the CombatCheck color is 111614. I have seen other scripts on here putting 0x in front of it but that didnt work either. Any help would be greatly appreciated.

Thanks

Welcome to the AutoIt forums Perd muttley

You haven't shown us any script where you get errors, or described what errors you get so there's not much we can do.

Are you using the values $attackkey1 to $attackkey3 to set the colour of something?

BTW, the brackets around the variables are not needed so better to leave them out.

I guess you are a bit cinfused by the hex values and the base 10 values. The 0x in front of a number means that the following characters are a hex value.

0x1 = 1

but

0xB = 11


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Global $Paused 
HotKeySet("{PAUSE}", "TogglePause") 
HotKeySet("{ESC}", "Terminate") 
#Include <Misc.au3> 
;~ Version 3.0

; This is a section that starts a tooltip to show you your pixel locations.
$savepos = MouseGetPos()
$SaveColor = PixelGetColor($savepos[0],$savepos[1])
While 1
    Sleep(10)
    $pos = MouseGetPos()
    $color = PixelGetColor($pos[0],$pos[1])
    If $savepos[0] <> $pos[0] Or $savepos[1] <> $pos[1] Or $color <> $SaveColor Then 
        ToolTip("X: " & $pos[0] & @CRLF & "Y: " & $pos[1])
        $savepos = $pos
        $SaveColor = $color
    EndIf
    If _IsPressed('01') Then
        ToolTip("")
        ExitLoop
    EndIf
WEnd
;----------------------------------------------------- Start Storing variables for the rest of script
    $portraitx = 865; x value for target check - top right of the incline above #5 slot
    $portraity = 825; y value for target check
    $atk1x = 644; x value for attack 1 pixel
    $atk1y = 835; y value for attack 1 pixel
    $atk2x = 696
    $atk2y = 835
    $atk3x = 748
    $atk3y = 835
;~  $atk4x =
;~  $atk4y =
;~  $atk5x =
;~  $atk5y =
    
    $CombatCheck 16160c = PixelGetColor(($portraitx), ($portraity));~ Set $CombatCheck to our non-combat color
    $attackkey1 = PixelGetColor(($atk1x), ($atk1y)); Set $attackkey1 to non-combo color for attack key 1
    $attackkey2 = PixelGetColor(($atk2x), ($atk2y)); Set $attackkey2 to non-combo color for attack key 2
    $attackkey3 = PixelGetColor(($atk3x), ($atk3y)); Set $attackkey3 to non-combo color for attack key 3
;~  $attackkey4 = PixelGetColor(($atk4x), ($atk4y)); Set $attackkey4 to non-combo color for attack key 4
;~  $attackkey5 = PixelGetColor(($atk5x), ($atk5y)); Set $attackkey5 to non-combo color for attack key 5
;~  Target/Check for Target loop
    $i = 0
    Do
      send("{d down}");Turns your character to the right - facing a mob is the best way to target
      Sleep("500");Amount of time 'd' key is pressed
      send("{d up}");Stops the turning
      ConstantCombat();Run ConstantCombat() function to check if a taret is selected
    Until $i = 1

Func PixelCheckForCombo();This function checks for the three attack keys and if they are lit - if lit they are pressed
          If PixelGetColor(($atk1x), ($atk1y)) <> $attackkey1 Then
              Send("1")
          EndIf
          If PixelGetColor(($atk2x), ($atk2y)) <> $attackkey2 Then
              Send("2")
          EndIf
          If PixelGetColor(($atk3x), ($atk3y)) <> $attackkey3 Then
              Send("3")
          EndIf
;~      If PixelGetColor(($atk4x), ($atk4y)) <> $attackkey4 Then
;~          Send("q")
;~      EndIf
;~      If PixelGetColor(($atk5x), ($atk5y)) <> $attackkey5 Then
;~          Send("e")
;~      EndIf
          Sleep("1000"); Time between button presses for combos - 1 second seems to work (1000ms)
EndFunc

Func ConstantCombat() 

   If PixelGetColor(($portraitx), ($portraity)) = $CombatCheck Then; Checks to see if non-target color has changed, meaning we have a target
       Sleep("10000");Amount of time to wait until returning to the Target Check loop
       Return;Return to above Target Check loop
   Else;If the color is not our original non-target color it will go to the combat routine below
   Do
;~  Automated Combat Routine Using combos in slots 4,5,6 - subtract or add based on the number of combos or cooldowns
      send("4");Combo Attack with up to five key presses
            PixelCheckForCombo()
            PixelCheckForCombo()
            PixelCheckForCombo()
;~          PixelCheckForCombo()
;~          PixelCheckForCombo()
      Sleep("2500")
      send("5")
            PixelCheckForCombo()
            PixelCheckForCombo()
            PixelCheckForCombo()
;~          PixelCheckForCombo()
;~          PixelCheckForCombo()
      Sleep("2500")
      send("6")
            PixelCheckForCombo()
            PixelCheckForCombo()
            PixelCheckForCombo()
;~          PixelCheckForCombo()
;~          PixelCheckForCombo()
      Sleep("2500")
   Until PixelGetColor(($portraitx), ($portraity)) = $CombatCheck;Loop our combat until the pixel changes back to non-target color
   Send("~")
   EndIf 
   Return
EndFunc 

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

;Terminate Script 
Func Terminate() 
Exit 0 
EndFunc

That is the entire macro/bot. The instructions said I need to input the coordinates and I the pixel of the locations in order for the thing to work. The coordinate part is easy but where am I supposed to put the pixel information?

Sorry for not posting all of it the first time.

Share this post


Link to post
Share on other sites

Anyone make sense of it?

Thanks

Share this post


Link to post
Share on other sites

What game are you doing this for? I was just wondering because I did it to but would get it to work on any system ie... size 800x640 1024x768 1280x960 1280x1024


Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

Share this post


Link to post
Share on other sites

Anyone make sense of it?

Thanks

I can't really I'm afraid.

If you want $CombatCheck to be the colour 16160c (hex) then you need to have

$CombatCheck = 0x16160c

or if you need to set $CombatCheck to the colour of a certain pixel then

$CombatCheck = PixelGetColor($portraitx, $portraity)

is fine.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

The game is for Age of Conan.

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