Jump to content

Help with some pixel checking


Recommended Posts

Hi all! first of all.

I am new to this so maybe I am doing something obviously wrong here, lets hops so. Then it will be and easy fix :)

I want the script to wait for a certain pixels color and then after that color is found in that exact pixel it moves on with the next step of the script.

Do
PixelGetColor(60,709)
sleep (2000)
Until (PixelGetColor(60,709)=2774026)
;next step
sleep(2000)
mousemovereal(350,302,0,0,0)
sleep(500)
mousedownreal("left")
mouseupreal("left")
;next step
Sleep(2000)
Do
PixelGetColor(22,770)
Sleep(2000)
Until (PixelGetColor(22,770)=10474636)oÝ÷ ØZ½ç!yÉvØ^¦,^Ì"¶aËr¥ê)Þ±©Ý¶©¥rh®++m²az·¦ºË[zÊ&zØb§)è¡·(¡Ø§X§zÆ®¶­sbb33c·f"ÒVÄvWD6öÆ÷"#"Ãss¤×6t&÷ÂgV÷CµFRFV6ÖÂ6öÆ÷"2gV÷C²Âb33c·f"

What am I doing wrong?

/Thanks in advance

Link to comment
Share on other sites

i didnt quite understand exacly what you want cause your script is messed up, but i think you need something like:

Do
 $srch = PixelSearch( 0, 0, @DesktopWidth, @DesktopWidth, 0xFFFFFF)
Until Not @error And $srch[0] == 60 And $srch[0] == 709
;next move

PS: Replace 0xFFFFFF with your searching color and 60,709 with your x,y coords

Edited by Gif
Link to comment
Share on other sites

..... I want the script to wait for a certain pixels color and then after that color is found in that exact pixel it moves on with the next step of the script.

Do
PixelGetColor(60,709)
sleep (2000)
Until (PixelGetColor(60,709)=2774026)
;next step
sleep(2000)
mousemovereal(350,302,0,0,0)
sleep(500)
mousedownreal("left")
mouseupreal("left")
;next step
Sleep(2000)
Do
PixelGetColor(22,770)
Sleep(2000)
Until (PixelGetColor(22,770)=10474636)

What am I doing wrong?

/Thanks in advance

@Sinperwolf - welcome to the forum and autoit. I love when people read the help file! Makes it so much easier to help them help themselves. Good news, this is easy to fix, speaking one newbie to another of course. There are a few wrong commands and then there's a small touch of wrong thinking, but the idea is right.

There's no au3 command called mousedownreal or mouseupreal or mousemovereal; unless these are functions you've created?? Check the help file and you'll see there are other legit Mouse commands.

Next your idea of waiting until the pixel color is a match before the script continues is on track. You're just using the wrong command again. You can't say Do...Until (PixelGetColor(60,709)=2774026). Like I said you've got the right idea on the Do...Until logic. If you read PixelGetColor() you'll see that you can't set that = to the decimal value of your color. Good idea so you're almost on the right track. And you get an A+ for using PixelGetColor to ... get the color value you want.

The right command you need is PixelSearch like Gif said earlier. So I can only give you a B- since you didn't read what other Pixel related command were available and how to use them. I've got faith in you so I'm not going to fix your code. Go back to the help file and I'm 100% confident you can get this working. Besides Gif gave you much it it already. You can either keep your decimal value or switch to HEX, both work the same... I think.

Edit: Dohl! Correction there's a UDF created by jaenster who's the author. Guess Sniperwolf is making a bot for a game??? Sniperwolf, notice what jaenster asks in exchange for his/her code:

.. I will share this script with you , if you use it , shall be nice if you add my credit in it , GreenLakeScripting-Team

Edited by ssubirias3
Link to comment
Share on other sites

Thanks alot for all the help so far, I am really eager to learn this stuff. And yeah I borrowed the mousemovereal functions from jaenster so his name will be added in the script aswell. The helpfunction is really nice I think, you can learn a lot from it as a noob so now I am digging in on the pixelsearch area to see how that works.

Link to comment
Share on other sites

Actually I got some more questions, really basic stuff that I cant understand. its probably very simple and right under my noose in the help file but maybe you can tell me what to search for.

For example

I got 50 lines of code

I want to have a function that makes the macro skip ahead to a specific line if something is triggered. For example if I have the whole log in thing on the macro but the program are already up and running, it can detect that the program is running with for example a pixelsearch :) and then skip all the login lines.

Is this easy and do you understand what I mean?

Link to comment
Share on other sites

Actually I got some more questions, really basic stuff that I cant understand. its probably very simple and right under my noose in the help file but maybe you can tell me what to search for.

For example

I got 50 lines of code

I want to have a function that makes the macro skip ahead to a specific line if something is triggered. For example if I have the whole log in thing on the macro but the program are already up and running, it can detect that the program is running with for example a pixelsearch :) and then skip all the login lines.

Is this easy and do you understand what I mean?

Almost like a GoTo IF true and GoTo Else false kind of feature, right? The FAQ's in the help talk about goto having gone bye-bye. What you're after is a conditional statement that when true will jump/goto/bypass your login code. Read up on Functions or specifically Func...Return...EndFunc.

You've got the right attitude, that's for sure!

Link to comment
Share on other sites

Ive read up on functions now, I honestly have to say that I dont get everything in the func....return....endfunc part. I can make a function with start and end and all that but in the help file there are so many things you could put in there :) . Well I have to keep on reading and trying Im sure I will figure it out sooner or later. I've noticed how great functions are, macro looks nice and tidy and is much easier to work with when you have a lot of functions. Thanks for the tip!

If anyone wants to explain the func....return....endfunc bit I am eager to learn. I havnt read any programming or anything before so I dont get all the functions there really. Or maybe if someone know any good guide thats explains how theese functions work from the base. Explaining all thoose french words in there aswell :P

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