Jump to content

Recommended Posts

Posted (edited)

I am doing a small WC3 autosend for some funmaps my problems is i am working with HotKeySet

when i set the hotkey the script should only react when the war3.exe is active this works fine.

But it should stop when war3.exe got closed this is not woking really good.

I used ProcessExists but it polls the process every 250ms and this makes the game laggy so i worked out with ProcessWaitClose

but now the script wont go back to the ProcessWait to see if the war3.exe is running

Here is the Script:

Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.
Opt("TrayIconDebug",1)

HotKeySet ( "{ESCAPE}" , "exitt")

    While 1
        ProcessWait("war3.exe")
        HotKeySet ( "{NUMPAD0}" , "str" )
        HotKeySet ( "{NUMPAD1}" , "intt" )
        HotKeySet ( "{NUMPAD2}" , "agi" )
        HotKeySet ( "{NUMPAD3}" , "live" )
        HotKeySet ( "{NUMPAD4}" , "live10" )
    While ProcessWaitClose ("war3.exe")
    WEnd
        HotKeySet ( "{NUMPAD0}"  )
        HotKeySet ( "{NUMPAD1}"  )
        HotKeySet ( "{NUMPAD2}"  )
        HotKeySet ( "{NUMPAD3}"  )
        HotKeySet ( "{NUMPAD4}"  )
    WEnd
    
Func exitt()
    Exit
EndFunc

Func agi()
        Send("^{ENTER}")
        Send("-agi max{ENTER}")
        Send("^{ENTER}")
        Send("-agi max{ENTER}")
        Send("^{ENTER}")
        Send("-agi max{ENTER}")
        Send("^{ENTER}")
        Send("-agi max{ENTER}")
        Send("^{ENTER}")
        Send("-agi max{ENTER}")
EndFunc
Func live10()
        Send("^{ENTER}")
        Send("-buy 10 lives{ENTER}")
        Send("^{ENTER}")
        Send("-buy 10 lives{ENTER}")
        Send("^{ENTER}")
        Send("-buy 10 lives{ENTER}")
        Send("^{ENTER}")
        Send("-buy 10 lives{ENTER}")
        Send("^{ENTER}")
        Send("-buy 10 lives{ENTER}")
    Send("{ALT}")
EndFunc
Func live()
        Send("^{ENTER}")
        Send("-buy live{ENTER}")
        Send("^{ENTER}")
        Send("-buy live{ENTER}")
        Send("^{ENTER}")
        Send("-buy live{ENTER}")
        Send("^{ENTER}")
        Send("-buy live{ENTER}")
        Send("^{ENTER}")
        Send("-buy live{ENTER}")
    Send("{ALT}")
EndFunc
Func str()
        Send("^{ENTER}")
        Send("-str max{ENTER}")
        Send("^{ENTER}")
        Send("-str max{ENTER}")
        Send("^{ENTER}")
        Send("-str max{ENTER}")
        Send("^{ENTER}")
        Send("-str max{ENTER}")
        Send("^{ENTER}")
        Send("-str max{ENTER}")
    Send("{ALT}")
EndFunc
Func intt()
        Send("^{ENTER}")
        Send("-int max{ENTER}")
        Send("^{ENTER}")
        Send("-int max{ENTER}")
        Send("^{ENTER}")
        Send("-int max{ENTER}")
        Send("^{ENTER}")
        Send("-int max{ENTER}")
        Send("^{ENTER}")
        Send("-int max{ENTER}")
    Send("{ALT}")
EndFunc

BTW: How can i destroy an while executing when i use While $run and set $run to 1

because when i set $run to 0 with a hotkey the while is still executing

Edited by unixu
Posted

BTW: How can i destroy an while executing when i use While $run and set $run to 1

because when i set $run to 0 with a hotkey the while is still executing

i did not see any code set the $run to 0. i think it should be working if you declare $run as a global variable
Posted (edited)

I am doing a small WC3 autosend for some funmaps my problems is i am working with HotKeySet

when i set the hotkey the script should only react when the war3.exe is active this works fine.

But it should stop when war3.exe got closed this is not woking really good.

I used ProcessExists but it polls the process every 250ms and this makes the game laggy so i worked out with ProcessWaitClose

but now the script wont go back to the ProcessWait to see if the war3.exe is running

BTW: How can i destroy an while executing when i use While $run and set $run to 1

because when i set $run to 0 with a hotkey the while is still executing

The Processwaitclose func pauses the script and waits for a process to close before starting the script again.

Try WaitWinActive.

Or try While 1

WinActive(Your Process)

yourhotkeys

wend

Edited by Beginner321

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
  • Recently Browsing   0 members

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