Sign in to follow this  
Followers 0
dgarrett8

_WinAPI_Mouse_Event help?

21 posts in this topic

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]

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

well, the thing is...my models are solid colors. team blue is green and team red is red. that is why I'm confused

Check if its real red color and not shade of it with PixelGetColor :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

@djarrett8

yep

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

@Firefox, hahaha I've been working with some people for 5 months now and they call me jarrett still instead of garrett.

#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]

Share this post


Link to post
Share on other sites

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.

- ...

Share this post


Link to post
Share on other sites

@dgarrett8

Ops...didnt saw that, its because j;g keys are near on my ipod keyboard :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

@dgarrett8

_IsArray is wrong there, use return value :)

Edit : place hotkeyset at top of your script and not in while :lmao:

Note : for delete your hotkey just do :

HotKeySet("{END}", "_Func");create
HotKeySet("{END}");delete

Cheers, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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?

#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]

Share this post


Link to post
Share on other sites

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.

Opt('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

Share this post


Link to post
Share on other sites

@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]

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#17 ·  Posted (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 by wolf9228

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

@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]

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0