unixu Posted April 1, 2009 Posted April 1, 2009 (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: expandcollapse popupOpt("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 April 1, 2009 by unixu
netnet227 Posted April 1, 2009 Posted April 1, 2009 BTW: How can i destroy an while executing when i use While $run and set $run to 1because when i set $run to 0 with a hotkey the while is still executingi did not see any code set the $run to 0. i think it should be working if you declare $run as a global variable
Beginner321 Posted April 1, 2009 Posted April 1, 2009 (edited) I am doing a small WC3 autosend for some funmaps my problems is i am working with HotKeySetwhen 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 ProcessWaitClosebut now the script wont go back to the ProcessWait to see if the war3.exe is runningBTW: How can i destroy an while executing when i use While $run and set $run to 1because when i set $run to 0 with a hotkey the while is still executingThe Processwaitclose func pauses the script and waits for a process to close before starting the script again. Try WaitWinActive. Or try While 1WinActive(Your Process)yourhotkeyswend Edited April 1, 2009 by Beginner321
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now