Jump to content

Pixelgetcolor/Pixelget


spec1
 Share

Recommended Posts

It's been 4 days now that I have been working on this and it's not working, here is a screen shot.

at he bottom left you have health in red, when it's at 50 or above it's at the same color green as the shield, I'm trying to get autoIt to when it's red to press O till its not red anymore and sleep till it goes red again press O and so on, what I have done is not working Please someone help me I'm losing my mind cant figure it out. Thanks

I have tried If not green and I have tried if no red Please help me out

CODE
;while 1

;$coord = PixelSearch( 512, 383, 512, 383, 0x8CBeB5, )

;If Not @error Then

; Mouseup("right") ;MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])

; Find a pure red pixel or a red pixel within 10 shades variations of pure red

while 1

$coord = PixelSearch( 42, 725, 42, 725, 0xBD2829, 10 )

If Not @error Then

send("{O}")

;Mouse("right") ;MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])

EndIf

Wend

;Endif

;Wend

post-29163-1195423218_thumb.jpg

post-29163-1195423251_thumb.jpg

Link to comment
Share on other sites

Before I even read your code, I have an easier solution based on what you've told me. Why don't you just use a memory hacking program like Cheat Engine or Tsearch and find the memory value for health and then get AutoIt to use a read memory function (if you like this idea and reply back I will post the function of memory read using kernel32.dll - autoit has no built in memory read commands/functions) and when it detects that the health is below a certain percent (you can find the percent if you find the memory address for health max and the memory address for current health and dividing the two then mult by 100) to then perform your 'o' presses and whatever else you want. You can use adlib to create a function that will run periodically or you can include the check in the main loop.

Link to comment
Share on other sites

first off, game cheating is generaly looked down apone here, since it makes autoit look bad.

that said, a good ammount of poeple will ignore postes asking for help making something todo something in a game.

but since your new here & don't seem to know whats best for certain things, ill help you out some

so do you want it to do it when it turns red? or at a certain red point?

if just when red then PixelGetColor will work fine

$colorred=<the red color, use the info tool to get the color>
If PixelGetColor(x,y)=$colorred Then Send("o")

you could Send("{o 2}") to press o two times also

@crislivinitup, while that would most likely work, idk how safe that would be, being a game this is for.

Edited by AquilaChill
people are anoying, am i? ;) v2.95
Link to comment
Share on other sites

It's been 4 days now that I have been working on this and it's not working, here is a screen shot.

at he bottom left you have health in red, when it's at 50 or above it's at the same color green as the shield, I'm trying to get autoIt to when it's red to press O till its not red anymore and sleep till it goes red again press O and so on, what I have done is not working Please someone help me I'm losing my mind cant figure it out. Thanks

I have tried If not green and I have tried if no red Please help me out

CODE
;while 1

;$coord = PixelSearch( 512, 383, 512, 383, 0x8CBeB5, )

;If Not @error Then

; Mouseup("right") ;MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])

; Find a pure red pixel or a red pixel within 10 shades variations of pure red

while 1

$coord = PixelSearch( 42, 725, 42, 725, 0xBD2829, 10 )

If Not @error Then

send("O") ; I made a mistake here so I wanted to fix... there's supposed to be no brackets around the o

;Mouse("right") ;MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])

EndIf

Wend

;Endif

;Wend

ok first let's make your code look nice :P - it looks terrible the way you sent it. it's important to be organized to be a good programmer. (just a side note)

while 1

$coord = PixelSearch( 512, 383, 512, 383, 0x8CBeB5, 5)

; you don't need any shade variation. why do you even have any? find the exact colour and it should always be the same it's a health bar, not a monster with shading.

If Not @error Then ; if no error comes from the pixelsearch then perform your tasks, meaning the health bar is red...

send("{O}")

EndIf

Wend

Some things to consider the way you're doing it.

- the area where you're running your pixelsearch can be the entire health bar and search for when it hits red - I noticed you're doing it just at one spot... why? When any part of the bar turns red - from what I understand, you would then know that your health is too low. they way you have it set, if your health drops below the point where the pixelsearch is running then the pixelsearch will only find the background colour.

- to find the health percentage without using memory read and division. you can search the health bar so the search area is exactly inside the bar and so that you're searching for the background colour; the way the pixelsearch works, up to down and left to right i think, it will find the first colour of the background. If you find the max length of the coloured bar and then the length from the found background pixel to the end of the bar... with some subtraction and division you can find the percentage. It's fairly simple but smart. Need more explanation on this then just ask.

Edited by crislivinitup
Link to comment
Share on other sites

"- to find the health percentage without using memory read and division. you can search the health bar so the search area is exactly inside the bar and so that you're searching for the background colour; the way the pixelsearch works, up to down and left to right i think, it will find the first colour of the background. If you find the max length of the coloured bar and then the length from the found background pixel to the end of the bar... with some subtraction and division you can find the percentage. It's fairly simple but smart. Need more explanation on this then just ask."

acualy that will find the first part of the health bar (1%), pixelsearch searches the way a monitor refreshes, left to right & top to bottom. but yes, some simple math to figure out the % will be needed.

if you want to find the %health then you should do a PixelgetColor from 100% mark to 1% mark & check if its $colorgreen or $colorred, if so then a lil math (if the health bar isn't 100pix) & theres your %health :P

i made something like this, for D2LoD xpbar, i had to come up with some math to turn # pixels into a %

people are anoying, am i? ;) v2.95
Link to comment
Share on other sites

"- to find the health percentage without using memory read and division. you can search the health bar so the search area is exactly inside the bar and so that you're searching for the background colour; the way the pixelsearch works, up to down and left to right i think, it will find the first colour of the background. If you find the max length of the coloured bar and then the length from the found background pixel to the end of the bar... with some subtraction and division you can find the percentage. It's fairly simple but smart. Need more explanation on this then just ask."

acualy that will find the first part of the health bar (1%), pixelsearch searches the way a monitor refreshes, left to right & top to bottom. but yes, some simple math to figure out the % will be needed.

if you want to find the %health then you should do a PixelgetColor from 100% mark to 1% mark & check if its $colorgreen or $colorred, if so then a lil math (if the health bar isn't 100pix) & theres your %health :P

No it will find the health percentage, I said to search for the colour of the background - behind the colour of the health bar. This is assuming the health meter drains from right to left.

Link to comment
Share on other sites

No it will find the health percentage, I said to search for the colour of the background - behind the colour of the health bar. This is assuming the health meter drains from right to left.

but it looks like the health box is transparent, with floor tiles, meaning there wont be any normal background color, unless thats the backgrounds design

on a side note the health bar looks like its in gaps, though that might just be compression to the pic.

Edited by AquilaChill
people are anoying, am i? ;) v2.95
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...