randomGuy Posted May 19, 2012 Posted May 19, 2012 Hey everyone! I'm new to these forums and new to scripting. I've been lurking around the site to try and comprehend how to do a simple script. But I've hit somewhat of a roadblock, so I need some help. Here is what I need my script to do: If I press the NUMPAD9 button, I want the script to press down and hold NUMPAD4, NUMPAD5 and NUMPAD6 at the same time, and release those three buttons once I release the NUMPAD9 button. Here's the script that I came up with: #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") While 1 Sleep(10) If _IsPressed("69", $hDLL) Then Send("{NUMPAD4 down}") Send("{NUMPAD5 down}") Send("{NUMPAD6 down}") Else Send("{NUMPAD4 up}") Send("{NUMPAD5 up}") Send("{NUMPAD6 up}") EndIf WEnd DllClose($hDLL) Now here's the problem... The script seems to be doing what it's supposed to. But every now and then, the buttons NUMPAD4, 5 and 6 seem to stop working. After pressing them a few times they work again. I can't figure out why this is happening, and it's not a keyboard (that is, mechanical) problem. Also... If there is a way for this script to be written to have minimal delay, that would be great. Thanks for taking your time to help me.
Kidney Posted May 20, 2012 Posted May 20, 2012 put a sleep inbetween the send's. i would put a Sleep(100) but you could try less.
randomGuy Posted May 20, 2012 Author Posted May 20, 2012 That doesn't help me. The script needs to be instant.
water Posted May 20, 2012 Posted May 20, 2012 Is this just to excercise or do you need to solve a real problem? Looks a bit weird to press these 4 keys at the same time. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
randomGuy Posted May 20, 2012 Author Posted May 20, 2012 It's for a video game. The video game has a move that can only be performed by pushing three buttons at once. An earlier version of the game had a built-in macro function, but for some reason, the newer version, doesn't. That's why I need this.
Belini Posted May 21, 2012 Posted May 21, 2012 (edited) It's for a video game.@randomGuy see this link: http://www.autoitscript.com/forum/forum-2/announcement-13-forum-rules/ Edited May 21, 2012 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
randomGuy Posted May 22, 2012 Author Posted May 22, 2012 Yes, I know that. But this game has no rules against using scripting. In fact, like I said, one version of the game has the macro built-in, but the other one doesn't, because it's a compact, stripped-down version, so it has no additional options whatsoever (not even for changing the default controls). So I'm not breaking any rules.
water Posted May 22, 2012 Posted May 22, 2012 The rule that doesn't allow to discuss game automation is the forum rule (not the rules of the game). That's the rule Mods are quite strict here. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Leomund Posted May 22, 2012 Posted May 22, 2012 (edited) This is a Macro, not an Automation from what I've deduced. (Now I'm curious what he's doing to the .dll) Edited May 22, 2012 by Leomund
water Posted May 22, 2012 Posted May 22, 2012 It's Automation. Call it Macro or whatever. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Leomund Posted May 22, 2012 Posted May 22, 2012 I think you're wrong about that; I don't think hotkeys are automation. Anyway, RandomGuy, what are you doing? So I can make hotkeys with AutoIt and stuff..?
water Posted May 22, 2012 Posted May 22, 2012 (Nearly) everything game related that automates keystrokes by an AutoIt script (using HotKeys or whatever) is "game automation". There are very few game related automation topics which didn't get locked by the Mods. Search the forum for locked topics and you'll see what I'm talking about. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Valik Posted May 22, 2012 Posted May 22, 2012 Just because you are stupid and don't understand lingo and terminology does not mean you get to bypass the rules. Thread locked. Do not argue with me or post on this subject again or you will go away.
Recommended Posts