Jump to content

Help With pixel code,Unknown function name


Devanos
 Share

Recommended Posts

Toady's Pixelprogram

works fine in quacke when i use exact color ,butdoesnt give me good anugh result against my brother, he's a devil in quacke.

any help appriciated.

line 110: is the problem

this is the code function that i need help with

$matchColor = _GUICtrlSliderGetPos($h_slider) 
$matchColor = ^ ERROR

;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
Link to comment
Share on other sites

That function is now _GUICtrlSlider_GetPos() in the latest version of AutoIt (3.2.10.0). Check it out in the help file.

:)

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...