OrangePanda Posted August 9, 2006 Share Posted August 9, 2006 I tried to create a script that has 4 hot keys in it basically i have 2 commands with 2 hotkeys each one for activating it and The other to turn it off. My script basically should do this Function A hotkeys: F9 = ACTIVATE F10= OFF Function B Hotkeys: F11 = ACTIVATE F12 = OFF my problem is this. when I put them on a single script the other set of hotkeys would`nt work. But if I remove one of the script the other would work. Im really new at this and just started today. hope to learn more from it thanks Link to comment Share on other sites More sharing options...
BigDod Posted August 9, 2006 Share Posted August 9, 2006 Could you please post code to show what you have tried. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
OrangePanda Posted August 9, 2006 Author Share Posted August 9, 2006 expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: OrangePanda ; ; Script Function: ; AutoKey ; ; ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GuiConstants.au3> ; GUI Opt("GUIOnEventMode", 1) ; Change to OnEvent mode GuiCreate("OrangePanda Autokey v1.0", 250, 180) GUISetState(@SW_SHOW) ;LABELS GuiCtrlCreateLabel("COMMANDS:", 10, 10, 100, 20) GuiCtrlCreateLabel("F9 = Auto Buffs ON", 10, 25, 140, 20) GuiCtrlCreateLabel("F10 = Auto Buffs OFF", 10, 40, 140, 20) GuiCtrlCreateLabel("F11 = Auto Loots ON", 10, 55, 140, 20) GuiCtrlCreateLabel("F12 = Auto Loots OFF", 10, 70, 140, 20) GuiCtrlCreateLabel("USE 1024x768 resolution ONLY", 50, 115, 200, 20) GuiCtrlCreateLabel("orangepanda2006", 160,165, 175, 20) $exit= GuiCtrlCreateButton("Exit", 50, 135, 150, 20) GUICtrlSetOnEvent($exit, "ExitScript") Func ExitScript() Exit EndFunc ;AUTOBUFF HotKeySet("{F9}", "_Autobuff") HotKeySet("{F10}", "_OFF") $Buff = 0 While 1 if $Buff Then MouseDown ( "right" ) MouseMove( 977, 13, 2) Send("4") Sleep(1000) Send("5") Sleep(1000) Send("6") Sleep(1000) MouseMove( 977, 50, 2) Send("4") Sleep(1000) Send("5") Sleep(1000) Send("6") Sleep(1000) MouseMove( 977, 88, 2) Send("4") Sleep(1000) Send("5") Sleep(1000) Send("6") Sleep(1000) MouseMove( 977, 112, 2) Send("4") Sleep(1000) Send("5") Sleep(1000) Send("6") Sleep(1000) MouseMove( 977, 145, 2) Send("4") Sleep(1000) Send("5") Sleep(1000) Send("6") Sleep(5000) EndIf WEnd Func _Autobuff() $Buff = 1 EndFunc Func _OFF() MouseUp ( "right" ) Sleep(500) MouseDown ( "left" ) Sleep(500) MouseUp ( "left" ) $Buff = 0 EndFunc HotKeySet("{F11}", "_Autoloot") HotKeySet("{F12}", "_OFF2") $pick = 0 While 1 if $pick Then Send("{SPACE}") Sleep(500) EndIf WEnd Func _Autoloot() $pick = 1 EndFunc Func _OFF2() $pick = 0 EndFunc ; GUI MESSAGE LOOP GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd ----------------------------------------------------------------------------------------------------------------- here it is. Link to comment Share on other sites More sharing options...
/dev/null Posted August 9, 2006 Share Posted August 9, 2006 here it is.Your script will be "caught" in the first While loop. As there is no exit condition nothing after that first while loop will be executed!! You should restructure your code.Some tipps: 1.) Use just one while loop and check both variables: $Buff and $pick.2.) You don't need a message loop, as you're in GUI Event mode.3.) Put your calls to HotKeySet() at the beginning of your script.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
eynstyne Posted August 9, 2006 Share Posted August 9, 2006 (edited) I'm not sure, but is this what you wanted? expandcollapse popup;AUTOBUFF HotKeySet("{F9}", "_Autobuff") HotKeySet("{F10}", "_OFF") HotKeySet("{F11}", "_Autoloot") HotKeySet("{F12}", "_OFF2") #include <GuiConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode GuiCreate("OrangePanda Autokey v1.0", 250, 180) GUISetState(@SW_SHOW) GuiCtrlCreateLabel("COMMANDS:", 10, 10, 100, 20) GuiCtrlCreateLabel("F9 = Auto Buffs ON", 10, 25, 140, 20) GuiCtrlCreateLabel("F10 = Auto Buffs OFF", 10, 40, 140, 20) GuiCtrlCreateLabel("F11 = Auto Loots ON", 10, 55, 140, 20) GuiCtrlCreateLabel("F12 = Auto Loots OFF", 10, 70, 140, 20) GuiCtrlCreateLabel("USE 1024x768 resolution ONLY", 50, 115, 200, 20) GuiCtrlCreateLabel("orangepanda2006", 160,165, 175, 20) $exit = GuiCtrlCreateButton("Exit", 50, 135, 150, 20) GUICtrlSetOnEvent($exit, "ExitScript") GuiSetState() $Buff = 0 $pick = 0 While 1 $msg = GuiGetMsg() if $msg = $GUI_EVENT_CLOSE then exit if $pick = 1 Then Send("{SPACE}") Sleep(500) EndIf if $Buff = 1 Then MouseDown ( "right" ) MouseMove( 977, 13, 2) Send("4") Sleep(1000) Send("5") Sleep(1000) Send("6") Sleep(1000) MouseMove( 977, 50, 2) Send("4") Sleep(1000) Send("5") Sleep(1000) Send("6") Sleep(1000) MouseMove( 977, 88, 2) Send("4") Sleep(1000) Send("5") Sleep(1000) Send("6") Sleep(1000) MouseMove( 977, 112, 2) Send("4") Sleep(1000) Send("5") Sleep(1000) Send("6") Sleep(1000) MouseMove( 977, 145, 2) Send("4") Sleep(1000) Send("5") Sleep(1000) Send("6") Sleep(5000) EndIf WEnd Func _Autobuff() $Buff = 1 EndFunc Func _OFF() MouseUp ( "right" ) Sleep(500) MouseDown ( "left" ) Sleep(500) MouseUp ( "left" ) $Buff = 0 EndFunc Func _Autoloot() $pick = 1 EndFunc Func _OFF2() $pick = 0 EndFunc Func ExitScript() Exit EndFunc Hope it works out for you Edited August 9, 2006 by eynstyne F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent] Link to comment Share on other sites More sharing options...
OrangePanda Posted August 9, 2006 Author Share Posted August 9, 2006 wow thanks for the fast replies my plan for the script is that it will continue to loop until I turn it off with the other hotkey @eynstyne thanks man both the commands now work, although the 2nd command (non stop space bar) dOesnt stop even though I press the hotkey for it to stop. I just kinda patterneD it on the first one. im gonna study what you change thanks again. im sorry if its messy since its the first one I have made Link to comment Share on other sites More sharing options...
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