Tim2k Posted August 19, 2007 Share Posted August 19, 2007 Heidyho!First of all, i'm sorry for my bad english.I want to use the rightmouseclick as a hotkey to start a function.Look at this:HotKeySet("RIGHTMOUSECLICK", "Fire") Func Fire() WinWaitActive("Freelancer") Bla Bla, verylong. ;) EndFuncoÝ÷ Øz0v®±ëaz¸ Ù¨ºÇ°Ømáè¶G²Ië_ºw-Èj[(µë-yÖ®¶sd÷D¶W6WBô5&W76VBgV÷C³"gV÷C²ÂgV÷C´f&RgV÷C² (i included <misc.au3>, that's not the problem) but it doesn't work.I searched to forums for about 30mins and couldn't get a solution, to only thing i found is this, T3k got the same problem: http://www.autoitscript.com/forum/index.php?showtopic=48394 Link to comment Share on other sites More sharing options...
bluebearr Posted August 19, 2007 Share Posted August 19, 2007 You have to fake it with AdLib. This is based on the example in the help file for AdLibEnable: #Include <Misc.au3> $dll = DllOpen("user32.dll") AdlibEnable("_Check_RMouse", 50) While 1 ; Do some stuff Sleep(10) WEnd Func _Check_RMouse() If _IsPressed("02", $dll) Then MsgBox(0,"_IsPressed", "Right Mouse Button Pressed") DllClose($dll) Exit EndIf EndFunc I changed the AdlibEnable time to 50 milliseconds, because at the default of 250 milliseconds the right mouse button seemed to slip through without being detected. You may need to tweak it further for performance. BlueBearrOddly enough, this is what I do for fun. Link to comment Share on other sites More sharing options...
Generator Posted August 19, 2007 Share Posted August 19, 2007 You have to fake it with AdLib. This is based on the example in the help file for AdLibEnable: #Include <Misc.au3> $dll = DllOpen("user32.dll") AdlibEnable("_Check_RMouse", 50) While 1 ; Do some stuff Sleep(10) WEnd Func _Check_RMouse() If _IsPressed("02", $dll) Then MsgBox(0,"_IsPressed", "Right Mouse Button Pressed") DllClose($dll) Exit EndIf EndFunc I changed the AdlibEnable time to 50 milliseconds, because at the default of 250 milliseconds the right mouse button seemed to slip through without being detected. You may need to tweak it further for performance.Actually in most cases no dllopen is required, at least i didn't use it in my script. Link to comment Share on other sites More sharing options...
Tim2k Posted August 20, 2007 Author Share Posted August 20, 2007 You have to fake it with AdLib. This is based on the example in the help file for AdLibEnable: I changed the AdlibEnable time to 50 milliseconds, because at the default of 250 milliseconds the right mouse button seemed to slip through without being detected. You may need to tweak it further for performance. Thank u, it works! Here's my Script: expandcollapse popup#Include <Misc.au3> AutoItSetOption("SendKeyDelay", 1) $dll = DllOpen("user32.dll") AdlibEnable("ImbaFire", 50) While 1 Sleep(100) WEnd Func ImbaFire() WinWaitActive("Game") While 1 If _IsPressed("02", $dll) Then ;;; 1/6 ;;; Send("{1}") sleep(41.666666666666666666666666666667) ;;; 2/6 ;;; Send("{2}") sleep(41.666666666666666666666666666667) ;;; 3/6 ;;; Send("{3}") sleep(41.666666666666666666666666666667) ;;; 4/6 ;;; Send("{4}") sleep(41.666666666666666666666666666667) ;;; 5/6 ;;; Send("{5}") sleep(41.666666666666666666666666666667) ;;; 6/6 ;;; Send("{6}") sleep(41.666666666666666666666666666667) Do Send("{up down}") Until NOT _IsPressed(02) Send("{up up}") WinWaitActive("Game") EndIf WEnd EndFunc There is an performanceproblem, the script uses 50-70% cpuload, what shall i do? Link to comment Share on other sites More sharing options...
Generator Posted August 20, 2007 Share Posted August 20, 2007 Maybe... expandcollapse popup#Include <Misc.au3> AutoItSetOption("SendKeyDelay", 1) $dll = DllOpen("user32.dll") AdlibEnable("ImbaFire", 50) While 1 Sleep(1) WEnd Func ImbaFire() WinWaitActive("Game") If _IsPressed("02", $dll) Then ;;; 1/6 ;;; Send("{1}") Sleep(41.666666666666666666666666666667) ;;; 2/6 ;;; Send("{2}") Sleep(41.666666666666666666666666666667) ;;; 3/6 ;;; Send("{3}") Sleep(41.666666666666666666666666666667) ;;; 4/6 ;;; Send("{4}") Sleep(41.666666666666666666666666666667) ;;; 5/6 ;;; Send("{5}") Sleep(41.666666666666666666666666666667) ;;; 6/6 ;;; Send("{6}") Sleep(41.666666666666666666666666666667) Do Send("{up down}") Until Not _IsPressed(02) Send("{up up}") WinWaitActive("Game") EndIf EndFunc ;==>ImbaFire Link to comment Share on other sites More sharing options...
Tim2k Posted August 20, 2007 Author Share Posted August 20, 2007 (edited) Maybe... #Include <Misc.au3> AutoItSetOption("SendKeyDelay", 1) $dll = DllOpen("user32.dll") AdlibEnable("ImbaFire", 50) While 1 Sleep(1) WEnd Func ImbaFire() WinWaitActive("Game") If _IsPressed("02", $dll) Then ;;; 1/6 ;;; Send("{1}") Sleep(41.666666666666666666666666666667) ;;; 2/6 ;;; Send("{2}") Sleep(41.666666666666666666666666666667) ;;; 3/6 ;;; Send("{3}") Sleep(41.666666666666666666666666666667) ;;; 4/6 ;;; Send("{4}") Sleep(41.666666666666666666666666666667) ;;; 5/6 ;;; Send("{5}") Sleep(41.666666666666666666666666666667) ;;; 6/6 ;;; Send("{6}") Sleep(41.666666666666666666666666666667) Do Send("{up down}") Until Not _IsPressed(02) Send("{up up}") WinWaitActive("Game") EndIf EndFunc ;==>ImbaFireƒoÝŠ÷ Ûú®¢×¢ØbžZ¦—§³^ž+-j»m…«lr¸©¶'èºwm…ë(–ëb¢vò›+•ö®¶ˆsdgVæ2–Ö&f—&R‚ •v–åv—D7F—fR‚gV÷C´g&VVÆæ6W"gV÷C² •v†–ÆR —6ÆVWƒ ”–bô—5&W76VB‚gV÷C³"gV÷C²Âb33c¶FÆÂ’F†Và¢ââà A simple sleep(1). Edited August 20, 2007 by Tim2k Link to comment Share on other sites More sharing options...
Generator Posted August 20, 2007 Share Posted August 20, 2007 While 1 will get your script stuck, thats all. If you want to loop between, use a boolean to keep track. 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