Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

getpixelcolour problem



  • Please log in to reply
8 replies to this topic
ajc1981
  • Members
  • 14 posts
  • Last active: Nov 16 2015 07:59 PM
  • Joined: 31 Aug 2015
Hi i have been trying to grab a pixel and having problems trying to get it to work.
the main problem is the window bar or cast bar is not always viable so it only come up when an action is pressed so it's hidden most of the time here is the script i made to try and pick it up not sure if I've done this right.
 
 
#ifWinActive World of Warcraft
loop
pixelgetcolour, castbar, 758,402
iifNotEqual, castbar, 0x96C8C1
send e
sleep 200
return
 
 
not sure if this is done right but it's not picking up the window at all any help would be great cheers.


SnowFlake_FlowSnake
  • Members
  • 845 posts
  • Last active: Jan 24 2016 05:24 PM
  • Joined: 08 Oct 2012

Hello

 

use this script to get the pixels and then paste them in to your script, also make sure that WOW is activated 

X::
Clipboard =
MouseGetPos,xx,yy
PixelGetcolor, pix, %xx%,%yy%
Clipboard = PixelGetcolor, pix, %xx%,%yy%`nIfEqual, pix, %pix%, { `nsend {e}`nsleep 200`n}
return


#ifWinActive, World of Warcraft
loop
{


break
}
return

  • Download link of my scripts on Autohotkey.com 2/10/2015 [DOWNLAND]
  • Contact Info:  https://github.com/floowsnaake //  FloowSnaake(A)gmail.com
  • IF you need Help send me a PM,Email or Post on Github

  • Quote by tank  Posted 29 September 2015 - 06:14 PM

  • "Eventually i will find a way to convert the DB back to PHPBB3. but i dont have the bandwidth right now. No one that has tried has had success. It is the Only way i can keep this open is if i could successfully convert it."

R3TR0
  • Members
  • 39 posts
  • Last active: Sep 05 2016 07:02 PM
  • Joined: 26 Aug 2009

#ifWinActive, World of Warcraft

Loop

{

CoordMode, Pixel
PixelGetColor, castbar, 758, 402

if (castbar = "0x96C8C1"){
 sleep 100

}
else if (castbar != "0x96C8C1"){
  send {e}
  sleep 100

}

}

return


Posted Image

Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012
✓  Best Answer

@Everyone the #IfWinActive directive applies to hotkeys and hotstrings, not to auto-execute code. If you want a loop to run only for a particular window, see below.

 

@ajc1981, my suspicion is that you are using the British spelling of Colour. Try Color in PixelGetColor. When I tried to put PixelGetColour into my script, I was told it was an unrecognized action.

 

For that window-sensitive loop, I would do it like this (there are multiple ways)

Loop
{
WinWaitActive, World of Warcraft
pixelgetcolor, castbar, 758,402
IfNotEqual, castbar, 0x96C8C1
send e
sleep 200
}
return ; the script will technically never reach here

The return within a loop would end the loop because it ends the thread. I could have completely removed it from the script, but it's good habit to get used to putting return at the end of related lines.

 

I also noticed you had a typo on the IfNotEqual command. You put two i's instead of one. The rest of your code looks good to me.

 

Finally, you can see I used the command WinWaitActive.



ajc1981
  • Members
  • 14 posts
  • Last active: Nov 16 2015 07:59 PM
  • Joined: 31 Aug 2015

hi guys thanks for the replys not had chance to look at this yet been busy with work will get round to doing this maybe this weekend and post back if i've got it to work



ajc1981
  • Members
  • 14 posts
  • Last active: Nov 16 2015 07:59 PM
  • Joined: 31 Aug 2015

ok guys thank you so much for the help been trying all weekend to get this to work but it just keeps firing the key e all the time without a brake donno whats wrong as i think i have the right pixelcolor



ajc1981
  • Members
  • 14 posts
  • Last active: Nov 16 2015 07:59 PM
  • Joined: 31 Aug 2015

Ok tried another script with no luck, here is the problem I have with the first script, it keeps spamming the e key all the time, so it's not picking up the changes to color I think or it's not seeing the game or something so I tried another script which is 

CoordMode, Pixel, Screen
x:=125
y:=51
 
Loop
{
pixelGetcolor , castbar , %x%, %y%
TrayTip, color, %castbar%
If castbar != 0x1E0502
Gosub, workbitch
sleep, 200
}
 
workbitch:
send, {+0}
Return
 
 
with this script all I've done is made it use a gosub option but this time it's not firing off all the time it's doing nothing. If I put the send +{0} like that it will fire all the time.
has anyone been able to use getpixelcolor with world of warcraft. I've tried window mode full screen and window mode, but it's just not working at all I've tried using a few scripts to grab the mouse and pixel position not sure if it's me or the game will not use getpixelcolor or it's not viewing the game.
 
HELP ME PLZ


Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

The key "+0" does not exist, so when you specify a key {+0} nothing is sent. It's still trying to send it, but it fails. When you use +{0}, the key "0" exists, so it can do Shift+0 for you.

 

Are you seeing the Traytip report back the value 0x1E0502 and it still does the Send command?

 

You can also try running your script as an administrator.



ajc1981
  • Members
  • 14 posts
  • Last active: Nov 16 2015 07:59 PM
  • Joined: 31 Aug 2015

The key "+0" does not exist, so when you specify a key {+0} nothing is sent. It's still trying to send it, but it fails. When you use +{0}, the key "0" exists, so it can do Shift+0 for you.

 

Are you seeing the Traytip report back the value 0x1E0502 and it still does the Send command?

 

You can also try running your script as an administrator.

 

 

Ok, got it to work now at long last here is the main problem there was no way I could get fixed color so I had to make my own one :D it works now the traytip I added because I wanted to know if it could find the code but it was firing off the cmd all the time even thou traytip was saying a different code.

 

 

is there away to delay the key press to say 750ms once the color is found ?

 

worked it out now myself