lucky Posted September 28, 2006 Share Posted September 28, 2006 I use emulators to play old games, and my I'm already in my 50's. I have arthritis in my fingers. I use wsad and numpad 1-6 to play old games. Is there any way to use AutoIt to emulate combination keystrokes, such as a hadoken? (w, s, s + d, d + numpad 1) I don't know if AutoIt is what does this. If it can't emulate keystrokes like a hadoken or dragon uppercut (d, d + s, d + numpad 1) Of course in between the keystrokes there would have to be millisecond pauses. To recapitulate, what I'm trying to say is, can AutoIt simulate a hadoken to one keystroke? I appreciate your time reading this. Link to comment Share on other sites More sharing options...
herewasplato Posted September 28, 2006 Share Posted September 28, 2006 (edited) Welcome to the forums. Copy the code below into a text file and rename it test.au3 Start that script and then press F1HotKeySet("{F1}", "MyFunc_1") HotKeySet("{F2}", "MyFunc_2") While 1 Sleep(1000) WEnd Func MyFunc_1() MsgBox(0, "", "You pressed F1.") EndFunc ;==>MyFunc_1 Func MyFunc_2() MsgBox(0, "", "You pressed F2.") EndFunc ;==>MyFunc_2To get it the functions to send the keys that you want, change the "MsgBox" lines to "Send" lines... see the help file under send. Also look up HotKeySet to see about changing the key assigned to trigger the function. Edit1: You can read up on "Sleep" in the help file for those delays or AutoItSetOption("SendKeyDelay", 50) You will enjoy AutoIt. complete sentences and "recapitulate"... I've never seen that word on here before... Edited September 28, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
lucky Posted September 28, 2006 Author Share Posted September 28, 2006 (edited) Alright, I followed your instructions. Just for you to know how I'm coming along I'll show you what I have so far. HotKeySet("{F1}", "MyFunc_1") HotKeySet("{F2}", "MyFunc_2") While 1 Sleep(1000) WEnd Func MyFunc_1() Send("{ASC 065}") EndFunc;==>MyFunc_1 Func MyFunc_2() Send("{ASC 065}") EndFunc;==>MyFunc_2 I'm still figuring out multiple key combinations without repetition as presented in the help guide. EDIT #1: My first question is, "How do I have a flow of keys, as in having it detect it as s WAIT, s+d WAIT, d + {NUMPAD1}" Edited September 28, 2006 by lucky Link to comment Share on other sites More sharing options...
blademonkey Posted September 28, 2006 Share Posted September 28, 2006 (edited) Alright, I followed your instructions. Just for you to know how I'm coming along I'll show you what I have so far. HotKeySet("{F1}", "MyFunc_1") HotKeySet("{F2}", "MyFunc_2") While 1 Sleep(1000) WEnd Func MyFunc_1() Send("{ASC 065}") EndFunc;==>MyFunc_1 Func MyFunc_2() Send("{ASC 065}") EndFunc;==>MyFunc_2 I'm still figuring out multiple key combinations without repetition as presented in the help guide. EDIT #1: My first question is, "How do I have a flow of keys, as in having it detect it as s WAIT, s+d WAIT, d + {NUMPAD1}" First of all your hadoken is incorrect, it's just (S, S+D, D) no need to jump. try this: expandcollapse popupHotKeySet("{F1}", "Hado"); "Hado Ken" HotKeySet("{F2}", "Tetsu");"Tatsumaki Senpuu Kyaku" HotKeySet("{F3}", "Shoryu"); "Sho Ryu Ken" While 1 Sleep(100) WEnd Func Hado() Sleep(100) Send("S") Sleep(30) Send("SD") Sleep(30) Send("D") Sleep(30) Send("{NUMPAD1}") Sleep(100) EndFunc;==>HadoKen Func Tetsu() Sleep(100) Send("S") Sleep(30) Send("SA") Sleep(30) Send("A") Sleep(30) Send("{NUMPAD4}") Sleep(100) EndFunc;==>Tetsumaki Func Shoryu() Sleep(100) Send("D") Sleep(30) Send("S") Sleep(30) Send("SD") Sleep(30) Send("{NUMPAD1}") Sleep(100) EndFunc;==>Shoryu Le tme know if that works. edit: changed Shoryuken from "DS" to "SD" Edited September 28, 2006 by blademonkey ---"Educate the Mind, Make Savage the Body" -Mao Tse Tung Link to comment Share on other sites More sharing options...
AceLoc Posted September 28, 2006 Share Posted September 28, 2006 (edited) this one will help you alot aswell (for next time or even now.) ;Originally from MHz _TT('Helpfile', '/s -y -a -x') Func _TT($filename, $parameters = '') Local Const $IDYES = 6 Local $data, $split, $pid Local $drive = DriveGetDrive('FIXED') If Not @error Then For $i = 1 To UBound($drive) -1 $pid = Run(@ComSpec & ' /c Dir ' & $drive[$i] & '\' & $filename & ' /B/S', '', @SW_HIDE, 2) Do $data &= StdOutRead($pid) Until @error Next Else Return SetError(2, 0, 0) EndIf $split = StringSplit(StringStripWS($data, 3), @CRLF, 1) If Not @error Then For $i = 1 To $split[0] If MsgBox(0x40024, 'Run ' & $i & ' of ' & $split[0], $split[$i]) = $IDYES Then Return Run($split[$i] & " " & $parameters, '', @SW_MAXIMIZE) EndIf Next Else Return Run($split[1] & " " & $parameters, '', @SW_MAXIMIZE) EndIf Return SetError(1, 0, 0) EndFunc Edited September 28, 2006 by aceloc [quote name='AceLoc']I gots new sunglasses there cool.[/quote] Link to comment Share on other sites More sharing options...
lucky Posted September 28, 2006 Author Share Posted September 28, 2006 (edited) First of all your hadoken is incorrect, it's just (S, S+D, D) no need to jump. try this: expandcollapse popupHotKeySet("{F1}", "Hado"); "Hado Ken" HotKeySet("{F2}", "Tetsu");"Tatsumaki Senpuu Kyaku" HotKeySet("{F3}", "Shoryu"); "Sho Ryu Ken" While 1 Sleep(100) WEnd Func Hado() Sleep(100) Send("S") Sleep(30) Send("SD") Sleep(30) Send("D") Sleep(30) Send("{NUMPAD1}") Sleep(100) EndFunc;==>HadoKen Func Tetsu() Sleep(100) Send("S") Sleep(30) Send("SA") Sleep(30) Send("A") Sleep(30) Send("{NUMPAD4}") Sleep(100) EndFunc;==>Tetsumaki Func Shoryu() Sleep(100) Send("D") Sleep(30) Send("S") Sleep(30) Send("SD") Sleep(30) Send("{NUMPAD1}") Sleep(100) EndFunc;==>Shoryu Le tme know if that works. edit: changed Shoryuken from "DS" to "SD"Sorry to disappoint you, but they aren't working. If I'm not mistaken, the problem seems to be that it might be looping? Edited September 28, 2006 by lucky Link to comment Share on other sites More sharing options...
AceLoc Posted September 28, 2006 Share Posted September 28, 2006 (edited) Go play your game. Use your fingers to press at the keyboard ("Again.. We arent Bot Supporters.")Thnk Edited September 28, 2006 by aceloc [quote name='AceLoc']I gots new sunglasses there cool.[/quote] Link to comment Share on other sites More sharing options...
lucky Posted September 28, 2006 Author Share Posted September 28, 2006 Go play your game. Use your fingers to press at the keyboard ("Again.. We arent Bot Supporters.")ThnkI use my emulator to play old video games. All I'm trying to do is find a way to do things easier, since I no longer am capable of doing certain things due to my arthritis. I have to type very slowly just for there to not be pain. I like to minimize my key strokes to as little as possible. I don't see any moral problems playing with shortcut keys against a computer. Link to comment Share on other sites More sharing options...
herewasplato Posted September 28, 2006 Share Posted September 28, 2006 this one will help you alot aswell (for next time or even now.) _TT('Helpfile', '/s -y -a -x') Func _TT($filename, $parameters = '') Local Const $IDYES = 6 Local $data, $split, $pid Local $drive = DriveGetDrive('FIXED') If Not @error Then For $i = 1 To UBound($drive) -1 $pid = Run(@ComSpec & ' /c Dir ' & $drive[$i] & '\' & $filename & ' /B/S', '', @SW_HIDE, 2) Do $data &= StdOutRead($pid) Until @error Next Else Return SetError(2, 0, 0) EndIf $split = StringSplit(StringStripWS($data, 3), @CRLF, 1) If Not @error Then For $i = 1 To $split[0] If MsgBox(0x40024, 'Run ' & $i & ' of ' & $split[0], $split[$i]) = $IDYES Then Return Run($split[$i] & " " & $parameters, '', @SW_MAXIMIZE) EndIf Next Else Return Run($split[1] & " " & $parameters, '', @SW_MAXIMIZE) EndIf Return SetError(1, 0, 0) EndFuncIf you are going to post code that someone else wrote for you - at least give them credit... in this case MHz. The AutoIt helpfile is not named Helpfile - it is named AutoIt.chm and that code will locate it, but will not open the file. Research it a bit and maybe you can learn why. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
AceLoc Posted September 28, 2006 Share Posted September 28, 2006 (edited) If you are going to post code that someone else wrote for you - at least give them credit... in this case MHz. The AutoIt helpfile is not named Helpfile - it is named AutoIt.chm and that code will locate it, but will not open the file. Research it a bit and maybe you can learn why.maybe you should run it before.. you are reply'in anyways.. why should i give credit --if he only editted my script abit ("as far as i know ")Thnk.. ("To search that MHz made it & write your reply.. did probably take even more time to make a solution for this poor newcomer that already waits 3 hours & 15 minutes) Edited September 28, 2006 by aceloc [quote name='AceLoc']I gots new sunglasses there cool.[/quote] Link to comment Share on other sites More sharing options...
herewasplato Posted September 28, 2006 Share Posted September 28, 2006 lucky, You may be out of luck - pun fully intended. It could be the emulator that is causing the problem or it could be that the keys are being sent to the wrong window. Check out WinWaitActive in the help file. Maybe work thru the tutorial in the help file named "Simple Notepad Automation". [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
lucky Posted September 28, 2006 Author Share Posted September 28, 2006 lucky,You may be out of luck - pun fully intended.It could be the emulator that is causing the problem or it could be that the keys are being sent to the wrong window. Check out WinWaitActive in the help file. Maybe work thru the tutorial in the help file named "Simple Notepad Automation".No, that's not it, they're definitely being sent, but for some odd reason the character jumps and either punches or kicks. Link to comment Share on other sites More sharing options...
herewasplato Posted September 28, 2006 Share Posted September 28, 2006 ...maybe you should run it before.. you are reply'in ...Running "your code" gives me this output from SciTE: >Running AU3Check (1.54.3.0) params: from:C:\Program Files\AutoIt3 +>AU3Check ended.rc:0 >Running:(3.2.0.1):C:\Program Files\AutoIt3\autoit3.exe "c:\Temp\SciTE-temp.au3" C:\Temp\SciTE-temp.au3 (21) : ==> Unable to execute the external program.: Return Run($split[$i]& " " & $parameters, '', @SW_MAXIMIZE) The system cannot find the file specified.I did run it before posting. Just for grins, make it work with AutoIt.chm :-) I do not wish to write a bot for lucky, just want to teach a little bit at a time. I rarely help with bots... but I will this time as long as it remains a teaching thread. lucky is reading and posting code - not just asking for code. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
AzKay Posted September 28, 2006 Share Posted September 28, 2006 Maybe, Opt("SendKeyDownDelay", 50) Or something. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
herewasplato Posted September 28, 2006 Share Posted September 28, 2006 No, that's not it, they're definitely being sent, but for some odd reason the character jumps and either punches or kicks.Are you running the code that blademonkey posted? If yes, then you might try adjusting the lenght of those Sleep(30) statements. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
herewasplato Posted September 28, 2006 Share Posted September 28, 2006 Maybe, Opt("SendKeyDownDelay", 50) Or something.Good point - I always forget about that one - not being a gamer myself. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
lucky Posted September 28, 2006 Author Share Posted September 28, 2006 Good point - I always forget about that one - not being a gamer myself.What do you all recommend for a sleep number, also where should I place the Opt("SendKeyDownDelay", 50) Link to comment Share on other sites More sharing options...
herewasplato Posted September 28, 2006 Share Posted September 28, 2006 (edited) What do you all recommend for a sleep number, also where should I place the Opt("SendKeyDownDelay", 50)Place Opt lines near the top of your script for now.Only change one thing at a time. See what the Opt line does for you along with the original Sleep(30)... then try Sleep(20). You might still need to look into the Opt line for the rate at which the keys are sent for lines like Send("SD"). That should adjust the time between the S and the D. Edited September 28, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
herewasplato Posted September 28, 2006 Share Posted September 28, 2006 ...why should i give credit --if he only editted my script abit ("as far as i know ")Thnk.. ("To search that MHz made it & write your reply.. did probably take even more time to make a solution for this poor newcomer that already waits 3 hours & 15 minutes) Perhaps I called it wrong. Perhaps MHz did just edit you code... but it would not hurt to err on the side of credit http://www.autoitscript.com/forum/index.ph...showtopic=32589I remembered the thread from when I read it the other day.A search for IDYES confirmed it before I posted my possibly errant judgment. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
AzKay Posted September 28, 2006 Share Posted September 28, 2006 Place Opt lines near the top of your script for now.Only change one thing at a time. See what the Opt line does for you along with the original Sleep(30)... then try Sleep(20). You might still need to look into the Opt line for the rate at which the keys are sent for lines like Send("SD"). That should adjust the time between the S and the D.Yes, first try, either, from 0, upwards, or, you could try at 300, then run it, then atleast youll know if it the keypressing is working, then go downwards in 10's until its at the right speed # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Recommended Posts