Lambort Posted November 22, 2006 Share Posted November 22, 2006 (edited) My question is- how can I make this script work to where: if you press "6" then click with mouse1 it will press Mouse1 once. if you press "7" then click with mouse1 it will press Mouse1 twice. if you press "8" then click with mouse1 it will press Mouse1 tree times. expandcollapse popup#include<GUIConstants.au3> #include<Constants.au3> #include<String.au3> #Include <Misc.au3> $GUI = GuiCreate("Burst Fire - By Mayonnaise", 150, 250,(@DesktopWidth-500)/2, (@DesktopHeight-400)/2 , $WS_OVERLAPPED+$WS_CAPTION+$WS_SYSMENU+$WS_MINIMIZEBOX+$WS_VISIBLE+$WS_CLIPSIBLINGS) Global $Paused HotKeySet("{6}", "Single") HotKeySet("{7}", "Double") HotKeySet("{8}", "Burst") HotKeySet("{ESC}", "Terminate") $dll = DllOpen("user32.dll") Func Single() While 1 Sleep ( 250 ) If _IsPressed("01", $dll) Then MouseClick("Left", "", "", 1) ExitLoop EndIf WEnd DllClose($dll) EndFunc $dll = DllOpen("user32.dll") Func Double() While 1 Sleep ( 250 ) If _IsPressed("01", $dll) Then MouseClick("Left", "", "", 1) sleep(100) MouseClick("Left", "", "", 1) ExitLoop EndIf WEnd DllClose($dll) EndFunc $dll = DllOpen("user32.dll") Func Burst() While 1 Sleep ( 250 ) If _IsPressed("01", $dll) Then MouseClick("Left", "", "", 1) sleep(100) MouseClick("Left", "", "", 1) sleep(100) MouseClick("Left", "", "", 1) ExitLoop EndIf WEnd DllClose($dll) EndFunc While 1 Sleep(100) WEnd Func Terminate() Exit 0 EndFunc Edited November 22, 2006 by Lambort Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 22, 2006 Share Posted November 22, 2006 well its calling the functions but _Ispressed waits for something to be pressed and the 01 in the ispressed is a left mouse click remove that and u should be ok Link to comment Share on other sites More sharing options...
Lambort Posted November 22, 2006 Author Share Posted November 22, 2006 well its calling the functions but _Ispressed waits for something to be pressed and the 01 in the ispressed is a left mouse click remove that and u should be okI wanted it to wait for the left mouse click then when it is clicked it is clicked:1 for single()2 for double()3 for burst()I removed the if _ispressed like you suggested and it still doesn't work. ??? Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted November 22, 2006 Share Posted November 22, 2006 (edited) expandcollapse popupGlobal $Paused HotKeySet("6", "Single") HotKeySet("7", "Double") HotKeySet("8", "Burst") HotKeySet("{ESC}", "Terminate") HotKeySet("{PAUSE}", "TogglePause") While 1 Sleep(100) WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) WEnd EndFunc Func Single() MouseClick("Left") EndFunc Func Double() MouseClick("Left") sleep(300) MouseClick("Left") EndFunc Func Burst() While 1 MouseClick("Left") sleep(300) WEnd EndFunc Func Terminate() Exit 0 EndFunc Edited November 22, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 22, 2006 Moderators Share Posted November 22, 2006 I wanted it to wait for the left mouse click then when it is clicked it is clicked: 1 for single() 2 for double() 3 for burst() I removed the if _ispressed like you suggested and it still doesn't work. ???Your going to have to play with TimeDelays ... Sleep() ... and Loops to catch that it's just not the mouse being held down. If _Ispressed() Then Local $iTimer = TimerInit() While _IsPressed() Sleep(10) WEnd Sleep(100) If TimerDiff($iTimer) = whatever And _Ispressed() Then While _Ispressed() Etc Etc And So On...What your asking for is by no means "easy"... It's time consuming to know what you consider to be the time for 1 click / up and down etc... and the way it's implemented now, you'll need to scrap it and start over. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Lambort Posted November 22, 2006 Author Share Posted November 22, 2006 Your going to have to play with TimeDelays ... Sleep() ... and Loops to catch that it's just not the mouse being held down. If _Ispressed() Then Local $iTimer = TimerInit() While _IsPressed() Sleep(10) WEnd Sleep(100) If TimerDiff($iTimer) = whatever And _Ispressed() Then While _Ispressed() Etc Etc And So On...What your asking for is by no means "easy"... It's time consuming to know what you consider to be the time for 1 click / up and down etc... and the way it's implemented now, you'll need to scrap it and start over. Well I didn't really have much to begin with lol. I'll start from scratch as you suggested and try to figure this baby out. Link to comment Share on other sites More sharing options...
CodeMaster Rapture Posted November 22, 2006 Share Posted November 22, 2006 The problem is that you are using Mouse1 recursively (somewhat). When the MouseClick("left") is called, it triggers _IsPressed("01",$dll), thus causing problems. MouseClick sends the MouseDown and MouseUP events to the Keyboard Msg poll (simulating a real mouse click). Since _IsPressed works off of the same API, you are having this conflict. What you could do is something like: HotKeySet("{6}","_SetSingleClick") HotKeySet("{7}","_SetDoubleClick") HotKeySet("{8}","_SetTripleClick") Global $State = 1 While 1 If (_IsPressed($hexRightMouseButton, $dll)) Then Switch ($State) Case 1 MouseClick("left") Case 2 MouseClick("left") MouseClick("left") Case 3 MouseClick("left") MouseClick("left") MouseClick("left") EndSwitch EndIf Sleep(250) WEnd Func _SetSingleClick() $State = 1 EndFunc Func _SetDoubleClick() $State = 2 EndFunc Func _SetTripleClick() $State = 3 EndFunc This way you use the Right Mouse button as your trigger -CMR Link to comment Share on other sites More sharing options...
Outshynd Posted November 22, 2006 Share Posted November 22, 2006 expandcollapse popup#include <Misc.au3> Opt("MouseClickDelay", 100) Opt("OnExitFunc", "Terminate") Global $clickTimes = 1 Global $dll = DllOpen("user32.dll") HotKeySet("{6}", "Single") HotKeySet("{7}", "Double") HotKeySet("{8}", "Burst") HotKeySet("{ESC}", "Terminate") While 1 If _IsPressed('01', $dll) Then While _IsPressed('01', $dll) Sleep(5) WEnd MouseClick("left", MouseGetPos(0), MouseGetPos(1), $clickTimes, 0) EndIf Sleep(25) WEnd Func Single() $clickTimes = 1 EndFunc Func Double() $clickTimes = 2 EndFunc Func Burst() $clickTimes = 3 EndFunc Func Terminate() DllClose($dll) Exit EndFunc Not tested, or anything, and I'm tired, so there's bound to be errors somewhere. I'm sure you can pick through them though. Link to comment Share on other sites More sharing options...
Lambort Posted November 22, 2006 Author Share Posted November 22, 2006 expandcollapse popup#include <Misc.au3> Opt("MouseClickDelay", 100) Opt("OnExitFunc", "Terminate") Global $clickTimes = 1 Global $dll = DllOpen("user32.dll") HotKeySet("{6}", "Single") HotKeySet("{7}", "Double") HotKeySet("{8}", "Burst") HotKeySet("{ESC}", "Terminate") While 1 If _IsPressed('01', $dll) Then While _IsPressed('01', $dll) Sleep(5) WEnd MouseClick("left", MouseGetPos(0), MouseGetPos(1), $clickTimes, 0) EndIf Sleep(25) WEnd Func Single() $clickTimes = 1 EndFunc Func Double() $clickTimes = 2 EndFunc Func Burst() $clickTimes = 3 EndFunc Func Terminate() DllClose($dll) Exit EndFunc Not tested, or anything, and I'm tired, so there's bound to be errors somewhere. I'm sure you can pick through them though. Really nice, seems like it would work perfect. However no matter what hotkey I set it to it seems to do 2 clicks. hmmm, maybe I need to add some sleep()'s in somewhere i'm not sure. I'll mess with it, seems really close thanks! Link to comment Share on other sites More sharing options...
FreeFry Posted November 29, 2006 Share Posted November 29, 2006 (edited) One method I've used for bursting that works really good, is if you unbind (in the game) the mouse button for attacking, then bind some other key to attack, then have the script monitor the normal button(mouse1), then do something like this: If TimerDiff($TimerHandle) > $ShootDelay Then MouseClick("middle") $TimerHandle = TimerInit() EndIf Do that in a loop, while checking mouse1 with _IsPressed(), then make the script check the timer, and if it's time to shoot(ie. delay between shots) make it click/send the other attack key you bound(in my case i used mouse3) Edit: Actually, I used this in my aimbot script I've made, but I'll recode it to do only what you want, and post it here. Here's the code: #include <Misc.au3> Opt("MouseClickDelay", 0) Opt("MouseClickDownDelay", 0) Global $dll = DllOpen("user32.dll") Global $TimerHandle = 0 Global $ShootTimer = 0 Global $ShootDelay = 300 While 1 If _IsPressed("01", $dll) Then If TimerDiff($TimerHandle) > $ShootDelay Then MouseClick("middle") $TimerHandle = TimerInit() EndIf EndIf Sleep(1) WEnd Edited November 29, 2006 by FreeFry 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