Jump to content

how to run 2 "while" command together.


Recommended Posts

i got this script

while 1
send ("{space}");atk
sleep (100)
wend


while 1
send("2");hp
sleep (5000)
wend

while 1
send("1");mana
sleep (5000)
wend

i want it to run 3 "while" together but it run only first while. what code should i use? :)

anyone can help me please? :)

ps.sorry for my bad english

Edited by masarcasticz
Link to comment
Share on other sites

yes i have tried function but it doesn't like what i want

i want it to run 3 things together but function will run it one by one

i use this

while 1
atk()
hp()
mana()
wend


func atk()
send ("{space}");atk
sleep (100)
endfunc


func hp()
send("2");hp
sleep (5000)
endfunc

func mana()
send("1");mana
sleep (5000)
endfunc

help me please :)

Edited by masarcasticz
Link to comment
Share on other sites

Link to comment
Share on other sites

ah I see..

Thank You very much dbzfanatic :)

I will study about Adlibs and timers. :)

Try something like this:

$begin = TimerInit()

while 1
    $diff = TimerDiff($begin)
    
    if (mod($diff, 100) > 95) Then
        send ("{space}");atk
    EndIf
    
    if (mod($diff, 5000) > 4900) Then
        send("2");hp
        send("1");mana
    EndIf
WEnd
Link to comment
Share on other sites

I can think one other way, create a bat file that calls three autoit scripts. You will have to compile the three scripts first to get the exes.

By using the start command, you create a new process in which the call runs in independent of the cmd process the bat file runs in.

Example:

Start script_1.exe

Start script_2.exe

Start script_3.exe

The bat file will finish but the three exes will still be running within there own processes.

Hope that helps.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

True, you could do the same thing with a single AutoIT script.

If @Compiled = 0 Then
    MsgBox(0,"","This Script must compiled to properly function")
    Exit
EndIf

If $CMDLine[0] > 0 Then
    Opt("TrayIconHide", 1)
    If $CMDLine[1] = "/atk" Then
        atk()
        Exit
    EndIf
    If $CMDLine[1] = "/hp" Then
        hp()
        Exit
    EndIf
    If $CMDLine[1] = "/mana" Then
        mana()
        Exit
    EndIf
    Opt("TrayIconHide", 0)
EndIf


RunAllSends()


Func RunAllSends()
    $1 = Run(@ScriptFullPath & " /atk")
    $2 = Run(@ScriptFullPath & " /hp")
    $3 = Run(@ScriptFullPath & " /mana")
    While ProcessExists($1) AND ProcessExists($2) AND ProcessExists($3)
        Sleep(10)
    Wend
EndFunc

func atk()
MsgBox(0,"","Send 1")
;send ("{space}");atk
sleep (100)
endfunc


func hp()
MsgBox(0,"","Send 2")
;send("2");hp
sleep (5000)
endfunc

func mana()
MsgBox(0,"","Send 3")
;send("1");mana
sleep (5000)
endfunc
Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

I see that working too. As long as it has it's own process, I assume Run does that.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

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