Sign in to follow this  
Followers 0
ReaM

Some help about while

2 posts in this topic

Well. I've made a script that i want to Click my mouse2 very fast (i've set it to 10 times / second) and that starts with hotkeys. It works fine, but i have some problems. Ill let you see the script before i move on.

$attack = 0

$heal = 0

AutoItSetOption("SendKeyDelay", 20)

HotKeySet("^!z", "startattack")

HotKeySet("^!x", "endattack")

Func startattack()

send ("{ENTER}")

send ("Botten Startad")

send ("{ENTER}")

sleep (3000)

$attack = 1

EndFunc

Func endattack()

$attack = 0

sleep (3000)

send ("{ENTER}")

send ("Botten Pausad")

send ("{ENTER}")

EndFunc

While $attack = 0

sleep (1000)

WEnd

While $attack = 1

Mouseclick("right"); mouse2???

sleep (100)

WEnd

It works fine, BUT; if i start and stop the script it terminates. I would like to be able to start/stop it for an unlimited amount of times.

I would also like to have the Q button pressed with a 20 seconds interval, Without writing 2000 sleep's on 100 ms. How do i write that?

Summary: I want to be able to start/stop the script as much as i like

I would like it to press Q every 20 seconds as well.

thanx alot for your time and help

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

cannot test, because i don't have the game, but try this:

AutoItSetOption("SendKeyDelay", 20)
$attack = 0
$heal = 0

HotKeySet("^!z", "attack")
HotKeySet("^!x", "terminate")

While 1
   While $attack = 1
      MouseClick("right")
      Sleep(10)
   Wend
   Sleep(500)
Wend

Func attack()
   If Not $attack Then
      Send("{ENTER}")
      Send("Botten Startad")
      Send("{ENTER}")
      Sleep(3000)
      $attack = 1
   Else  
      $attack = 0
      Sleep(3000)
      Send("{ENTER}")
      Send("Botten Pausad")
      Send("{ENTER}")
   EndIf
   Q()
EndFunc ;==>attack

Func terminate()
   Exit
EndFunc ;==>terminate

Func Q()
   While $attack = 1
      Send("q")
      Sleep(20000)
   Wend
EndFunc ;==>Q

It's pretty much re-written and re-arranged, i hope u don't mind :(

Greetings,

ZeD

-------

Edit: Woop, little error fixed. Should run now :ph34r:

Edited by ZeDMIN

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  
Followers 0