Jump to content

Quick Question


Recommended Posts

Okay, I think I got it now. What I'm trying to do is make the script loop endlessly. I checked here but am confused about which one would be used for my need.

Here's my script so far:

If WinExists("Element Client")
    Then
    Send{+[1]} ;targets party member #1
    Sleep("1000") ;waits a second
    Send{[F2]} ;change this to your hotkey for heal
    Sleep("1000")
    Send{+[2]} ;targets party member #2
    Sleep("1000")
    Send{[F2]} ;change this to your hotkey for heal
    Sleep("1000")
    Send{+[3]}
    Sleep("1000")
    Send{[F2]}
    Sleep("1000")
    Send{+[4]}
    Sleep("1000")
    Send{[F2]}
    Sleep("1000")
    Send{+[5]}
    Sleep("1000")
    Send{[F2]}
    Sleep("1000")
Link to comment
Share on other sites

While 1
If WinExists("Element Client") Then
    Send{+[1]};targets party member #1
    Sleep("1000");waits a second
    Send{[F2]};change this to your hotkey for heal
    Sleep("1000")
    Send{+[2]};targets party member #2
    Sleep("1000")
    Send{[F2]};change this to your hotkey for heal
    Sleep("1000")
    Send{+[3]}
    Sleep("1000")
    Send{[F2]}
    Sleep("1000")
    Send{+[4]}
    Sleep("1000")
    Send{[F2]}
    Sleep("1000")
    Send{+[5]}
    Sleep("1000")
    Send{[F2]}
    Sleep("1000")
EndIf
Wend

By using while 1 (always true) it will continuously loop through the script. Also remember to close all open statements like your If (EndIf) and While (Wend).

Hope this helps,

Regards

Link to comment
Share on other sites

CODE
While 1

If WinExists("elementclient") Then

Winactivate("elementclient")

Send{+[1]};targets party member #1

Sleep("1000");waits a second

Send{[F2]};change this to your hotkey for heal

Sleep("1000")

Send{+[2]};targets party member #2

Sleep("1000")

Send{[F2]};change this to your hotkey for heal

Sleep("1000")

Send{+[3]}

Sleep("1000")

Send{[F2]}

Sleep("1000")

Send{+[4]}

Sleep("1000")

Send{[F2]}

Sleep("1000")

Send{+[5]}

Sleep("1000")

Send{[F2]}

Sleep("1000")

EndIf

Wend

Link to comment
Share on other sites

Take a look at this, I cleaned up your code a bit.

While 1
    If WinExists("elementclient") Then
        WinActivate("elementclient")
        For $i = 1 To 5
            Send("+{" & $i & "}")
            Sleep(1000)
            Send("{F2}")
            Sleep(1000)
        Next
    EndIf
WEnd

And about your first question, take a look at ControlSend().

AlmarM

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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