Jump to content
Sign in to follow this  
BobiusMaximus

Loops?

Recommended Posts

Yeh, basically I'm working on a prog right now.

I've done the bulk of it, but now I'm stuck.

I need to have loop which clicks somewhere, types something, clicks somewhere else then waits a bit before starting again.

I have the co-ordinates and I've got the script ready to go in the loop, however, I also need the loop to stop when I push a button such as F10 and I'm stuck.

Help please?

-Bob


Photoshop User and Noob AutoIt user.

Share this post


Link to post
Share on other sites

Yeh, basically I'm working on a prog right now.

I've done the bulk of it, but now I'm stuck.

I need to have loop which clicks somewhere, types something, clicks somewhere else then waits a bit before starting again.

I have the co-ordinates and I've got the script ready to go in the loop, however, I also need the loop to stop when I push a button such as F10 and I'm stuck.

Help please?

-Bob

look up hotkeyset in the help file....

Share this post


Link to post
Share on other sites

Hi,

have a look at AU3Record and into the helpfile for HotkeySet and While...wend or For..Next or Do...until.

So long,

Mega

P.S. May post the post, too.


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Sure:

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

 Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
 By BobiusMaximus
 
 To use this bot start the game then scroll your window up to the top.
 This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.
 
#ce ----------------------------------------------------------------------------

If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

Do
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(1500)
Until

-Bob


Photoshop User and Noob AutoIt user.

Share this post


Link to post
Share on other sites

Hi,

looks not that wrong, but Do ... until ??? what? You missed that.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

 Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
 By BobiusMaximus
 
 To use this bot start the game then scroll your window up to the top.
 This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.
 
#ce ----------------------------------------------------------------------------

HotKeySet("{ESC}", "Terminate")
HotKeySet("{f1}", "Start")
HotKeySet("{f2}", "Stop")

While 1
    Sleep(100)
WEnd

Func Terminate()
    Exit 0
EndFunc

Func Start()
If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

while 1
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(1500)
wend
EndFunc

Func Stop()
    Exitloop
EndFunc

Share this post


Link to post
Share on other sites

That doesn't work o.O

Anyway, I improved the script a little so you don't have to do anything to start it(so just leave the window as is then run script)

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

 Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
 By BobiusMaximus
 
 This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.
 
#ce ----------------------------------------------------------------------------

If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 498, 464)
    MouseClick("left", 506, 623)
    Sleep(1500)
    MouseClick("left", 456, 610)
    Sleep(7000)
    MouseClick("left", 461, 429)
    Sleep(1500)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

Do
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(2000)
Until

Can you try adding it again to that one and see if it works then? ;)

-Bob


Photoshop User and Noob AutoIt user.

Share this post


Link to post
Share on other sites

It says there is an error in line 44 whenever I try to run that...

Edit:

I got my script working, but it doesn't stop when I push '0' ;)

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

 Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
 By BobiusMaximus
 
 This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.
 
#ce ----------------------------------------------------------------------------

If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 498, 464)
    MouseClick("left", 506, 623)
    Sleep(1500)
    MouseClick("left", 456, 610)
    Sleep(7000)
    MouseClick("left", 461, 429)
    Sleep(1500)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

Do
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(2000)
Until _IsPressed("0")

-Bob

Edited by BobTheLeetHaxx0r

Photoshop User and Noob AutoIt user.

Share this post


Link to post
Share on other sites

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
By BobiusMaximus

To use this bot start the game then scroll your window up to the top.
This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.

#ce ----------------------------------------------------------------------------
Global $quit
HotKeySet("{ESC}", "Terminate")
HotKeySet("{f1}", "Start")
HotKeySet("{f2}", "Stop")

While 1
    Sleep(100)
WEnd

Func Terminate()
    Exit 0
EndFunc

Func Start()
$quit = 1 
If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

while $quit = 1
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(1500)
wend
EndFunc

Func Stop()
    $quit = 0
EndFunc

sorry try this...

Share this post


Link to post
Share on other sites

It says there is an error in line 44 whenever I try to run that...

Edit:

I got my script working, but it doesn't stop when I push '0' ;)

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

 Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
 By BobiusMaximus
 
 This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.
 
#ce ----------------------------------------------------------------------------

If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 498, 464)
    MouseClick("left", 506, 623)
    Sleep(1500)
    MouseClick("left", 456, 610)
    Sleep(7000)
    MouseClick("left", 461, 429)
    Sleep(1500)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

