Jump to content

Error al activar casilla de verificación ¡AYUDA!


Recommended Posts

Hola soy nuevo en el foro y tengo un proyecto que consiste en hacer un bot que reconoce imágenes

y lo que yo quise hacer es que cuando se activen las casillas solo funcionen si el programa esta activado

Codigo: 

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <ImageSearch.au3>
#include <AutoItConstants.au3>


HotKeySet("{f2}", "iniciar")
HotKeySet("{ESC}", "salir")

Global $X = 0
Global $Y = 0
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("CaltaBot v0.01", 242, 186, 228, 156)
$Group1 = GUICtrlCreateGroup("Boxes", 8, 96, 97, 81)
$bbox = GUICtrlCreateCheckbox("Normales", 16, 120, 65, 17)
$ebox = GUICtrlCreateCheckbox("Eventos", 16, 144, 65, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("P.E.T", 112, 96, 121, 81)
$activpetcaj = GUICtrlCreateCheckbox("Activar Pet Cajero", 120, 120, 105, 17)
$reppet = GUICtrlCreateCheckbox("Reparar Pet", 120, 144, 81, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("Anti-Ban", 112, 8, 121, 81)
$camunav = GUICtrlCreateCheckbox("Camuflar nave", 120, 32, 97, 17)
$offbot = GUICtrlCreateCheckbox("Desc. en 6h", 120, 56, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("Teclas", 8, 8, 97, 81)
$Label1 = GUICtrlCreateLabel("F2 - Iniciar", 16, 32, 77, 17)
GUICtrlSetFont(-1, 8, 800, 0, "Verdana")
$Label2 = GUICtrlCreateLabel("ESC - Salir", 16, 56, 64, 17)
GUICtrlSetFont(-1, 8, 800, 0, "Verdana")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd


Func iniciar()
    $rX = 180
    $rY = 110

    Global $m_pos = MouseGetPos()
    $Search = _ImageSearch('minimap.bmp', 1, $X, $Y, 0)
    While 1
        If $Search = 1 Then
            MouseClick("left", $X + (Random(0, $rX, 1)), $Y + (Random(0, $rY, 1)))
            MouseMove($m_pos[0], $m_pos[0], 0)
            Sleep(6000)
        Else
            MsgBox(0, "Error", "No se encontro el minimapa")
            ExitLoop
        EndIf

;--------------------Según yo el problema esta aquí----------------------- yo lo que quiero es que luego de que se precione la tecla F2 lea esta secuencia y si alguna casilla esta activada que ejecute la funcion de dicho caso
     Switch $Group2
           
        Case $activpetcaj ;=====> casilla de verificación
           activarpetcaj() ;====> función que de debe activar en caso de que la casilla este activada
           
        Case $camunav
           camunave()
           
     EndSwitch

;----------------------------------------------------------------------------------------------
    WEnd
EndFunc   ;==>iniciar

Func activarpetcaj()
    $onpet_x = 0
    $onpet_y = 0
    $search_onpet = _ImageSearch('on_pet.bmp', 1, $onpet_x, $onpet_y, 0)
    If $search_onpet = 1 Then
        MouseClick($MOUSE_CLICK_LEFT, $onpet_x, $onpet_y, 1)
    EndIf
    selectmodul()
EndFunc   ;==>activarpetcaj

Func selectmodul()
    $selectmodul_x = 0
    $selectmodul_y = 0
    $search_modul = _ImageSearch('selecmodul.bmp', 1, $selectmodul_x, $selectmodul_y, 0)
    If $search_modul = 1 Then
        MouseClick($MOUSE_CLICK_LEFT, $selectmodul_x, $selectmodul_y, 1)
        colectbox()
    EndIf
EndFunc   ;==>selectmodul

Func colectbox()
    $colectbox_x = 0
    $colectbox_y = 0
    $search_colectbox = _ImageSearch('colectbox.bmp', 1, $colectbox_x, $colectbox_y, 0)
    If $search_colectbox = 1 Then
        MouseClick($MOUSE_CLICK_LEFT, $colectbox_x, $colectbox_y, 1)
    EndIf

EndFunc   ;==>colectbox


Func camunave()
    $camu_x = 0
    $camu_y = 0
    $search_camu1 = _ImageSearch('camu1.bmp', 1, $camu_x, $camu_y, 0)
    $search_camu2 = _ImageSearch('camu2.bmp', 1, $camu_x, $camu_y, 0)
    If $search_camu1 = 1 Then
        MouseClick($MOUSE_CLICK_LEFT, $camu_x, $camu_y, 1)

    ElseIf $search_camu2 = 1 Then
        MouseClick($MOUSE_CLICK_LEFT, $camu_x, $camu_y, 1)
    EndIf
EndFunc   ;==>camunave

Func salir()
    Exit
EndFunc   ;==>salir

Si me pueden ayudar en esto se los agradecería de todos corazón ya es un proyecto sin fines de lucro. Saludos!
 

 

Edited by Melba23
Added code tags
Link to comment
Share on other sites

Hola. En este foro no se brinda ayuda para crear Bots para juegos. Pasate a leer las reglas.

 

Saludos

Link to comment
Share on other sites

  • Moderators

psyko,

Welcome to the AutoIt forums.

This is an English-speaking forum and, although some of us are fluent in other languages, we prefer you to post in that language using Google Translate or a similar site if your English is not that good.

And when you post code please use Code tags - see here how to do it.  Then you get a scrolling box and syntax colouring as you can see above now I have added the tags.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

psyko,

And now I have translated your post in its entirety I see that Danyfirex is correct. You appear not to have read the Forum rules since your arrival. Please do read them - particularly the bit about not discussing game automation - before you post again and then you will understand why you will get no help and this thread will now be locked.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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