Sign in to follow this  
Followers 0
Toady

PixelTrigger

16 posts in this topic

#1 ·  Posted (edited)

Posted Image

;A simple way to fire your weapon when a color is in center radius of screen
; This doesnt take into account lag compensation on moving targets thought
;Shot, simple and easy to use..
;Author: Toady

#include <GUIConstants.au3>
#include <Misc.au3>
#include <GuiSlider.au3>

$g_szVersion = "PixelTrigger"   
If _Singleton($g_szVersion, 1) = 0 Then
    MsgBox(64, "PixelTrigger", "PixelTrigger is already running.", 2)
    Exit
EndIf

Global $isChecked = 0
Global $isPaused = 1
Global $pixelradius = 16 
Global $refreshrate = Floor(1000/@DesktopRefresh)
Global $pos_color_ctrls = 110
Global $Color_Hex = 0xFF0000 

HotKeySet("{F11}","_PauseBot")
;NOTE: This works only if game is in full screen mode!
Global $left = @Desktopwidth / 2 - $pixelradius ;This is a box in middle of screen to scan
Global $top = @Desktopheight / 2 - $pixelradius 
Global $right = @Desktopwidth / 2 + $pixelradius
Global $bottom = @Desktopheight / 2 + $pixelradius

$GUI = GUICreate("PixelTrigger", 360, 300, (@Desktopwidth - 360)/2, (@Desktopheight - 300)/2)
GUICtrlCreateGroup ("When on target", 10, 10, 160, 100)
$Radio_LeftM = GUICtrlCreateRadio("Left Mouse Button",20,30,120)
$Radio_RightM = GUICtrlCreateRadio("Right Mouse Button",20,50,120)
$check_mHold = GUICtrlCreateCheckbox("Hold down",20,70)
GUICtrlSetState($Radio_LeftM,$GUI_CHECKED)
GUICtrlCreateGroup ("",-99,-99,1,1)
GUICtrlCreateGroup ("Crosshair Radius", 180, 10, 160, 100)
$Radio_play1 = GUICtrlCreateRadio("4 Pixels",200,30,120)
$Radio_play2 = GUICtrlCreateRadio("16 Pixels",200,50,120)
$Radio_play3 = GUICtrlCreateRadio("32 Pixels",200,70,120)
GUICtrlSetState($Radio_play2,$GUI_CHECKED)
GUICtrlCreateGroup ("",-99,-99,1,1)
$bColor = GUICtrlCreateButton("Choose Color",30,30+$pos_color_ctrls,80)
GUICtrlCreateGroup ("Trigger on this color", 10, 10+$pos_color_ctrls, 120, 130)
$display_Color = GUICtrlCreateLabel("",20,60+$pos_color_ctrls,100,40)
GUICtrlSetBkColor($display_Color,0xFF0000)
$check_match = GUICtrlCreateCheckbox("Exact Match",30,100+$pos_color_ctrls)
GUICtrlCreateGroup ("Allowed color variation", 140, 10+$pos_color_ctrls, 200, 130)
$slider = GUICtrlCreateSlider(170,50+$pos_color_ctrls,150,30)
GUICtrlSetLimit($slider,128,0)
GUICtrlSetData($slider,32)
$h_slider = ControlGetHandle($GUI, "", "msctls_trackbar321")
$l1 = GUICtrlCreateLabel("0",180,85+$pos_color_ctrls)
$l2 = GUICtrlCreateLabel("64",240,85+$pos_color_ctrls)
$recommended = GUICtrlCreateLabel("(Default)",225,100+$pos_color_ctrls,80)
$l3 = GUICtrlCreateLabel("128",300,85+$pos_color_ctrls)
GUICtrlCreateGroup ("",-99,-99,1,1)
GUICtrlCreateLabel("Press F11 to toggle ON and OFF",10,280)
$on_off_display = GUICtrlCreateLabel("Status: OFF",290,280)
GUISetState (@SW_SHOW,$GUI)

While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE 
        Exit
    Case $msg = $bColor
        SelectColor(1)
    Case $msg = $Radio_play1 ;very accurate
        $pixelradius = 4
    Case $msg = $Radio_play2 ;mid accurate
        $pixelradius = 16
    Case $msg = $Radio_play3 ;somewhat close
        $pixelradius = 32
    Case $msg = $check_match
        $isChecked = Not $isChecked
        If $isChecked = 1 Then 
            GUICtrlSetState($slider,$GUI_DISABLE)
            GUICtrlSetState($l1,$GUI_DISABLE)
            GUICtrlSetState($l2,$GUI_DISABLE)
            GUICtrlSetState($l3,$GUI_DISABLE)
            GUICtrlSetData($slider,0)
        Else
            GUICtrlSetState($slider,$GUI_ENABLE)
            GUICtrlSetState($l1,$GUI_ENABLE)
            GUICtrlSetState($l2,$GUI_ENABLE)
            GUICtrlSetState($l3,$GUI_ENABLE)
        EndIf
    EndSelect
