| Main > Software Forum |
| AHK fun! |
| << < (4/4) |
| Howard_Casto:
--- Quote from: mumbles on April 04, 2006, 06:49:28 am ---thanks very much 4 yr help. i now have the escape problem solved. I have also done a script to make pause (which is f3 in Virtua Cop 2) to be "p" which is the key configured on my cab. Now the only problem is if I put endapp in it you can only press p once to pause it and then can't unpause it. if you don't put endapp in there the script is still running when I exit the game. Does this mean that "p" would still be remapped to f3?? if so hwo can I get the script to terminate when the game exits?? here is the script I have made P:: Send {F3 down} Send {F3 up} Thanks in advance --- End quote --- I mean no disrespect but perhaps you need to look at the ahk help file and go over the syntax again. Pressing p has nothing to do with the exitapp (unless p is a key used to exit the game or the esc key is used to pause or something crazy like that) , however because your syntax is wrong I'm guessing both functions get ran. After a line of instructions you must always put a return in there or else it'll keep reading and go on to the next line. So it needs to be: P:: Send {F3 down} Send {F3 up} return |
| ErikRuud:
AHK did sort of grow out of AutoIt. AHK is based on the source code for AutoIt2, but with added features. AutoIt is now on Version 3, which I think is much better than AutoIt2 or AHK, mainly because the syntax is much more "BASIC" like. I have put together an AutoIt3 executable that is a generic launcher for the Digital Leisure/American Laser Games. You can download it from my site. Here is what the script looks like: --- Code: ---$numParms=$CmdLine[0] HotKeySet("{ESC}","_GetOut") if $numParms > 0 Then $game = $CmdLine[1] Else msgBox(4096,"Error","You must provide a game parameter") exit(1) EndIf $var = IniReadSection("ALGLaunch.ini",$game) If @error Then MsgBox(4096, "", "Error occured, Invalid parameter or the ini file is missing.") exit(1) Else $executable = IniRead("ALGLaunch.ini",$game,"executable","") $directory = IniRead("ALGLaunch.ini",$game,"directory","") $window = IniRead("ALGLaunch.ini",$game,"window","") $reload = IniRead("ALGLaunch.ini",$game,"reload","no") $msg = ">>" & $directory & $executable & "--" & $reload & "<<" ;msgBox(4096,"Testing",$msg,15) run($executable,$directory) winwait($window) WinActivate($window) send("f") send("r") While 1 if $reload <> "no" then If _isPressed("02") then _MouseOnclick() EndIf Endif if not WinExists($window) Then _GetOut() endif Wend EndIf Func _GetOut() if winexists($window) Then winkill($window) endif Exit(0) EndFunc Func _MouseOnclick() SoundPlay($reload) EndFunc ;=============================================================================== ; ; Description: _IsPressed ; Parameter(s): $s_hexKey - key to check for ; $v_dll = Handle to dll or default to user32.dll ; ; User CallTip: _IsPressed($s_hexKey[, $v_dll = 'user32.dll']) Check if key has been pressed. (required: <Misc.au3>) ; Return Value(s): 1 if true ; 0 if false ; Author(s): ezzetabi and Jon ; ;=============================================================================== Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') ; $hexKey must be the value of one of the keys. ; _Is_Key_Pressed will return 0 if the key is not pressed, 1 if it is. Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc ;==>_Is_Key_Pressed --- End code --- |
| Howard_Casto:
Better than autoit 2 yes. Better than ahk no. Autoit's biggest problem has always been the handling of inputs. I've found ahk to remap/send keys/ect on 99% of the apps I've tried, including ones that use directinput in exclusive mode. Autoit, on the other hand, even autoit 3 only works about 60% of the time. And since mostly what we need to do is move the mouse or press/remap keys it seems kinda pointless to use autoit scripts unless you just happen to need one of the features that autoit 3 only has. With that being said, in the case of the dl games autoit will work great as input is gdi based. Very nice script btw. |
| ErikRuud:
--- Quote from: Howard_Casto on April 05, 2006, 04:20:01 pm ---Better than autoit 2 yes. Better than ahk no. Autoit's biggest problem has always been the handling of inputs. I've found ahk to remap/send keys/ect on 99% of the apps I've tried, including ones that use directinput in exclusive mode. Autoit, on the other hand, even autoit 3 only works about 60% of the time. And since mostly what we need to do is move the mouse or press/remap keys it seems kinda pointless to use autoit scripts unless you just happen to need one of the features that autoit 3 only has. With that being said, in the case of the dl games autoit will work great as input is gdi based. --- End quote --- Interesting, so far AutoIt has worked with everything I have tried. As I said, I like it for the syntax. So far the only thing I have wanted to do, but couldn't in AI3, was to use a mouse button as a hot key. That's why you see the "While 1" loop and the "_IsPressed" fuction in this script. --- Quote ---Very nice script btw. --- End quote --- Than You! |
| Navigation |
| Message Index |
| Previous page |