Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

EndFor


  • Please log in to reply
8 replies to this topic

#1 James

James

    Universalist

  • MVPs
  • 10,353 posts

Posted 02 December 2007 - 09:54 PM

Hey all,

I can't find a way of ending a For Next loop so, here we go. EndFor ends loops in a For Next Loop.

James







#2 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,361 posts

Posted 02 December 2007 - 09:57 PM

Related

ContinueLoop, ExitLoop


Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#3 James

James

    Universalist

  • MVPs
  • 10,353 posts

Posted 02 December 2007 - 10:09 PM

But you cant call it from a function..

#4 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,361 posts

Posted 02 December 2007 - 10:11 PM

But you cant call it from a function..

Lost you here ... what does a function have to do with ending a For-Next loop ?

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#5 James

James

    Universalist

  • MVPs
  • 10,353 posts

Posted 02 December 2007 - 10:12 PM

Say you call the For Next Loop in one function, you cannot call another to stop it.

#6 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,361 posts

Posted 02 December 2007 - 10:14 PM

Say you call the For Next Loop in one function, you cannot call another to stop it.

That makes it a lot clearer :)
What about a simple scriptlet to show what you mean because I think its just a matter of properly coding your script ....

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#7 James

James

    Universalist

  • MVPs
  • 10,353 posts

Posted 02 December 2007 - 10:15 PM

AutoIt         
Opt("ColorMode", 1) HotKeySet("{F9}", "StartMe") HotKeySet("{F8}", "Terminate") Global $v = 2 While 1     Sleep(100) WEnd Func Terminate()     MsgBox(0, "Bot", "Bot stopped!") EndFunc   ;==>Terminate Func StartMe()     MsgBox(0, "Bot", "Bot started")     If $v = 2 Then         For $i = 1 To 15             MouseMove(496, 324, 1)             MouseClick("right", 496, 324, 2, 5)             Sleep(2000)             MouseClick("left", 263, 495, 2, 5)             MouseMove(263, 495, 1)             Sleep(2000)             MouseMove(495, 233, 1)             MouseClick("left", 495, 233, 2, 5)             MouseMove(495, 233, 1)             Sleep(2000)             Send(" ", 1)         Next     ElseIf $v = 1 Then         MsgBox(0, "Bot", "Variable not set to 2!")     EndIf EndFunc   ;==>StartMe Func Color()     $Colour = PixelGetColor(202, 272)     If $Colour = Hex(0xA7885D) Then         MsgBox(0, "Colour", Hex($Colour))     Else         MsgBox(0, "Colour", "The colour found was not white but, " & Hex($Colour))     EndIf EndFunc   ;==>Color

I'm helping someone with a bot.

Edited by JamesB, 02 December 2007 - 10:18 PM.


#8 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,361 posts

Posted 02 December 2007 - 10:18 PM

Something like this?
Plain Text         
Opt("ColorMode", 1) HotKeySet("{F9}", "StartMe") HotKeySet("{F8}", "Terminate") Global $v = 2 Global $Switch While 1     Sleep(100) WEnd Func Terminate()     $Switch = 0     MsgBox(0, "Bot", "Bot stopped!") EndFunc;==>Terminate Func StartMe()     MsgBox(0, "Bot", "Bot started")     If $v = 2 Then         $Switch = 1         For $i = 1 To 15             MouseMove(496, 324, 1)             MouseClick("right", 496, 324, 2, 5)             If Not $Switch then ExitLoop             Sleep(2000)             MouseClick("left", 263, 495, 2, 5)             MouseMove(263, 495, 1)             If Not $Switch then ExitLoop             Sleep(2000)             MouseMove(495, 233, 1)             MouseClick("left", 495, 233, 2, 5)             MouseMove(495, 233, 1)             If Not $Switch then ExitLoop             Sleep(2000)             Send(" ", 1)         Next     ElseIf $v = 1 Then         MsgBox(0, "Bot", "Variable not set to 2!")     EndIf EndFunc;==>StartMe Func Color()     $Colour = PixelGetColor(202, 272)     If $Colour = Hex(0xA7885D) Then         MsgBox(0, "Colour", Hex($Colour))     Else         MsgBox(0, "Colour", "The colour found was not white but, " & Hex($Colour))     EndIf EndFunc;==>Color

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)


#9 James

James

    Universalist

  • MVPs
  • 10,353 posts

Posted 02 December 2007 - 10:20 PM

Well, that works!

I had that before. Just in the wrong place.

Edited by JamesB, 02 December 2007 - 10:27 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users