Sign in to follow this  
Followers 0
Skilinium

Help needed.

8 posts in this topic

I am trying to make something, if "pixel" = "color" then.. or something like that.

Here is what i got so far.

---

$scan = PixelGetColor(148,519) = 0x201030

---

But.. how do i set it..

so when the pixel (148,519) is color 0x201030 that it will click at 255,456?

Share this post


Link to post
Share on other sites



help please

Share this post


Link to post
Share on other sites

help please

while 1
sleep(10)

$scan = PixelGetColor(148,519) ;Returns decimal value of pixel's color.
$scancolor = Dec("0x201030") ;so we have to convert the color to check for to decimal.

if $scan == $scancolor then     
    MouseClick("left",255,456, 1,0)
    exit
endif

WEnd

Share this post


Link to post
Share on other sites

Thank's for your reply.

Im trying to make a bot, but no success so far.

i have edited ur code a little bit just the mouseclick.

---

while 1

sleep(100)

$scan = PixelGetColor(148,519) ;Returns decimal value of pixel's color.

$scancolor = Dec("0x201030") ;so we have to convert the color to check for to decimal.

if $scan == $scancolor then

MouseClick("left",255,514, 1,0)

exit

endif

WEnd

---

But.. The script goes on "Pause" And i dont want that.. how can i solve it.. or it the problem something else?

Share this post


Link to post
Share on other sites

Not to try and ruin your fun or anything, but I wanted to make you aware that while autoit is capable of doing some kinds of bot's it was not made to do so and is not particularly suited for it.

As to your issue, are you sure you are wanting to Exit your program right after that mouseclick? that could explain the "Pause" you are describing.


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

Thank's for your reply.

Im trying to make a bot, but no success so far.

i have edited ur code a little bit just the mouseclick.

---

while 1

sleep(100)

$scan = PixelGetColor(148,519) ;Returns decimal value of pixel's color.

$scancolor = Dec("0x201030") ;so we have to convert the color to check for to decimal.

if $scan == $scancolor then

MouseClick("left",255,514, 1,0)

exit

endif

WEnd

---

But.. The script goes on "Pause" And i dont want that.. how can i solve it.. or it the problem something else?

$scancolor = Dec("0x201030") this returns null ... i was wrong..

$scancolor = Dec("201030") removing 0x should fix the problem

while 1
sleep(100)

$scan = PixelGetColor(148,519)  ;Returns decimal value of pixel's color.
$scancolor = Dec("201030");so we have to convert the color to check for to decimal.


if $scan == $scancolor then     
    MouseClick("left",255,514, 1,0)
    exit

endif

WEnd

Share this post


Link to post
Share on other sites

Thank you for your help. I apriciate it.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

PixelGetColor() returns and integer that happens to be 24 bits long. It is not formatted as Hex or Dec until you present it as a string. Since there is no need to present it to the operator as a string, don't concern yourself with Hex/Dec formatting:

While 1
    If PixelGetColor(148, 519) = 0x201030 Then
        MouseClick("left", 255, 514, 1, 0)
        If MsgBox(32 + 4, "Pixel Match", "Found matching pixel!  Look again?") <> 6 Then Exit
    EndIf
WEnd

:shocked:

Edit: Simplified demo even more...

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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