Do
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(2000)
Until _IsPressed("0")oÝ÷ Øþ«¨µëhër¢êð¢¹"kÊØb±«­¢+Ø%¹±Õ±Ðí5¥Í¹ÔÌÐì((Ì´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´((   ½Ð½ÈA±å¥¹¥±È½Õ¹Ð¡ÑÑÀè¼½¡±±ÁÍ̹½´½µ¥½Á±å¥¹¥±È¹¡Ñµ°(  ä  ½¥ÕÍ5᥵ÕÌ((Q¡¥Ì¡Ì¸Í¥¹ÕÍ¥¹ÄÀÈШÜØàIͽ±½ÕÑ¥½¸µ½¹¥Ñ½È¹Ìäí=ÁÉÌäìɽÝÍÈͼµä¹½Ðݽɬ½¸½Ñ¡É̸((´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´´()%]¥¹á¥ÍÑÌ ÅÕ½ÐíA±å¥¹¥±È´ÅÕ½Ðì¥Q¡¸(]¥¹Ñ¥ÙÑ ÅÕ½ÐíA±å¥¹¥±È´ÅÕ½Ðì¤(%5½ÕÍ
±¥­É ÅÕ½Ðí±ÐÅÕ½Ðì°ÄÀÈÀ°ÌØÔ°ÄÀÈÀ°ÐÐÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°Ðäà°ÐØФ(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÔÀØ°ØÈ̤(%M±À ÄÔÀÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÐÔØ°ØÄÀ¤(%M±À ÜÀÀÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÐØÄ°ÐÈä¤(%M±À ÄÔÀÀ¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÌÈÄ°ØÈ̤(%M¹ ÅÕ½ÐíÉéåµ½¹­äÅÕ½Ðì¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÐÐÔ°ØÈ̤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ØÈÀ°ÌØÀ¤)¹%()¼(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÌÈÄ°ØÈ̤(%M¹ ÅÕ½Ðí½¹ÍÕµÅÕ½Ðì¤(%5½ÕÍ
±¥¬ ÅÕ½Ðí±ÐÅÕ½Ðì°ÐÐÔ°ØÈ̤(%M±À ÈÀÀÀ¤)U¹Ñ¥°}%ÍAÉÍÍ ÅÕ½ÐìÌÀÅÕ½Ðì¤ôÄ
Edited by beerman

Share this post


Link to post
Share on other sites

to get your working try this

#Include <Misc.au3>

#cs ----------------------------------------------------------------------------

 Bot for Playing field 2 found at http://hallpass.com/media/playingfield2.html
 By BobiusMaximus
 
 This has been designed using a 1024*768 Resoloution monitor and 'Opera' browser so may not work on others.
 
#ce ----------------------------------------------------------------------------

If WinExists("Playing Field 2 -")Then
    WinActivate("Playing Field 2 -")
    MouseClickDrag("left", 1020, 365, 1020, 440)
    MouseClick("left", 498, 464)
    MouseClick("left", 506, 623)
    Sleep(1500)
    MouseClick("left", 456, 610)
    Sleep(7000)
    MouseClick("left", 461, 429)
    Sleep(1500)
    MouseClick("left", 321, 623)
    Send("crazymonkey")
    MouseClick("left", 445, 623)
    MouseClick("left", 620, 360)
EndIf

Do
    MouseClick("left", 321, 623)
    Send("consume")
    MouseClick("left", 445, 623)
    Sleep(2000)
Until _IsPressed("30") = 1
yeah yours works, but keep in mind you have a 2 second delay so pressing the 0 key will not be instant exit....so you might have to hit several times...

Share this post


Link to post
Share on other sites

yeah yours works, but keep in mind you have a 2 second delay so pressing the 0 key will not be instant exit....so you might have to hit several times...

To get instant response on the 0 you could something like this:

Func Start()
    $quit = 1
    If WinExists("Playing Field 2 -") Then
        WinActivate("Playing Field 2 -")
        MouseClickDrag("left", 1020, 365, 1020, 440)
        MouseClick("left", 321, 623)
        Send("crazymonkey")
        MouseClick("left", 445, 623)
        MouseClick("left", 620, 360)
    EndIf

    While $quit = 1
        MouseClick("left", 321, 623)
        Send("consume")
        MouseClick("left", 445, 623)
        ; sleep 2 secs 
        $T = TimerInit()
        While TimerDiff($T) < 2000 And $quit = 1
            Sleep(10)
        WEnd
    WEnd
EndFunc   ;==>Start

Func Stop()
    $quit = 0
EndFunc   ;==>Stop
Edited by JdeB

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  

×
×
  • Create New...