Wend

Func ChangeRangeBox() ;Changes the size of box in center of screen
    $left = @Desktopwidth / 2 - $pixelradius
    $top = @Desktopheight / 2 - $pixelradius
    $right = @Desktopwidth / 2 + $pixelradius
    $bottom = @Desktopheight / 2 + $pixelradius
EndFunc

Func RunBot() ;When F11 is pressed this is called
    If $isPaused = 0 Then
        ChangeRangeBox() ;Update scan box size
        Local $Color_Exact = BitAND(GUICtrlRead($check_match),$GUI_CHECKED)
        Local $mouseButton = BitAND(GUICtrlRead($Radio_LeftM),$GUI_CHECKED)
        Local $IsMouseHold = BitAND(GUICtrlRead($check_mHold),$GUI_CHECKED)

        ;=================== One Color ================
        If  $Color_Exact = 1 Then
            $matchColor = 0 ;If exactly is checked then set it to zero
        Else
            $matchColor = _GUICtrlSliderGetPos($h_slider) ;Else let color vary a little
        EndIf
       
        While $isPaused = 0 ;Keep running bot until F11 hotkey is pressed
            PixelSearch( $left, $top, $right, $bottom, $Color_Hex, $matchColor )
            If Not @Error Then
                If $mouseButton = 1 Then ;If left mouse button is selected
                    If $IsMouseHold = 1 And Not _IsPressed("01") Then ;If holding down MouseClick
                        MouseDown("left")
                        sleep(50)
                    Else ;not holding down MouseClick
                        MouseDown("left") ;Assuming this is your primary fire
                        Sleep(50) ;make it work in game
                        MouseUp("left")
                    Endif
                Else ;If right mouse button is selected
                    If $IsMouseHold = 1 And Not _IsPressed("02") Then
                        MouseDown("right")
                        sleep(50)
                    Else ;not holding down MouseClick
                        MouseDown("right") ;Assuming this is your primary fire
                        Sleep(50) ;make it work in game
                        MouseUp("right")
                    EndIf
                EndIf
            ElseIf _IsPressed("01") Or _IsPressed("02") Then ;Pixel Not found then reset stuff
                MouseUp("left")
                MouseUp("right")
            EndIf
            Sleep($refreshrate) ;Sync with monitor refresh rate
        WEnd
    EndIf
EndFunc

Func SelectColor($color_bg)
    Local $hex = _ChooseColor(2,$Color_Hex,2)
    If Not @error = -4 Then
        sleep(100)
        If $color_bg = 1 Then 
            GUICtrlSetBkColor($display_Color,$hex)
            GUICtrlSetData($display_Color,$hex)
            $Color_Hex = $hex ;Change hex color to trigger on
        EndIf
    EndIf
EndFunc

Func _PauseBot()
   $isPaused = Not $isPaused
   If $isPaused = 1 Then
       Guictrlsetdata($on_off_display,"Status: OFF")
       ToolTip("TriggerBot Off",100,50)
       sleep(1000) ;Only display for a second
       ToolTip("") ;^^
   ElseIf $isPaused = 0 Then
       Guictrlsetdata($on_off_display,"Status: ON")
       ToolTip("TriggerBot On",100,50)
       sleep(1000) ;Only display for a second
       ToolTip("") ;^^
       RunBot()
   Endif
EndFunc

Exit

I have not seen one that is easy to use as this with the amount of features. So I gave it a shot.. works extremly fast.

Edited by Toady

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Nice and simple , I like the idea of it.

I haven't actually tried it in a game as of yet..

But I did try it on my desktop.

If I save your script with the name pixeltrigger.au3 then run the script then it just closes instantly.

I changed:

