eKolin

Simple Newbie question about loop

8 posts in this topic

So basicly, i wantto create a function that it would search for certain colour pixel, if false it would try to search for it again after 1 second.
 

AUTOIT FORUM.au3

Share this post


Link to post
Share on other sites



func Teleport_Air_Altar();Requires Teleport_Skilling_Area
      While 1;Trying to loop till it finds a pixel (NPC)
   $pixels = PixelSearch(290,32,498,212,0x999709,50)
   if @error Then
   sleep(1000)
   ContinueLoop
      WEnd
   if NOT(@error) Then
   MouseMove($pixels[0],$pixels[1],);Hoovers teleport NPC
   sleep(300)
   LC($pixels[0],$pixels[1])
   sleep(2750)
   MouseMove(266,413);Selects Air Altar Teleport
   LC(266,413)
   sleep(4000)
EndIf
EndIf
EndFunc

Share this post


Link to post
Share on other sites

Hello.

 

Welcome to the forum.

Please read up the forum rules (game automation, topic #1) ;)

 

Func Teleport_Air_Altar();Requires Teleport_Skilling_Area
    While 1;Trying to loop till it finds a pixel (NPC)
        $pixels = PixelSearch(290, 32, 498, 212, 0x999709, 50)
        If @error Then
            Sleep(1000)
            ContinueLoop
        Else
            MouseMove($pixels[0], $pixels[1],);Hoovers teleport NPC
            Sleep(300)
            LC($pixels[0], $pixels[1])
            Sleep(2750)
            MouseMove(266, 413);Selects Air Altar Teleport
            LC(266, 413)
            Sleep(4000)
        EndIf
    WEnd
EndFunc   ;==>Teleport_Air_Altar

 

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Ok, thanks :)

Share this post


Link to post
Share on other sites

Hint:

Func Coffee_watcher(); check the web cam, if coffee is available
    While 1;Trying to loop till it finds a pixel (NPC)
        $pixels = PixelSearch(290, 32, 498, 212, 0x999709, 50)
        If @error Then
            Sleep(1000)
            ContinueLoop
        Else ; trigger info, that coffee is not available
            MouseMove($pixels[0], $pixels[1],)
            Sleep(300)
            LC($pixels[0], $pixels[1])
            Sleep(2750)
            MouseMove(266, 413)
            LC(266, 413)
            Sleep(4000)
        EndIf
    WEnd
EndFunc   ;==>Coffee_watcher

That's basically the same question, isn't it?

:D

 

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
func Teleport_Air_Altar();Requires Teleport_Skilling_Area
      Do;Trying to loop till it finds a pixel (NPC)
   $pixels = PixelSearch(290,32,498,212,0x8E8C08,10)
   sleep(500)
   Until @error = 0
   MouseMove($pixels[0],$pixels[1]);Hoovers teleport NPC
   sleep(300)
   LC($pixels[0],$pixels[1])
   sleep(2750)
   MouseMove(266,413);Selects Air Altar Teleport
   LC(266,413)
   sleep(4000)
EndFunc

WOW that code that u've posted there is so similar, anyway i've found this code to work aswell ^. If u're already here, maybe you u know a way to use only window coordinates? Like that desktop coords wouldnt matter and only window coords would be used.

Share this post


Link to post
Share on other sites

Hi.

 

Have a look at "wingetpos()" and opt("PixelCoordMode",0)

 

Regards, Rudi.

 


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.