Jump to content
Sign in to follow this  
tiktaktoe

Cant complete my own code

Recommended Posts

tiktaktoe

I've been learning AutoIt 3 weeks ago on google, and i create my programe, but i cant complete because im not good in autoit, this is my code and i have explain there.

Opt("GUIOnEventMode", 1)
#include <GUIConstantsEx.au3>

Global Const $maumau = 0x3e3e3e
Global $bStopSignal = False
Global $btnStop, $btnStart, $hGui

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ###
$HgUI = GUICreate("form1", 174, 230, 192, 124,  BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS), $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
GUICtrlCreateLabel("Tat t.bao", 24, 8, 47, 17)
GUICtrlCreateLabel("Rao", 24, 32, 24, 17)
GUICtrlCreateLabel("tangthem", 24, 56, 55, 17)
GUICtrlCreateLabel("Tach do", 24, 80, 44, 17)
GUICtrlCreateLabel("1", 24, 104, 10, 17)
GUICtrlCreateLabel("2", 24, 133, 10, 17)
GUICtrlCreateLabel("3", 24, 152, 10, 17)
GUICtrlCreateLabel("4", 24, 180, 10, 17)
GUICtrlCreateLabel("5", 24, 199, 10, 17)
GUICtrlCreateLabel("6", 109, 106, 10, 17)
GUICtrlCreateLabel("7", 109, 135, 10, 17)
GUICtrlCreateLabel("8", 109, 154, 10, 17)
GUICtrlCreateLabel("9", 109, 182, 10, 17)
GUICtrlCreateLabel("0", 109, 201, 10, 17)


$Checkbox1 = GUICtrlCreateCheckbox("", 8, 8, 17, 17)
$Checkbox2 = GUICtrlCreateCheckbox("", 8, 32, 17, 17)
$Checkbox3 = GUICtrlCreateCheckbox("", 8, 56, 17, 17)
$Checkbox4 = GUICtrlCreateCheckbox("", 8, 80, 17, 17)


$Checkbox5 = GUICtrlCreateCheckbox("", 8, 104, 17, 17)
$Checkbox6 = GUICtrlCreateCheckbox("", 8, 128, 17, 17)
$Checkbox7 = GUICtrlCreateCheckbox("", 8, 152, 17, 17)
$Checkbox8 = GUICtrlCreateCheckbox("", 8, 176, 17, 17)
$Checkbox9 = GUICtrlCreateCheckbox("", 8, 200, 17, 17)
$Checkbox10 = GUICtrlCreateCheckbox("", 93, 106, 17, 17)
$Checkbox11 = GUICtrlCreateCheckbox("", 93, 130, 17, 17)
$Checkbox12 = GUICtrlCreateCheckbox("", 93, 154, 17, 17)
$Checkbox13 = GUICtrlCreateCheckbox("", 93, 178, 17, 17)
$Checkbox14 = GUICtrlCreateCheckbox("", 93, 202, 17, 17)


