Jump to content

I need some help with my code


Recommended Posts

hello, I'm very new to autoit, I only had experience with java language. So I'll explain what I'm trying to do:

 

but i'm strugling with the timer code, I never made a timer like this, I'll explain what I am trying to do:

1) the first 7 seconds (after I pressed the button) should show up normally 

2) the following 80 seconds should show up with an orange background but when 1) is finished the timer should be resetted and start counting to 80 with the orange background

3) then if 2) is finished the timer should be resseted to and start counting to 6 with a red background

4) finally if 3) is finished the timer should reset again and start counting ip to 8minutes and I want it so it displays minutes : seconds

5) after all this is finished it should start from the beginning again

#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
 
;==> Set our $font variable
Global $font
$font = "Arial Black"
 
;Constants
Const $sleepLen = 100
; New variables
Dim $check1 = False
Dim $check2 = False
Dim $check3 = False
Dim $check4 = False
Dim $botcounter = 0
 
;==> Create our Graphic User Interface
;Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
$varWindow = GUICreate("Jungle Timers Deluxe", 150, 400, 1675, 30)
$startbutton = GUICtrlCreateButton("start bot", 10, 10, 100, 50, $BS_MULTILINE)
$varButtonTopmost = GUICtrlCreateButton("window topmost", 10, 60, 100, 50)
$varButtonNormal = GUICtrlCreateButton("window normal", 10, 110, 100, 50)
$varLoop = True
 
;==> Display our Graphic User Interface.
GUISetState(@SW_SHOW)
 
 While $varLoop
    $varMessage = GUIGetMsg()
    Select
        Case $varMessage = $GUI_EVENT_CLOSE
            $varLoop = False
            Exit
        Case $varMessage == $varButtonTopmost
            _Button_Topmost_Clicked()
        Case $varMessage == $varButtonNormal
            _Button_Normal_Clicked()
    EndSelect

        $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
                CLOSEClicked()
        Case $startbutton
                ; Start the timer
                $check1 = True
                ; Reset the counter
                $botcounter = 0
                ; Delete the controls and make the new ones
                $bot = GUICtrlCreateLabel("Bot active:", 10, 165)
                GUICtrlDelete($startbutton)
                Global $botlabel = GUICtrlCreateLabel("0", 15, 180, 50, 40)
                GUICtrlSetFont(-1, 22, 500, $font)
        EndSwitch
        sleep($sleepLen)
        check1()
WEnd
 
Func check1()
        If $check1 Then
                $botcounter += 1
                If $botcounter = (1000/$sleepLen)*7 Then
                    $botcounter = 0
                    $check2 = True
                EndIf
                ; Update the label & font
                If Mod($botcounter, (1000/$sleepLen)) = 0 Then
                                GUICtrlSetData($botlabel, Round($botcounter/(1000/$sleepLen)))
                EndIf
                check2()
                if $check2 = True then
                $check1 = False
                endif
        EndIf
EndFunc

Func check2()
        if $check2 then
            $botcounter += 1
            GUICtrlSetBkColor($botlabel, 0xff9900)
            If $botcounter = (1000/$sleepLen)*80 Then
            ; Set the back color
                GUICtrlSetBkColor($botlabel, 0x66ccff)
                $botcounter = 0
                $check3 = True
            EndIf
            If Mod($botcounter, (1000/$sleepLen)) = 0 Then
                                GUICtrlSetData($botlabel, Round($botcounter/(1000/$sleepLen)))
            EndIf
        EndIf
        check3()
EndFunc

Func check3()
        if $check3 then
            If $botcounter = (1000/$sleepLen)*6 Then
            ; Set the back color
                GUICtrlSetBkColor($botlabel, 0xff0000)
                $botcounter = 0
                $check4 = True
            EndIf
            If Mod($ybluebuffcounter, (1000/$sleepLen)) = 0 Then
                                GUICtrlSetData($botlabel, Round($botcounter/(1000/$sleepLen)))
            EndIf
        EndIf
        check4()
EndFunc

Func check4()
        if $check4 then
            If $botcounter = (1000/$sleepLen)*6 Then
            ; Set the back color
                GUICtrlSetBkColor($botlabel, 0xff0000)
                $botcounter = 0
            EndIf
            If Mod($botcounter, (1000/$sleepLen)) = 0 Then
                                GUICtrlSetData($botlabel, Round($botcounter/(1000/$sleepLen)))
            EndIf
        EndIf
EndFunc

Func _Button_Topmost_Clicked()
WinSetOnTop($varWindow,"",1)
EndFunc
 
 Func _Button_Normal_Clicked()
WinSetOnTop($varWindow,"",0)
EndFunc 


 
; Finished!

I know it's not finished but I can't even get numer 2)

please help me  :ermm:

(oh and btw the second code has 2 extra buttons to choose if it should be topmost or not)

Edited by MrBrasta
Link to comment
Share on other sites

Welcome to AutoIt and the forum!

"make a bot for a game". You need to read the forum rules!

Game automation isn't allowed here

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

No, because we now know what you want to use it for.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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