Jump to content

It have thread in autoit?


Recommended Posts

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPISysWin.au3>
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Aukeng", 457, 139, 192, 124, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST,$WS_EX_LAYERED))
GUISetBkColor(0x000000)
_WinAPI_SetLayeredWindowAttributes($Form1, 0x000000)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1_1Close")
$Hook = GUICtrlCreateLabel("Hook: ", 24, 24, 86, 32)
GUICtrlSetFont(-1, 18, 800, 0, "Bookman Old Style")
GUICtrlSetColor(-1, 0xFFFFFF)
$c_h1 = GUICtrlCreateLabel("0", 152, 24, 20, 32)
GUICtrlSetFont(-1, 18, 800, 0, "Bookman Old Style")
GUICtrlSetColor(-1, 0xFFFFFF)
$c_h2 = GUICtrlCreateLabel("0", 232, 24, 20, 32)
GUICtrlSetFont(-1, 18, 800, 0, "Bookman Old Style")
GUICtrlSetColor(-1, 0xFFFFFF)
$c_h3 = GUICtrlCreateLabel("0", 312, 24, 20, 32)
GUICtrlSetFont(-1, 18, 800, 0, "Bookman Old Style")
GUICtrlSetColor(-1, 0xFFFFFF)
$c_h4 = GUICtrlCreateLabel("0", 392, 24, 20, 32)
GUICtrlSetFont(-1, 18, 800, 0, "Bookman Old Style")
GUICtrlSetColor(-1, 0xFFFFFF)
$DS = GUICtrlCreateLabel("DS:", 40, 72, 47, 32)
GUICtrlSetFont(-1, 18, 800, 0, "Bookman Old Style")
GUICtrlSetColor(-1, 0xFFFFFF)
$c_ds1 = GUICtrlCreateLabel("0", 152, 72, 20+20, 32)
GUICtrlSetFont(-1, 18, 800, 0, "Bookman Old Style")
GUICtrlSetColor(-1, 0xFFFFFF)
$c_ds2 = GUICtrlCreateLabel("0", 232, 72, 20+20, 32)
GUICtrlSetFont(-1, 18, 800, 0, "Bookman Old Style")
GUICtrlSetColor(-1, 0xFFFFFF)
$c_ds3 = GUICtrlCreateLabel("0", 312, 72, 20+20, 32)
GUICtrlSetFont(-1, 18, 800, 0, "Bookman Old Style")
GUICtrlSetColor(-1, 0xFFFFFF)
$c_ds4 = GUICtrlCreateLabel("0", 392, 72, 20+20 , 32)
GUICtrlSetFont(-1, 18, 800, 0, "Bookman Old Style")
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$canmove=False
$count_h1=0
$count_h2=0
$count_h3=0
$count_h4=0
$count_ds1=0
$count_ds2=0
$count_ds3=0
$count_ds4=0
$counttime1=0
$counttime2=0
$counttime3=0
$counttime4=0
Const $time=60
$start_ds1=False
$start_ds2=False
$start_ds3=False
$start_ds4=False
WinMove("Aukeng","",24, 18)
HotKeySet("{/}","Form1_1Close") ;Exit
HotKeySet("{m}","canmove") ;Move
HotKeySet("{1}","c_h1Click") ;hook count1
HotKeySet("{2}","c_h2Click") ;hook count2
HotKeySet("{3}","c_h3Click") ;hook count3
HotKeySet("{4}","c_h4Click") ;hook count4
HotKeySet("{5}","reset") ;reset
HotKeySet("{f1}","c_ds1Click") ;countds
HotKeySet("{f2}","c_ds2Click") ;countds
HotKeySet("{f3}","c_ds3Click") ;countds
HotKeySet("{f4}","c_ds4Click") ;countds
While 1
    Sleep(100)
    $sur1=PixelGetColor(145, 959)
    $sur2=PixelGetColor(255, 959)
    $sur3=PixelGetColor(365, 959)
    $sur4=PixelGetColor(475, 959)
    ToolTip("0x"&Hex($sur2,6),0,0)


        autocount1() ;do this thing in the same time

        autocount2()  ;do this thing in the same time

        autocount3()  ;do this thing in the same time

        autocount4()  ;do this thing in the same time

    ;;;;;;;;;;;manmal;;;;;;;;;;;;;;

    If $start_ds1=True Then
        $timeleft1=Int($time-(TimerDiff($counttime1)/1000))
        GUICtrlSetData($c_ds1,$timeleft1)
        If $timeleft1=0 Then
            $start_ds1=False
        EndIf
    EndIf
    If $start_ds2=True Then
        $timeleft2=Int($time-(TimerDiff($counttime2)/1000))
        GUICtrlSetData($c_ds2,$timeleft2)
        If $timeleft2=0 Then
            $start_ds2=False
        EndIf
    EndIf
    If $start_ds3=True Then
        $timeleft3=Int($time-(TimerDiff($counttime3)/1000))
        GUICtrlSetData($c_ds3,$timeleft3)
        If $timeleft3=0 Then
            $start_ds3=False
        EndIf
    EndIf
    If $start_ds4=True Then
        $timeleft4=Int($time-(TimerDiff($counttime4)/1000))
        GUICtrlSetData($c_ds4,$timeleft4)
        If $timeleft4=0 Then
            $start_ds4=False
        EndIf
    EndIf
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WEnd

