A couple questions about screen locations and pixel colors

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Cashcharac123
Newbie
Posts: 8
Joined: Tue Jan 03, 2006 7:32 am

A couple questions about screen locations and pixel colors

Post by Cashcharac123 » Tue Jan 10, 2006 11:57 am

Well I'm at it again, trying to make an improved bot =). This time I'm going for something a little bit more complex. There are numerous things that I need to do with the bot, and I'm hoping those of you more coding savvy can help me out.

First thing: I need the macro to check a specific area on the screen(bottom left) for a certain color, and then toss in an if> for the result. Now I've read over some of the getpixelcolor> posts, and have a decent idea of how to check for the color, but my problem is in defining the area. I'm not quite sure how to tell what the coords of the area are. Hoping there was a command that could let me know where I am on screen.

Second thing: I need to know what color it is im looking for. I'm not quite sure what the color is, I know its a shade of blue, but the exact code for it I'm not sure of. Was hoping there was a way to have the macro output the color under my cursor, so I could make a small macro that would allow me to get all the color codes I need.

Third thing: In the if> for the getpixelcolor>, I need it to click on that area until the color is gone. Now I'm not quite sure how to use the Until>, but I assume thats what I'd need to use...like Until>DummyColor=0000000f or whatever. The problem I'm having with that is I'm not sure what the color under it is going to be afterwards(once the thing dies it dissappears and ground is left under it). I was thinking of like setting up a variable for the color, like when it finds the color, this variable would become 1, and when the color was no longer there, it would change to 0. Thats the only way I can think of to get the macro to stop clicking on the color.

Final thing: I need to have the cursor move around randomly on the screen until it finds the color im looking for...like if it doesn't find the designated color on the screen after 10 secs, it clicks randomly, within a defined area, and searches again for the designated color.

I know it sounds like I'm having you guys write the entire thing for me lol, but I am still rather new at this and my skills are only scratching the surface of what I know this program can do. Once I learn from you guys, or the other posts I'm still searing, how to do this kind of stuff, then i'll be set to work on my own. With a program like MS, this is about as advanced as I need to get for what I'm using it for, so if you can help me in any way to understand it, I would be eternally greatful.

Oh yeah, I am currently looking in other posts with the convenient search function, but I thought I'd throw up this post in the likely event that I can't find what I need(or in my case, understand it).

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: A couple questions about screen locations and pixel colo

Post by Marcus Tettmar » Tue Jan 10, 2006 12:07 pm

Cashcharac123 wrote:First thing: I need the macro to check a specific area on the screen(bottom left) for a certain color, and then toss in an if> for the result. Now I've read over some of the getpixelcolor> posts, and have a decent idea of how to check for the color, but my problem is in defining the area. I'm not quite sure how to tell what the coords of the area are. Hoping there was a command that could let me know where I am on screen.
In Macro Properties you see the numbers top right that are constantly changing? That's your cursor position. Pull down the drop down menu by clicking on the little down arrow and you can select an option to have it follow your cursor and another option to display the colour. You can also select this from within the Editor.
Second thing: I need to know what color it is im looking for. I'm not quite sure what the color is, I know its a shade of blue, but the exact code for it I'm not sure of. Was hoping there was a way to have the macro output the color under my cursor, so I could make a small macro that would allow me to get all the color codes I need.
See above.
Third thing: In the if> for the getpixelcolor>, I need it to click on that area until the color is gone. Now I'm not quite sure how to use the Until>, but I assume thats what I'd need to use...like Until>DummyColor=0000000f or whatever. The problem I'm having with that is I'm not sure what the color under it is going to be afterwards(once the thing dies it dissappears and ground is left under it). I was thinking of like setting up a variable for the color, like when it finds the color, this variable would become 1, and when the color was no longer there, it would change to 0. Thats the only way I can think of to get the macro to stop clicking on the color.
Sounds fine. Repeat/Until or a Label/Goto will do it. Use GetPixelColor in the loop to keep checking it.
Final thing: I need to have the cursor move around randomly on the screen until it finds the color im looking for...like if it doesn't find the designated color on the screen after 10 secs, it clicks randomly, within a defined area, and searches again for the designated color.
So use the Random function to generate random coordinates.
I know it sounds like I'm having you guys write the entire thing for me lol, but I am still rather new at this and my skills are only scratching the surface of what I know this program can do.
You could have a go at reading the manual - all the above is in it. The cursor/colour monitor is staring you in the face :-/
Once I learn from you guys, or the other posts I'm still searing, how to do this kind of stuff, then i'll be set to work on my own. With a program like MS, this is about as advanced as I need to get for what I'm using it for, so if you can help me in any way to understand it, I would be eternally greatful.
No problem. When you're an expert please come back here and help beginners out like we are helping you now.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Cashcharac123
Newbie
Posts: 8
Joined: Tue Jan 03, 2006 7:32 am

Post by Cashcharac123 » Tue Jan 10, 2006 12:31 pm

Thanks yet again Marcus, you always save me =P. If you hadn't noticed, a vast amount of common sense isn't a quality I possess, so please forgive my easy and obvious questions that I keep asking =).

Oh yeah, I also plan on helping people out here once I get this down pat, don't worry. Hell, I think i'll probably even put up a tutorial on the hacking/coding forums that I use to post my bots at, give MS a little advertising, seeing as how everyone seems to swear by AutoIt...which I might add, confuses the hell out of me.

Cashcharac123
Newbie
Posts: 8
Joined: Tue Jan 03, 2006 7:32 am

Post by Cashcharac123 » Tue Jan 10, 2006 12:47 pm

Ok another question has come up =P. I thought I understood what I was doing with the getpixelcolor>...but I guess I really don't. From the posts i've looked at, the program moves the cursor around the defined area and if the color is under it, it clicks it. What I need to do is have the cursor move to a spot within the defined area if that color apprears ANYWHERE within it. So like, say the cursor is at 30,30, and the color pops up at 40,45...I need the cursor to automatically move to that spot when the color appears. If that is possible, then theres another thing I need to know. The color might pop up on the screen in multiple locations, I need the cursor only to focus on one for the duration of the loop, preferably the closest one.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jan 10, 2006 12:49 pm

You'll have to write loops to scan a portion of the screen and move to the pixel if it finds the colour there.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Cashcharac123
Newbie
Posts: 8
Joined: Tue Jan 03, 2006 7:32 am

Post by Cashcharac123 » Tue Jan 10, 2006 1:09 pm

Dare I ask how I would get it to do that? =P

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jan 10, 2006 1:27 pm

Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts