Jump to content

pxiel search or time


Guest
 Share

Recommended Posts

im working on a macro and i want it to search 964,182,973, 197 for 0x496d36 but... i want it to keep search until it finds the pixel color (while 1 loop) or if it is searching for > 29 sec.

how would i go about doing this?

thanks in advance

 

 

 just now i realize a do... until loop would be the way to go. But, how would i get a "value"( for lack of a better word) for the time that the do... until loop stars then add 29 sec?

Edited by lewiaa
Link to comment
Share on other sites

I would definitely use a If EndIf statement if the pixel is found ^^

$location = PixelSearch (137, 321, 540, 683,0xEEA200, 2, 1)
If IsArray ($location) = 1 Then 
    MouseClick ('left', $location[0], $location[1], 1, 0) 
EndIf

References:

https://www.autoitscript.com/autoit3/docs/keywords/IfElseEndIf.htm

https://www.autoitscript.com/autoit3/docs/keywords/Do.htm

https://www.autoitscript.com/autoit3/docs/functions/PixelSearch.htm

https://www.autoitscript.com/autoit3/docs/functions/WinActivate.htm

Link to comment
Share on other sites

What is the application you are working with? Also - why greater than 29 seconds? 

Pixel searching is the WORST way to automate. The slightest change in the GUI can break your script. It is extremely likely  there is a script that already does what you are asking for. 

Edited by Bert
Link to comment
Share on other sites

Telling him what he didn't search doesn't really help him, maybe he did search but did not understand it and looks for some insight.

Also pixel searching is not the worst way to automate no, it just depends on how you set up your pixel searching, you can also use backprop. method and return values forward and back to make it recognize several things than 1, just like neural network.

In most cases of pixel searching people just look for x,y and the pixel, which is a wrong way to achieve the fullest of pixel searching, you can use math calculations to define the changes around by using the set x,y,l,h. Using those dimensions given then sub. or add certain needed amount to reach destination.


To answer OP:
 

Local Clicker = False
Local $color = 0x496d36
$tLX = 964
$tLY = 182
$bRX = 973
$bRY = 197

Local $a = PixelSearch($tLX,$tLY,$bRX,bRY,$color,1)

If isArray($a) then
    $Clicker = True
EndIf

While $Clicker = True
    $a = PixelSearch($tLX,$tLY,$bRX,bRY,$color,1)
        If isArray($a) then
        MouseClick("left", $a[0], $a[1],1, 0) ; ClickType, XPosition, YPosition, TotalClicks(Clicks that should be clicked), Speed (0 = instant)
        Else
        $Clicker = False
        EndIf
WEnd

This should do.

Link to comment
Share on other sites

  • Developers
20 minutes ago, RoundChecker said:

Telling him what he didn't search doesn't really help him, maybe he did search but did not understand it and looks for some insight.

Not sure I would agree there, but it is funny to see how many respond without the OP even responding to any of it.

Also wondering whether you read the forum rules as the posted example is pretty much a game automation script without naming it. Your other posts are also it that direction.

Jos

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Just now, Jos said:

Not sure I would agree there, but it is funny to see how many respond without the OP even responding to any of it.

Also wondering whether you read the forum rules as the posted example is pretty much a game automation script without naming it. Your other posts are also it that direction.

Jos

 

Why would you not agree there? Ofcourse its agreeable, telling him what he didn't read without knowing what he read or not doesn't help him. Not everyone understands the examples you have in AutoIt and the tutorials, some people does not comprehend reading as well as others. Asking for help should be returned in answering first then referring him to a certain topic he could learn more about it, not judge him telling him he didn't read - THAT doesn't help.

Also you are judging for game automation when he asked for a macro, it can be for several things, he is searching such a small area of the screen for 1 certain color, that should be clicked until it's gone, then looped.

It can be anything, it can be checking for a buff within a game to appear and spam click it, it can be checking an area on his screen and making a macro, it can be a certain application that pops up something he wants to remove every now and then.

https://merelynumbers.com/hexadecimal/0x496d36 The color he is searching for is green.

And no my other posts aren't about that at all.

Link to comment
Share on other sites

  • Developers

You're quite defensive there ...aren't you, but you didn't answer the question whether you have read the forum rules yet. ;)

We will see what legitimate purpose the OP comes up with.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

No, not defensive at all, I am just stating the obvious, humanity tends to rule and judge because of their status and position, because they think they can, without any proof or knowledge behind the intentions of the cause.

Yes I did read the rules, and I do understand them perfectly, I hope you did also read the rules as a Developer and attend your time to actually helping people instead of judging them, you can answer the OP, then tell him if this is for game automation I will not give you the answer, how you choose to answer is up to you - But judging people is not anywhere close to a behavior one should have towards a community that is built for seeking help from the others that knows more within this certain topic.

Me stating my opinion and how you should not judge people is not the definition of defensive, it is rather the opposite, it's the definition of standing up for what one means and thinks.

Link to comment
Share on other sites

roundchecker, I am not here to do it for him. and, IF you search google with phrase, "timers in autoit" he would have had his answer. I don't care what you think by the way. or do i need to search for him too?!? there, you want to be spoon fed?

You are not helping him by doing it for him, especially when it's child's play to search google. LAZY. I, for one, am tired of the laziness. At least I pointed him to his answer. Lead a horse to water

https://www.google.com/search?q=timers+in+autoit&rlz=1C1CHBF_enUS771US771&oq=timers+in+autoit&aqs=chrome..69i57.5508j0j7&sourceid=chrome&ie=UTF-8

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

54 minutes ago, RoundChecker said:

Also pixel searching is not the worst way to automate no, it just depends on how you set up your pixel searching, you can also use backprop. method and return values forward and back to make it recognize several things than 1, just like neural network.

Yes it is the worst way for a LOT of reasons. 

  • It is inherently UNSTABLE
  • the slightest change to the GUI will break it. This includes window resizing, application update by the vendor and so forth
  • anything that gets put in front of the window - oh look - script breaks.
  • if the window isn't the active window - depending on how the script is written - broken.

I can keep going. You should ALWAYS try first to hook directly into the control. I can only count on one hand the number of times where pixel searching was the only option in solving the problem when dealing with controls. I've been working with AutoIt since 2005 so I think I know what I'm talking about.

Now if this is game automation - we ALL know that is a No, NO, NO WAY, NO! Just NO! in that being discussed in the forum. So, I will ask again:

The name of the application please. 

Edited by Bert
Link to comment
Share on other sites

No it does not, if you worked with AUTOIT since 2005 you should know that you have a way to get window position, then from that window position you can always assert calculations referring to that, as in backprop. I suggest you search that up if you are unfamiliar with Neural networking and how values can be sent forward and back.

I might be new to AutoIT, but I am definitely not new to scripting, and I know what I AM talking about.

And nothing needs to be put infront of the window if you are smart enough to use several functions, as window always on top, recheck the window always before pixel searching, to activate it, if its not activated then activate it again, also recalculate the changes everytime it activates, and link them all together, if you actually knew what you were talking about you wouldn't say it's the worst.

Everything has its pros and cons. I could go on forever and ever about this, but it seems your experience with pixelsearching is very low and if you even know how Neural System works, it works on actual pixelsearching and controlling Neurons from several pixels to send a certain weight and by adding values such as Bias to increase and decrease the output from input and vice versa to come to a result.
 

The most intelligent AIs are now built on pixel searching and you're going to tell me that it's terrible? Please.

Link to comment
Share on other sites

  • Developers

Could everybody please do me a favor and stop posting till the OP is back and replies as we have now 19 reply posts!

Jos
 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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