Func autocount1()
    c_h1Click()
    Do
        sleep(100)
        $sur1=PixelGetColor(160, 946)
        ToolTip("0x"&Hex($sur1,6),0,20)
        If $count_h1=3 Then
            ExitLoop
        EndIf
    Until $sur1 = 0xEDE6E7
    c_ds1Click()
EndFunc
Func autocount2()
    c_h3Click()
    Do
        sleep(100)
        $sur2=PixelGetColor(270, 946)
        ToolTip("0x"&Hex($sur2,6),0,20)
        If $count_h2=3 Then
            ExitLoop
        EndIf
    Until $sur2 = 0xEDE6E7
    c_ds2Click()
EndFunc
Func autocount3()
    c_h3Click()
    Do
        sleep(100)
        $sur3=PixelGetColor(380, 946)
        ToolTip("0x"&Hex($sur3,6),0,20)
        If $count_h3=3 Then
            ExitLoop
        EndIf
    Until $sur3 = 0xEDE6E7
    c_ds3Click()
EndFunc
Func autocount4()
    c_h4Click()
    Do
        sleep(100)
        $sur4=PixelGetColor(490, 946)
        ToolTip("0x"&Hex($sur4,6),0,20)
        If $count_h4=3 Then
            ExitLoop
        EndIf
    Until $sur4 = 0xEDE6E7
    c_ds4Click()
EndFunc
Func c_ds1Click()
    $counttime1=TimerInit()
    $start_ds1=True
EndFunc
Func c_ds2Click()
    $counttime2=TimerInit()
    $start_ds2=True
EndFunc
Func c_ds3Click()
    $counttime3=TimerInit()
    $start_ds3=True
EndFunc
Func c_ds4Click()
    $counttime4=TimerInit()
    $start_ds4=True
EndFunc
Func c_h1Click()
    if $count_h1 >2 then
        $count_h1=-1
    EndIf
    $count_h1+=1
    GUICtrlSetData($c_h1,$count_h1)
EndFunc
Func c_h2Click()
    if $count_h2 >2 then
        $count_h2=-1
    EndIf
    $count_h2+=1
    GUICtrlSetData($c_h2,$count_h2)
EndFunc
Func c_h3Click()
    if $count_h3 >2 then
        $count_h3=-1
    EndIf
    $count_h3+=1
    GUICtrlSetData($c_h3,$count_h3)
EndFunc
Func c_h4Click()
    if $count_h4 >2 then
        $count_h4=-1
    EndIf
    $count_h4+=1
    GUICtrlSetData($c_h4,$count_h4)
EndFunc

       In autocountN() have 2 events first if the program finds the first color go to the second event. Second, go find the second color. Can I do 4 autocuountN() at the same time? I mean if autocount1() finishes the first event and waits for the second event but program found the first event in the autocuount2() too which means it waits for the second event 2 functions. But this program does is do function1 done 2 events go function2 I want to do all at the same time.

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

  • Moderators

godjacky2,

This looks like a gamebot? Is that in fact the case?

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

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...