$Input1 = GUICtrlCreateInput("", 40, 104, 41, 21)
$Input2 = GUICtrlCreateInput("", 40, 128, 41, 21)
$Input3 = GUICtrlCreateInput("", 40, 152, 41, 21)
$Input4 = GUICtrlCreateInput("", 40, 176, 41, 21)
$Input5 = GUICtrlCreateInput("", 40, 200, 41, 21)
$Input6 = GUICtrlCreateInput("", 125, 106, 41, 21)
$Input7 = GUICtrlCreateInput("", 125, 130, 41, 21)
$Input8 = GUICtrlCreateInput("", 125, 154, 41, 21)
$Input9 = GUICtrlCreateInput("", 125, 178, 41, 21)
$Input0 = GUICtrlCreateInput("", 125, 202, 41, 21)
$rao = GUICtrlCreateInput("100000", 56, 32, 44, 26)
$btnstart = GUICtrlCreateButton("START", 104, 8, 57, 33)
$btnstop = GUICtrlCreateButton("STOP", 104, 56, 57, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUICtrlSetOnEvent($btnStart, OnBtnStartClick)
GUICtrlSetOnEvent($btnStop, OnBtnStopClick)
GUISetOnEvent(-3, OnGuiClose, $hGUI)

Func bom()
  PixelSearch(121, 40, 161, 41, $maumau, 10, 1)
  If Not @error Then
    Send("z")
  EndIf
EndFunc

Func bomAndSleep($iSleep = 500, $iLoop = 1)
    If $iLoop < 1 Then $iLoop = 1
    If $iSleep < 10 Then $iSleep = 10

    For $i = 1 To $iLoop
      bom()
      Sleep($iSleep)
    Next
EndFunc

Func tancongnho()
    ;$i = 1
    ;   Do

        If BitAND(GUICtrlRead($Checkbox5),$GUI_CHECKED) Then
            sleep (GUICtrlRead($input1))
            send ('{1}')
             EndIf

             If BitAND(GUICtrlRead($Checkbox6),$GUI_CHECKED) Then
                sleep (GUICtrlRead($input2))
                send ('{2}')
             EndIf

            If BitAND(GUICtrlRead($Checkbox7),$GUI_CHECKED) Then
                sleep (GUICtrlRead($input3))
                send ('{3}')
             EndIf

             If BitAND(GUICtrlRead($Checkbox8),$GUI_CHECKED) Then
                sleep (GUICtrlRead($input4))
                send ('{4}')
             EndIf

             If BitAND(GUICtrlRead($Checkbox9),$GUI_CHECKED) Then
                sleep (GUICtrlRead($input5))
                send ('{5}')
             EndIf

             If BitAND(GUICtrlRead($Checkbox10),$GUI_CHECKED) Then
                sleep (GUICtrlRead($input6))
                send ('{6}')
             EndIf

             If BitAND(GUICtrlRead($Checkbox11),$GUI_CHECKED) Then
                sleep (GUICtrlRead($input7))
                send ('{7}')
             EndIf

             If BitAND(GUICtrlRead($Checkbox12),$GUI_CHECKED) Then
                sleep (GUICtrlRead($input8))
                send ('{8}')
             EndIf

             If BitAND(GUICtrlRead($Checkbox13),$GUI_CHECKED) Then
                sleep (GUICtrlRead($input9))
                send ('{9}')
             EndIf

            If BitAND(GUICtrlRead($Checkbox14),$GUI_CHECKED) Then
                sleep (GUICtrlRead($input0))
                send ('{0}')
             EndIf


    ;until $i > 1
    bomAndSleep()
EndFunc

Func tancongtong()
    Do
    ;PixelSearch(497, 31, 599, 67, 0x8A9297)
    PixelSearch(361, 182, 459, 220, 0xffff00)
    If @error Then
    sleep (200)
    Send("Z")
    Else
        tancongnho()
    EndIf
  Until $bStopSignal
  If ($bStopSignal) Then
    GUICtrlSetState($btnStart, $GUI_ENABLE)
  EndIf
EndFunc

;-----------------------------------------------------

; code loop here ( repeat after 3 mins )
; if i click start button, programe will run func tancongtong() and func bom() and loop

;work in loop
 ;If BitAND(GUICtrlRead($Checkbox4),$GUI_CHECKED) Then
  ;sleep (2000)
   ;Mouseclick ("left", 500, 600, 1, 0)
   ;sleep (2000)
   ;Mouseclick ("left", 550, 650, 1, 0)
   ;sleep (2000)
   ;Mouseclick ("left", 600, 700, 1, 0)

;------------------------------------------------------------------------------------


Func OnBtnStartClick()
sleep (100)
;WinMove("[CLASS:XLMAIN]", "", 342, 0, 600, 600)
   $bStopSignal = False
  GUICtrlSetState($btnStart, $GUI_DISABLE)
  GUICtrlSetState($btnStop, $GUI_ENABLE)
  AdlibRegister("tancongtong", 285)
  AdlibRegister("bom", 150)
EndFunc

Func OnBtnStopClick()
  $bStopSignal = True
  AdlibUnRegister("tancongtong")
  AdlibUnRegister("bom")
  GUICtrlSetState($btnStop, $GUI_DISABLE)
EndFunc

Func OnGuiClose()
  Exit
EndFunc

While Sleep(0x7FFFFF)
WEnd
Exit

this is my first program and i wish to complete it.

Thank you.

Share this post


Link to post
Share on other sites
somdcomputerguy

i have explain there.

You have not asked or explained anything.

 

;work in loop
;If BitAND(GUICtrlRead($Checkbox4),$GUI_CHECKED) Then

However, if this part of the code is your question, If loops must end with EndIf

 

While Sleep(0x7FFFFF)

WEnd

Exit

This While .. WEnd loop is all wrong. You want the script to Sleep a certain color?

 

this is my first program and i wish to complete it.

Your best bet is to read the Help file, completely, to understand this language more. Find someone to help you read it if you need to.

Welcome to the Forum. Don't forget to read the Forum Rules - http://www.autoitscript.com/forum/index.php?app=forums&module=extras&section=boardrules.

B)


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
computergroove

Func tancongtong()
    Do
    ;PixelSearch(497, 31, 599, 67, 0x8A9297)
    PixelSearch(361, 182, 459, 220, 0xffff00)
    If @error Then
    sleep (200)
    Send("Z")
    Else
        tancongnho()
    EndIf
  Until $bStopSignal
  If ($bStopSignal) Then
    GUICtrlSetState($btnStart, $GUI_ENABLE)
  EndIf
EndFunc

Google translates :

"tan cong nho" as Small Attack

"tan cong tong" as Scale Attack

Game automation?


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites
somdcomputerguy

"tan cong nho" as Small Attack

"tan cong tong" as Scale Attack

Game automation?

In there you'll see the first rule:

Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects:

- Launching, automation or script interaction with games or game servers, regardless of the game.

Welcome again to the Forum though. B)

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Melba23

tiktaktoe,

Welcome to the AutoIt forum. :)

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now (there is also a link at bottom right of each page) - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. :naughty:

See you soon with a legitimate question I hope. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×