Jump to content

how do i set a hotkey to end a loop?


Recommended Posts

So I just made a example script for u guys to use to see as to what im trying to say, what i wanna do is set a key that once I press it, the loop will end, and set a key that once i press it it will run the loop. Here's my example script for u guys to use, thanks for viewing and helping that is if you do help! :D

While $loop == 1

$startx = 295
$starty = 353

$x = Int(Random($startx - 20, $startx + 20))
$y = Int(Random($starty - 20, $starty + 20))

MouseClick("left", $x, $y, 1, 0)
sleep (2000)
$startx = 354
$starty = 131

$x = Int(Random($startx - 20, $startx + 20))
$y = Int(Random($starty - 20, $starty + 20))

MouseClick("left", $x, $y, 1, 0)
sleep (2000)
$startx = 617
$starty = 157

$x = Int(Random($startx - 20, $startx + 20))
$y = Int(Random($starty - 20, $starty + 20))

MouseClick("left", $x, $y, 1, 0)
$loop++
ContinueLoop
WEnd

Edited by Derigian
Link to comment
Share on other sites

Global $run=True

SetHotKey("p","pause")

While 1

If $run=False Then ContinueLoop

$startx = 295
$starty = 353

$x = Int(Random($startx - 20, $startx + 20))
$y = Int(Random($starty - 20, $starty + 20))

MouseClick("left", $x, $y, 1, 0)
sleep (2000)
$startx = 354
$starty = 131

$x = Int(Random($startx - 20, $startx + 20))
$y = Int(Random($starty - 20, $starty + 20))

MouseClick("left", $x, $y, 1, 0)
sleep (2000)
$startx = 617
$starty = 157

$x = Int(Random($startx - 20, $startx + 20))
$y = Int(Random($starty - 20, $starty + 20))

MouseClick("left", $x, $y, 1, 0)
WEnd

Func pause()

$run=Not $run

EndFunc

 

This does not end the loop but it skips

Link to comment
Share on other sites

Global $run=True

SetHotKey("p","pause")

While 1

If $run=False Then ContinueLoop

$startx = 295
$starty = 353

$x = Int(Random($startx - 20, $startx + 20))
$y = Int(Random($starty - 20, $starty + 20))

MouseClick("left", $x, $y, 1, 0)
sleep (2000)
$startx = 354
$starty = 131

$x = Int(Random($startx - 20, $startx + 20))
$y = Int(Random($starty - 20, $starty + 20))

MouseClick("left", $x, $y, 1, 0)
sleep (2000)
$startx = 617
$starty = 157

$x = Int(Random($startx - 20, $startx + 20))
$y = Int(Random($starty - 20, $starty + 20))

MouseClick("left", $x, $y, 1, 0)
WEnd

Func pause()

$run=Not $run

EndFunc

 

This does not end the loop but it skips

​I want it to end the loop. Actually i just want it to end the script all in all,

Link to comment
Share on other sites

Then

SetHotKey("{ESC}","_exit")

While 1

$startx = 295
$starty = 353

$x = Int(Random($startx - 20, $startx + 20))
$y = Int(Random($starty - 20, $starty + 20))

MouseClick("left", $x, $y, 1, 0)
sleep (2000)
$startx = 354
$starty = 131

$x = Int(Random($startx - 20, $startx + 20))
$y = Int(Random($starty - 20, $starty + 20))

MouseClick("left", $x, $y, 1, 0)
sleep (2000)
$startx = 617
$starty = 157

$x = Int(Random($startx - 20, $startx + 20))
$y = Int(Random($starty - 20, $starty + 20))

MouseClick("left", $x, $y, 1, 0)
WEnd

Func _exit()

 Exit

EndFunc

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...