Here is the format yours is in...
Code:
HotKeySet("{F5}", "_start")
HotKeySet("{F8}", "_stop")
HotKeySet("{ESC}", "_exit")
$stop = False
While 1
Sleep(100)
WEnd
Func _start()
ToolTip("started")
While 1
If $stop Then ExitLoop
Sleep(100)
WEnd
ToolTip("stopped")
$stop = False
EndFunc
Func _stop()
$stop = True
EndFunc
Func _exit()
Exit
EndFunc
Here is the way i would probably do it if i just needed to jump out of a single function...
Code:
#include <misc.au3>
$x = 1
While 1
If _IsPressed("77") Then ExitLoop ;77 = F8
ToolTip($x)
$x+=1
WEnd