Archension Posted November 5, 2006 Share Posted November 5, 2006 I'm trying to create a macro to Bfly for Gunz: The Duel, but I'm having some problems with creating it using AutoIt (since I am a noob at scripting). I want my script to do "Spacebar" "w (or a,s,d) twice really fast" "Left mouse click" and "shift" in that order pretty fast when I use a hotkey "w" (or a,s,d), but I can't seem to get it to work. I'm not sure what I'm doing wrong so any help would be appreciated. Here's the script. expandcollapse popupGlobal $Paused HotKeySet("{F1}", "TogglePause") HotKeySet("{F2}", "Terminate") HotKeySet("w", "BflyForward") HotKeySet("s", "BflyBackward") HotKeySet("a", "BflyLeft") HotKeySet("d", "BflyRight") Func BflyForward() Send("{space}") sleep (250) Send("ww") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") EndFunc Func BflyBackward() Send("{space}") sleep (250) Send("ss") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") EndFunc Func BflyLeft() Send("{space}") sleep (250) Send("aa") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") EndFunc Func BflyRight() Send("{space}") sleep (250) Send("dd") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") Endfunc Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
theguy0000 Posted November 5, 2006 Share Posted November 5, 2006 you have a hotkey set to w. You send the letters ww. the send command activates the hotkey. try this Func BflyForward() HotKeySet ("w", "") Send("{space}") sleep (250) Send("ww") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") HotKeySet ("w", "BflyForward") EndFunc which will unset the hotkey first, do what it needs to do, then set the hotkey back to its original function. Do that to all your functions and you should be good to go The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
GaryFrost Posted November 5, 2006 Share Posted November 5, 2006 you have a hotkey set to w. You send the letters ww. the send command activates the hotkey. try this Func BflyForward() HotKeySet ("w", "") Send("{space}") sleep (250) Send("ww") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") HotKeySet ("w", "BflyForward") EndFunc which will unset the hotkey first, do what it needs to do, then set the hotkey back to its original function. Do that to all your functions and you should be good to go Won't get that far with-out the main loop SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
theguy0000 Posted November 5, 2006 Share Posted November 5, 2006 Won't get that far with-out the main loopLOL oops yeah add this While 1 Sleep (250) WEnd add that after the HotKeySets but before the Funcs The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
Archension Posted November 5, 2006 Author Share Posted November 5, 2006 Ok, I updated my script but now I get an error saying unknown function name when I try to use the hotkeys w, a, s, d. Heres the current script with updates. expandcollapse popup; Press F2 to terminate script, F1 to "pause" Global $Paused HotKeySet("{F1}", "TogglePause") HotKeySet("{F2}", "Terminate") HotKeySet("w", "BflyForward") HotKeySet("s", "BflyBackward") HotKeySet("a", "BflyLeft") HotKeySet("d", "BflyRight") While 1 Sleep(250) Wend Func BflyForward() HotKeySet("w", "") Send("{space}") sleep (250) Send("ww") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") HotKeySet("w", "BflyForward") EndFunc Func BflyBackward() HotKeySet("s", "") Send("{space}") sleep (250) Send("ss") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") HotKeySet("s", "BflyBackward") EndFunc Func BflyLeft() HotKeySet("a", "") Send("{space}") sleep (250) Send("aa") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") HotKeySet("a", "BflyLeft") EndFunc Func BflyRight() HotKeySet("d", "") Send("{space}") sleep (250) Send("dd") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") HotKeySet("d", "BflyRight") Endfunc Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
theguy0000 Posted November 5, 2006 Share Posted November 5, 2006 (edited) oops sorry heres the fixed code expandcollapse popup; Press F2 to terminate script, F1 to "pause" Global $Paused HotKeySet("{F1}", "TogglePause") HotKeySet("{F2}", "Terminate") HotKeySet("w", "BflyForward") HotKeySet("s", "BflyBackward") HotKeySet("a", "BflyLeft") HotKeySet("d", "BflyRight") While 1 Sleep(250) Wend Func BflyForward() HotKeySet("w") Send("{space}") sleep (250) Send("ww") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") HotKeySet("w", "BflyForward") EndFunc Func BflyBackward() HotKeySet("s") Send("{space}") sleep (250) Send("ss") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") HotKeySet("s", "BflyBackward") EndFunc Func BflyLeft() HotKeySet("a") Send("{space}") sleep (250) Send("aa") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") HotKeySet("a", "BflyLeft") EndFunc Func BflyRight() HotKeySet("d") Send("{space}") sleep (250) Send("dd") sleep (50) MouseClick ("Left") Sleep (50) Send("{shift}") HotKeySet("d", "BflyRight") Endfunc Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc should use HotKeySet ("w") instead of HotKeySet ("w", "") Edited November 5, 2006 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
Paulie Posted November 5, 2006 Share Posted November 5, 2006 (edited) @OP, For future reference, when posting a thread title, make its title remotely pertinent to question/subject you are posting about. This is the support section of the forum, its meant for questions, so naming a thread "I Have A Problem", or "Question", or "Help Me My, Code Doesn't Work", or "Noob Requesting Assistance" Is redundant, and makes it harder for anyone else who has the same/similar questions as you to find the answer by searching the forums, which in turn means people often make extra threads, and people who are answering the threads just end up repeating the same answer several times over. It is counter-productive. Edited November 5, 2006 by Paulie 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