DrLouie Posted September 15, 2008 Share Posted September 15, 2008 hi all i coded a simple script to convert a key to do a "combo" expandcollapse popup#Include <Misc.Au3> While 1 HotKeySet("f","f") HotKeySet("r","r") HotKeySet("g","g") HotKeySet("t","t") hotkeyset("c","c") HotKeySet("v","v") hotkeyset("b","b") WEnd While 1 Sleep(100) WEnd Func f() HotKeySet("f") send("{DOWN}") sleep(35) Send("{LEFT}") sleep(35) Send("e") EndFunc Func r() send("{DOWN}") sleep(35) Send("{RIGHT}") sleep(35) Send("e") EndFunc Func g() Send("{DOWN}") sleep(23) Send("{LEFT}") sleep(23) Send("q") sleep(23) Send("w") EndFunc Func t() Send("{DOWN}") sleep(23) Send("{RIGHT}") sleep(23) Send("q") sleep(23) Send("w") EndFunc Func c() send("{DOWN}") sleep(25) send("{DOWN}") sleep(25) send("{UP}") sleep(25) send("{UP}") EndFunc Func b() send("{DOWN}") sleep(26) Send("{LEFT}") sleep(26) Send("q") EndFunc Func v() send("{DOWN}") sleep(27) Send("{RIGHT}") sleep(27) Send("q") EndFunc Func Quit() Exit EndFunc its for a game i play, but i have a problem cause when i hit R for example, my game will be a bit laggy cause it loops real fast, like if i hold R it keeps doing : down right E. how can i edit my code so i can HOLD the R button but it only do the function 1 time. so not looping. Link to comment Share on other sites More sharing options...
Bert Posted September 15, 2008 Share Posted September 15, 2008 (edited) You have many while loops without a way to exit the loop. For example, you set your hotsetkeys in a loop. You only need to set them once. Try this: expandcollapse popup#Include <Misc.Au3> HotKeySet("f","f") HotKeySet("r","r") HotKeySet("g","g") HotKeySet("t","t") hotkeyset("c","c") HotKeySet("v","v") hotkeyset("b","b") While 1 Sleep(100) WEnd Func f() HotKeySet("f") ;This releases the hotsetkey. Is this what you intended? if not, remove this line. send("{DOWN}") sleep(35) Send("{LEFT}") sleep(35) Send("e") EndFunc Func r() send("{DOWN}") sleep(35) Send("{RIGHT}") sleep(35) Send("e") EndFunc Func g() Send("{DOWN}") sleep(23) Send("{LEFT}") sleep(23) Send("q") sleep(23) Send("w") EndFunc Func t() Send("{DOWN}") sleep(23) Send("{RIGHT}") sleep(23) Send("q") sleep(23) Send("w") EndFunc Func c() send("{DOWN}") sleep(25) send("{DOWN}") sleep(25) send("{UP}") sleep(25) send("{UP}") EndFunc Func b() send("{DOWN}") sleep(26) Send("{LEFT}") sleep(26) Send("q") EndFunc Func v() send("{DOWN}") sleep(27) Send("{RIGHT}") sleep(27) Send("q") EndFunc Func Quit() Exit EndFunc Edited September 15, 2008 by Volly The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
DW1 Posted September 15, 2008 Share Posted September 15, 2008 (edited) Something like this perhaps: #include<misc.au3> HotKeySet("r", "r") While 1 Sleep(100) WEnd Func r() HotKeySet("r", "NoBuffer") ; Unbind "r" and this function (Reassign to "NoBuffer" so that we do not send the 'r' key while it is held). While _IsPressed(52) ; Waits until the 'r' key is no longer being held, before performing action Sleep(10) WEnd Send("{DOWN}") Sleep(35) Send("{RIGHT}") Sleep(35) Send("e") HotKeySet("r", "r") ; bind 'r' back with this function EndFunc ;==>r Func NoBuffer() Sleep(10) EndFunc EDIT: Commented code (I am really bad about that). Edited September 15, 2008 by danwilli AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Skruge Posted September 15, 2008 Share Posted September 15, 2008 Welcome to the forums! how can i edit my code so i can HOLD the R button but it only do the function 1 time. so not looping.Try this: #Include <Misc.au3> ... Func f() HotKeySet("f" ,"DoNothing") Send("{DOWN}") Sleep(35) Send("{LEFT}") Sleep(35) Send("e") While _IsPressed("46") Sleep(100) WEnd HotKeySet("f","f") EndFunc ... Func DoNothing() ; Do Nothing EndFunc Of course, you'll need to replace "46" with the scancodes for each key (consult the help file). Good luck! [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
DrLouie Posted September 15, 2008 Author Share Posted September 15, 2008 well now i can press F only one time, and then it doesn't work anymore... and if i restart it it works again. i wanted to have it like this: if i press f it does my combo, and then not anymore and if i press it again it will do it again. cause in my script when i "hold" f too long like or press it too much after each other it will lag me in the game. because it keeps sending down left e Link to comment Share on other sites More sharing options...
DrLouie Posted September 15, 2008 Author Share Posted September 15, 2008 (edited) Welcome to the forums! Try this: #Include <Misc.au3> ... Func f() HotKeySet("f" ,"DoNothing") Send("{DOWN}") Sleep(35) Send("{LEFT}") Sleep(35) Send("e") While _IsPressed("46") Sleep(100) WEnd HotKeySet("f","f") EndFunc ... Func DoNothing() ; Do Nothing EndFunc Of course, you'll need to replace "46" with the scancodes for each key (consult the help file). Good luck! exactly what i was looking for thanks <3 , where can i find the scan codes? Edited September 15, 2008 by DrLouie Link to comment Share on other sites More sharing options...
DW1 Posted September 15, 2008 Share Posted September 15, 2008 Almost identical to mine AutoIt3 Online Help Link to comment Share on other sites More sharing options...
DrLouie Posted September 15, 2008 Author Share Posted September 15, 2008 nvm i found key codes , thanks all for your (quick) help lol :]! Link to comment Share on other sites More sharing options...
Skruge Posted September 15, 2008 Share Posted September 15, 2008 Almost identical to mine Yeah, I always refresh before posting, but yours didn't show up this time. >_< In case the OP is wondering, my example will send the "combo" when the key is pressed, and Dan's sends the "combo" when the key is released.Useful to have and understand both. [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
DrLouie Posted September 15, 2008 Author Share Posted September 15, 2008 Yeah, I always refresh before posting, but yours didn't show up this time. In case the OP is wondering, my example will send the "combo" when the key is pressed, and Dan's sends the "combo" when the key is released.Useful to have and understand both.yea lol i just started using auto it , but i know there are unlimited things to create with this. im going to study it alot Link to comment Share on other sites More sharing options...
DrLouie Posted September 15, 2008 Author Share Posted September 15, 2008 (edited) Hi all , its working like a charm now, but sometimes suddenly my f key locks, it wont do nothing until i restart script while my r key is still working maybe its with more keys anyone know what the problem is? now my r key locked after a while i couldnt use it , but my f did those are the 2 i mainly use lol i dont know what i did wrong , but while im busy it suddenly stops working.. expandcollapse popup#Include <Misc.Au3> HotKeySet("f","f") HotKeySet("r","r") HotKeySet("g","g") HotKeySet("t","t") hotkeyset("c","c") HotKeySet("v","v") hotkeyset("b","b") While 1 Sleep(100) WEnd Func f() HotKeySet("f" ,"DoNothing") Send("{DOWN}") Sleep(22) Send("{LEFT}") Sleep(22) Send("e") While _IsPressed("46") Sleep(22) WEnd HotKeySet("f","f") EndFunc Func r() HotKeySet("r","DoNothing") send("{DOWN}") sleep(22) Send("{RIGHT}") sleep(22) Send("e") While _IsPressed("52") Sleep(22) WEnd HotkeySet("r","r") EndFunc Func g() HotKeySet("g" ,"DoNothing") Send("{DOWN}") Sleep(22) Send("{LEFT}") Sleep(22) Send("q") Sleep(22) Send("w") While _IsPressed("47") Sleep(22) WEnd HotKeySet("g","g") EndFunc Func t() HotKeySet("t","DoNothing") send("{DOWN}") sleep(22) Send("{RIGHT}") sleep(22) Send("q") sleep(22) Send("w") While _IsPressed("54") Sleep(22) WEnd HotkeySet("t","t") EndFunc Func c() send("{DOWN}") sleep(25) send("{DOWN}") sleep(25) send("{UP}") sleep(25) send("{UP}") EndFunc Func b() HotKeySet("f" ,"DoNothing") Send("{DOWN}") Sleep(22) Send("{LEFT}") Sleep(22) Send("q") While _IsPressed("42") Sleep(22) WEnd HotKeySet("b","b") EndFunc Func v() HotKeySet("r","DoNothing") send("{DOWN}") sleep(22) Send("{RIGHT}") sleep(22) Send("q") While _IsPressed("56") Sleep(22) WEnd HotkeySet("v","v") EndFunc Func DoNothing() ; Do Nothing EndFunc Edited September 15, 2008 by DrLouie Link to comment Share on other sites More sharing options...
Skruge Posted September 15, 2008 Share Posted September 15, 2008 now my r key locked after a while i couldnt use it , but my f did those are the 2 i mainly use loli dont know what i did wrong , but while im busy it suddenly stops working..Here are the problems...Func b() HotKeySet("f" ,"DoNothing")...Func v() HotKeySet("r","DoNothing") [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
DrLouie Posted September 15, 2008 Author Share Posted September 15, 2008 lol im dumb thanks alot =] , im learning lol 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