Sign in to follow this  
Followers 0
Powder81

Yet another pixel search question.

12 posts in this topic

Ok i have a script that will find a certain color within a certain shade, blah blah blah.

It works too.

But, it seems too slow.

IE = the pixel its looking for is moving around the screen that the script is searching in.

the script is supposed to find the pixel, then left click on it.

well it works on finding it, but laggs on the clicking(even though its set for instant click).

So anyways here is my question, if anyone cares to take a go at it...

Is there a way to have the script follow the pixel once it finds it?

The reason i want this is so that as it follows, if the pixel stops for a sec, that will give the script time to actually click on it instead of where it was.

HotKeySet ("^e", "MyExit")
While 1

$coord1 = PixelSearch( 100, 100, 500, 500, 0x109014,59,85)


If Not @error Then
    MouseClick("left", $coord1[0],$coord1[1],1,0)
     Sleep(5000)
EndIf




WEnd
Func MyExit ()
Exit
EndFunc

Any help will be greatly appreciated. Thank you all for your help.


[font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want.

Share this post


Link to post
Share on other sites



Well, a pixel doesn't move. So you will have to search again every time but once you find it once you don't have to search such a big area


[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

Well, a pixel doesn't move.

<{POST_SNAPBACK}>

Correct, the pixel itself doesnt move, the character in the search window i have does move. The pixel i am searching for is on that "moving" character.

Just thought it would be easier to say that the pixel moves.

Anyways......

:)


[font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

HotKeySet ("^e", "MyExit")

While 1
   $Co_ord1 = PixelSearch( 100, 100, 500, 500, 0x109014,59,85)
   If Not @Error Then
      MouseMove ($Co_ord1[0], $Co_ord1[1],0)
      MouseClick("Left")
      Sleep(5000)
   EndIf
Wend

Func MyExit ()
   Exit
EndFunc

Try that. A different approach at the moving and clicking.

Edited by Burrup

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

Try that. A different approach at the moving and clicking.

<{POST_SNAPBACK}>

Thank you very much.

That does seem to work a bit faster and more reliable.

Though im not sure what the difference in coding is.

If you would explain the differences* in your's and my code, i would greatly appreciate it.

* That is, not the appearance, but the actual function differences.


[font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want.

Share this post


Link to post
Share on other sites

Well often, as you know, there are many ways to do different things. Eg, for a certain situation you may use different functions that all perform the same thing in that case, While...Wend, Do...Until and For...Next loop's for example.

In this case instead of doing everything at once by moving and click, I moved the mouse first, looked at the parametres for MouseClick() and noticed that you dont have to have an X and Y co-ordinate and if not specified will click and the current mouse location. I took both these into consideration and implemented them...

In otherwords I thought to myself, "What happens when you MouseClick()?", It moves the mouse and clicks, so I said why not do it another way :).

Changes to your code.

MouseMove ($Co_ord1[0], $Co_ord1[1],0)
MouseClick("Left")

Instead of.

MouseClick("left", $coord1[0],$coord1[1],1,0)

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

Ok i understand now.

The way you redid the code made it faster by doing seperate things.

The way i had it, it took longer to do both at once.

If that is the gist of it, then i guess i do understand.

Thank you very much for explaining it to me.

I do really appreciate your help Burrup.


[font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want.

Share this post


Link to post
Share on other sites

Correct. I may be able to help you "speed up" your script if it is still a bit slow.

Maybe if you explain the full story of what the window is, what is following, does the pixel randomize or follow a path etc.


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Correct. I may be able to help you "speed up" your script if it is still a bit slow.

Maybe if you explain the full story of {a} what the window is, {b}what is following, {c}does the pixel randomize or follow a path etc.

<{POST_SNAPBACK}>

Ok, here goes.

The program i am writing deals with an online game called runescape.

The game is a sun java app.

I have successfully made a client for it, and a control panel.

{A}In the game, there are monsters to kill in order to raise your combat xp.

That is what the pixel search window is for, it scans an area of the game where my character is, for a certain pixel.

{B} The pixel it searches for is actually a color of the certain monster i want to kill.

{C} The monster that has the pixel randomizes its walking path. Thats why i wanted to speed up the clicking, in order to click it while it is still where the finder found the pixel.

So far the pixel finder i have is barely accurate at finding the monster, but it does work. Kind of like 1 out of every 10 searches it will see the monster. Even with the shade variance i have.

Well thats about it, if you have any ideas, i could sure use them, and will stay appreciative of your services.*

*Not that i will loose appreciation, im not sure why i said that, lol.

Edited by Powder81

[font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Yes, I am familiar with RuneScape (My friend used to play it :)), and I know the GUI of it, the screen playing size etc. Would you mind taking a Screenshot of the monster you want to kill and attach it? If possible in BMP format please as its better quality and has a less change of having colour variations.

Edit: It would be even better you could take multiple screenshots of the monster at different angles.

Edited by Burrup

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

Ok, i took 6 different screenshots, all saved in .bmp format.

The goblins are what i want to kill, doesnt matter wich one, red or green.

Both would be nice, but i havent figured that one out yet.

hmm... still wont let me attach anything. weird...

oh well i put them in a .rar file, and you can get it here


[font="Optima"]Every once in a while... we realize the sun does not rise on our command.[/font][font="Optima"]"Man Standing on Toilet is High on Pot" :Qui Con Jin[/font][font="Optima"]"Can't We All Just Get Along?" :The man who said that was shot by his brother shortly afterwards.[/font]Brand new site/forum i just started. As of 04/12/2005 no members.Check it out, join if you want.

Share this post


Link to post
Share on other sites

HotKeySet ("^e", "MyExit")

While 1
   $Co_ord1 = PixelSearch( 100, 100, 500, 500, 0x15A518,90)
   If Not @Error Then
      MouseMove ($Co_ord1[0], $Co_ord1[1],0)
      MouseClick("Left")
      Sleep(5000)
   EndIf
Wend

Func MyExit ()
   Exit
EndFunc

Try that.


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

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