Sign in to follow this  
Followers 0
MrBrasta

I need some help with my code

7 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



Game bot is forbidden in this forum. Read the forum rules :)

I dont think you will get help here for this

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

oh sorry , my bad, would it be oke if i delete de bot part but still want the timer ?

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

:idiot: :idiot: :idiot:

Share this post


Link to post
Share on other sites

oke, you can close/delete this topic then, (i tried but can't) :(

Share this post


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