dgarrett8 Posted January 23, 2009 Share Posted January 23, 2009 I was looking around the helpmefile for mouse clicks and this function popped up. How would I use this in a script properly, such as searching an area of 10sq pixels of my mousepos. Is this much better than the normal mouseclick? "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 23, 2009 Share Posted January 23, 2009 I was looking around the helpmefile for mouse clicks and this function popped up. How would I use this in a script properly, such as searching an area of 10sq pixels of my mousepos. Is this much better than the normal mouseclick?Regular MouseGetPos() would be better. No need to use the more complex API unless you need additional functionality. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 24, 2009 Author Share Posted January 24, 2009 Well, why is it that my code isn't effective in game. $pos = MouseGetPos() $coord = PixelSearch(($pos[0] - 10) , ($pos[1] - 10) , ($pos[0] + 10) , ($pos[1] + 10), 0x00FF00) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1], 1, 0) "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
Authenticity Posted January 24, 2009 Share Posted January 24, 2009 in-game is quite messy thing for colors but anyway try to use shade variation, the sixth parameter because otherwise it'll try to find exact match which might be the problem. Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 24, 2009 Author Share Posted January 24, 2009 well, the thing is...my models are solid colors. team blue is green and team red is red. that is why I'm confused "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
FireFox Posted January 24, 2009 Share Posted January 24, 2009 well, the thing is...my models are solid colors. team blue is green and team red is red. that is why I'm confusedCheck if its real red color and not shade of it with PixelGetColor Cheers, FireFox. Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 24, 2009 Author Share Posted January 24, 2009 yup, i just did that firefox. they are the same thing as i have in my complete code. shall i post my code to see if anything is screwed? "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
FireFox Posted January 24, 2009 Share Posted January 24, 2009 @djarrett8 yep Cheers, FireFox. Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 24, 2009 Author Share Posted January 24, 2009 @Firefox, hahaha I've been working with some people for 5 months now and they call me jarrett still instead of garrett. expandcollapse popup#include <GUIConstants.au3> Global $Aimbot = 0, $found = "no" WinActivate("Quake 3: Arena") While 1 HotKeySet("{HOME}", "ToggleAimbot") HotKeySet("{END}", "TurnoffAimbot") $status = GUICtrlCreateLabel("Aimbot Status: Off", 16, 624, 500, 33) GUISetState() If $Aimbot = 1 Then; Green $pos = MouseGetPos() $coord = PixelSearch(($pos[0] - 10) , ($pos[1] - 10) , ($pos[0] + 10) , ($pos[1] + 10), 0x00FF00) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1], 1, 0) EndIf EndIf If $Aimbot = 2 Then; Red $pos = MouseGetPos() $coord = PixelSearch(($pos[0] - 10) , ($pos[1] - 10) , ($pos[0] + 10) , ($pos[1] + 10), 0xFF0000) If IsArray($coord) = 1 Then MouseClick('left', $coord[0], $coord[1], 1, 0) EndIf EndIf WEnd Func ToggleAimbot() If $Aimbot < 2 Then $Aimbot = $Aimbot + 1 Else $Aimbot = 0 EndIf Select Case $Aimbot = 0 GUICtrlSetData($status, "Aimbot Status: Off") Case $Aimbot = 1 GUICtrlSetData($status, "Aimbot Status: Green") Case $Aimbot = 2 GUICtrlSetData($status, "Aimbot Status: Red") EndSelect EndFunc ;==>ToggleAimbot Func TurnoffAimbot() $Aimbot = 0 GUICtrlSetData($status, "Aimbot Status: Off") EndFunc ;==>TurnoffAimbot Took a lot of it from Simucal's example. "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
Authenticity Posted January 24, 2009 Share Posted January 24, 2009 Some notes which might not deal with the problem, I'm assuming this script is as it is: - Try to use If @error Then instead of IsArray, IMO it's better. - Do you aware that you keep calling HotKeySet function over and over? - Try to use ToolTip for this purpose it'll make sense as I see no GuiCreate call in the code. - ... Link to comment Share on other sites More sharing options...
FireFox Posted January 24, 2009 Share Posted January 24, 2009 @dgarrett8 Ops...didnt saw that, its because j;g keys are near on my ipod keyboard Cheers, FireFox. Link to comment Share on other sites More sharing options...
FireFox Posted January 24, 2009 Share Posted January 24, 2009 (edited) @dgarrett8 _IsArray is wrong there, use return value Edit : place hotkeyset at top of your script and not in while Note : for delete your hotkey just do : HotKeySet("{END}", "_Func");create HotKeySet("{END}");delete Cheers, FireFox. Edited January 24, 2009 by FireFox Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 25, 2009 Author Share Posted January 25, 2009 Thank you Firefox and Authenticity. I tested this outside of Quake and it works perfectly, but in quake it has no effect. Why is that? expandcollapse popup#include <GUIConstants.au3> Global $Aimbot = 0, $found = "no" WinActivate("Quake 3: Arena") HotKeySet("{HOME}", "ToggleAimbot") HotKeySet("{END}", "TurnoffAimbot") While 1 GUISetState() If $Aimbot = 1 Then; Green $pos = MouseGetPos() $coord = PixelSearch(($pos[0] - 20) , ($pos[1] - 20) , ($pos[0] + 20) , ($pos[1] + 20), 0x00FF00) If Not @error then MouseClick('left', $coord[0], $coord[1], 1, 0) EndIf EndIf If $Aimbot = 2 Then; Red $pos = MouseGetPos() $coord = PixelSearch(($pos[0] - 10) , ($pos[1] - 10) , ($pos[0] + 10) , ($pos[1] + 10), 0xFF0000) If Not @error then MouseClick('left', $coord[0], $coord[1], 1, 0) EndIf EndIf WEnd Func ToggleAimbot() If $Aimbot < 2 Then $Aimbot = $Aimbot + 1 Else $Aimbot = 0 EndIf Select Case $Aimbot = 0 ToolTip("Aimbot Status: Off",0,0) Case $Aimbot = 1 ToolTip ("Aimbot Status: Green",0,0) Case $Aimbot = 2 ToolTip("Aimbot Status: Red",0,0) EndSelect EndFunc ;==>ToggleAimbot Func TurnoffAimbot() $Aimbot = 0 ToolTip ("Aimbot Status: Off",0,0) EndFunc ;==>TurnoffAimbot "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
Authenticity Posted January 25, 2009 Share Posted January 25, 2009 I"ve cleaned your script a little bit, though I couldn't find why your script can't do the job. Read about the Opt function's option like - MouseCoordMode, MouseClickDelay or MouseClickDownDelay and play around with their values, maybe it'll make the change. expandcollapse popupOpt('MustDeclareVars', 1) Global $Aimbot = 0, $found = "no" HotKeySet("{HOME}", "ToggleAimbot") HotKeySet("{END}", "TurnoffAimbot") WinActivate("Quake 3: Arena") While 1 Local $coord, $pos ; GuiSetState() <=== Completely useless. Select Case $Aimbot = 1 ; Green $pos = MouseGetPos() $coord = PixelSearch(($pos[0] - 20) , ($pos[1] - 20) , ($pos[0] + 20) , ($pos[1] + 20), 0x00FF00) If Not @error Then MouseClick('left', $coord[0], $coord[1], 1, 0) Case $Aimbot = 2 ; Red $pos = MouseGetPos() $coord = PixelSearch(($pos[0] - 10) , ($pos[1] - 10) , ($pos[0] + 10) , ($pos[1] + 10), 0xFF0000) If Not @error Then MouseClick('left', $coord[0], $coord[1], 1, 0) EndSelect Sleep(20) WEnd Func ToggleAimbot() Select Case $Aimbot = 2 ToolTip("Aimbot Status: Red",0,0) $Aimbot = 0 Case $Aimbot = 1 ToolTip ("Aimbot Status: Green",0,0) $Aimbot += 1 Case $Aimbot = 0 ToolTip("Aimbot Status: Off",0,0) $Aimbot += 1 EndSelect EndFunc ;==>ToggleAimbot Func TurnoffAimbot() $Aimbot = 0 ToolTip ("Aimbot Status: Off",0,0) EndFunc ;==>TurnoffAimbot Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 25, 2009 Author Share Posted January 25, 2009 @Authenticity Ty for cleaning it up, but some questions. ~ What does $Aimbot += 1 do that my script didn't do before? ~ What does Local do that my script didn't do before? Do those things fit under the category of cleaning the script, or do they do something different? I've tried using the Opt functions, none of them fix the problem. "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
Authenticity Posted January 25, 2009 Share Posted January 25, 2009 The Local word is necessary because we're now using the MustDeclareVars option so that it'll save you time to go figure why declaring variable $X = 5 and then doing something like that doesn't give you the desire effect ;] $Y = $x * 10 (understand?) - $Aimbot += 1 is equivalent to $Aimbot = $Aimbot + 1 and it's more readable this way. - I think you'll need to use some ConsoleWrite in some spots in your code to see what are the values and why it's not the other wanted way. Keep test it. Link to comment Share on other sites More sharing options...
wolf9228 Posted January 25, 2009 Share Posted January 25, 2009 (edited) I was looking around the helpmefile for mouse clicks and this function popped up. How would I use this in a script properly, such as searching an area of 10sq pixels of my mousepos. Is this much better than the normal mouseclick? #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $winhandle = GUICreate("Win", 493, 220, 227, 202) $Group1 = GUICtrlCreateGroup("Group1", 16, 8, 153, 185) $Label1 = GUICtrlCreateLabel("", 180, 16, 200, 22) $Label2 = GUICtrlCreateLabel("", 180, 48, 200, 22) GUISetState(@SW_SHOW) Do $CursorInfo = GUIGetCursorInfo($winhandle) if IsArray($CursorInfo) Then GUICtrlSetData($Label1,"Mouse X coord \ Mouse left ===> " & $CursorInfo[0]) GUICtrlSetData($Label2,"Mouse Y coord \ Mouse top ====> " & $CursorInfo[1]) EndIf $bool = Searching_Mouse(16 ,8,153,185,$winhandle) ; ===> Searching pos Group1 ("Group1", 16, 8, 153, 185) if $bool = True Then MsgBox(0,"Mouse in Group1","OK") Until GUIGetMsg() = $GUI_EVENT_CLOSE Func Searching_Mouse($left ,$top,$width,$height,$win_handle) $CursorInfo = GUIGetCursorInfo($win_handle) if IsArray($CursorInfo) Then if $CursorInfo[0] >= $left And $CursorInfo[0] <= ($left + $width ) And $CursorInfo[1] >= $top And $CursorInfo[1] <= ($top + $height) Then Return True Else Return False EndIf EndIf EndFunc Edited January 25, 2009 by wolf9228 صرح السماء كان هنا Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 25, 2009 Author Share Posted January 25, 2009 @wolf - that's pretty gnarly. but i've moved on with the pixel area. i just need my prog to work inside of the actual game. "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 25, 2009 Author Share Posted January 25, 2009 nope. still can't get it to work on quake. i've attempted to fool around with opt and cant get it. "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 27, 2009 Author Share Posted January 27, 2009 Do I put a .dll thing the script for this to work inside of quake? "I think, therefore I am"[size="1"]René Descartes[/size] 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