Sign in to follow this  
Followers 0

EndFor

9 posts in this topic

Posted · Report post

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

Share this post


Link to post
Share on other sites



Posted · Report post

Related

ContinueLoop, ExitLoop

Share this post


Link to post
Share on other sites

Posted · Report post

But you cant call it from a function..

Share this post


Link to post
Share on other sites

Posted · Report post

But you cant call it from a function..

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

Share this post


Link to post
Share on other sites

Posted · Report post

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

Share this post


Link to post
Share on other sites

Posted · Report post

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

Share this post


Link to post
Share on other sites

Posted (edited) · Report post

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

Share this post


Link to post
Share on other sites

Posted · Report post

Something like this?
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

Share this post


Link to post
Share on other sites

Posted (edited) · Report post

Well, that works!

I had that before. Just in the wrong place. Edited by JamesB

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0