$g_szVersion = "PixelTrigger"   
If WinExists($g_szVersion) Then Exit
AutoItWinSetTitle($g_szVersion)oÝ÷ Ù:ºÚ"µÍÌÍÙ×ÜÞÚ[ÛH ][ÝÔ^[YÙÙ][ÝÈYÔÚ[Û]Û  ÌÍÙ×ÜÞÚ[ÛJHH[SÙÐÞ
    ][ÝÔ^[YÙÙ][ÝË ][ÝÔ^[YÙÙÈ[XYH[[Ë][ÝËBQ^][Y

I also noticed no matter what color I select for the trigger that my right click context menu shows up as soon as I activate (F11), this happens no matter what mouse click I set as the trigger. I haven't looked into to far yet , could be other software I use conflicting with your script.

But I really do like idea of your script, I thought I might be able to set a colour thats in an icon on my desktop and it launch my program by pointing at the icon (just as a test).

I'll play around with it some more and give some more feedback l8r.

Maybe another setting to add maybe click timer of some sort , for how many times to fire when on a pixel constantly, at present I think it just continually clicks if pointing at a pixel without moving away. ( I could be wrong on that.)

or a macro record option in the "When On Target" settings.

This way a user can set left click & KB button & rightclick &...etc when they find the target.

Thank You

&

Cheers.

Edited by smashly

Share this post


Link to post
Share on other sites

Thank you, I fixed the issue you were having with it closing. I also fixed the "right click no matter what" issue like you were saying, my logic was missing the _ispressed(01) part.

Anyways, I believe the concept is good, adding a way to bind new macros would be cool. I have tried making this a full aimbot but its more trouble than its worth.


www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites

nice and simple, but I dont know any game to use it for.

Share this post


Link to post
Share on other sites

The made for FPS based games. If you can manage to get player skins one color this works really well.

UT2004 has this mod called UTComp which allows you to make everyone a solid color. Something like that... get my drift?


www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites

Hi... i wanted to tell u in the first place that the script work super well for quake 3....but it would need a little something inside of it...cuz it`s to obvious that someone is cheating....

I was wandering if it`s possible to instert a delay form...i mean that the crosshair should stai on the enemy for about 1 second or so (it would be great to let the user insert that amout of time as he wish)....can u tell me how and where to add this option

Thanks and keep up the good work

Share this post


Link to post
Share on other sites

Hi... i wanted to tell u in the first place that the script work super well for quake 3....but it would need a little something inside of it...cuz it`s to obvious that someone is cheating....

I was wandering if it`s possible to instert a delay form...i mean that the crosshair should stai on the enemy for about 1 second or so (it would be great to let the user insert that amout of time as he wish)....can u tell me how and where to add this option

Thanks and keep up the good work

What you describe is an Aimbot, this is a Triggerbot hence the name. You will have to add some code to compensate for movements and use _Mousemoveplus(). I attempted this before yet I lacked the interest. Its good to hear its working well for you :rolleyes:


www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites

Excellent work AGAIn Toady, Thank you for Shareing.

a small addition I made for my own use

Func SelectColor($color_bg) 
    sleep(100)
    $msg =  "Left Click on color to Record "
    while 1
        $xy = MouseGetPos()
        $currentpixel = PixelGetColor($xy[0],$xy[1])
        ToolTip("Pixel color:  " & $currentpixel & @LF & $msg)
        If _IsPressed("01") Then
            GUICtrlSetBkColor($display_Color,$currentpixel)
            GUICtrlSetData($display_Color,$currentpixel)    
            $Color_Hex = $currentpixel
            ExitLoop
        EndIf
        Sleep(25)
    WEnd
EndFunc

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Share this post


Link to post
Share on other sites

What you describe is an Aimbot, this is a Triggerbot hence the name. You will have to add some code to compensate for movements and use _Mousemoveplus(). I attempted this before yet I lacked the interest. Its good to hear its working well for you :rolleyes:

i know the difference between an aimbot and a triggerbot....anyway...i meanted to insert a line that will delay just for a few milliseconds the shooting...this way is less obvious....

Anw i`ve made it...if some one need it..just add some Sleep(150) be4 the two clicks and it`s done..now its less detectable...:rambo:

Share this post


Link to post
Share on other sites

I know someone who won a free video card using this same kind of bot. He won it on a online quake 2 rocket arena tournament. We all knew he used one, but punkbuster couldnt detect it.

Share this post


Link to post
Share on other sites

Another great one Toady I have little use for it in games right now. However I have learned allot from reading the code. Good stuff I can apply to other projects. Clean code, well laid out as usual!


AutoIt changed my life.

Share this post


Link to post
Share on other sites

Using the "exact match" works, but not if you use the slider to vary the color slightly.


"I'm paper, rock is fine, nerf scissors!!!"

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Heya,

Sorry for reviving an old topic, but I just ought to try it .. Well, it launches all right, but when I turn it on, it gives me this error screen:

Posted Image

I called the script "TriggerHappy" and it is on my desktop, as it seems..

Any ideas? Any hope?

Oh, and by the way, from lines 106 to lines 111:

;=================== One Color ================
        If  $Color_Exact = 1 Then
            $matchColor = 0;If exactly is checked then set it to zero
        Else
            $matchColor = _GUICtrlSliderGetPos($h_slider);Else let color vary a little
        EndIf
Edited by Chobby

Share this post


Link to post
Share on other sites

This script is from an old version of Autoit. If you want it to work then I suppose you could rewrite what is broken. I have no interest in fixing this.


www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites

All right :P No problem.. Thanks..

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