Jump to content

Multiple Countdown Timers? - (Locked)


Recommended Posts

Hello,

 

I am trying to create a countdown timer as a tracker. I've made the GUI and read all the examples, as well as threads of the same issue but I can't seem to implement it on my code. I can't use multiple countdown timers without using an array and I might not have enough knowledge regarding this. Any help would be appreciated. Thank you.

Following my code:

 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIConstants.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <StatusBarConstants.au3>
#include <WindowsConstants.au3>
#include <INet.au3>
#include <NumCR.au3>
#include <Clipboard.au3>
#include <InetConstants.au3>
#include <WinAPIFiles.au3>
#Include <ScreenCapture.au3>
#Include <Misc.au3>
#include <WinAPISysWin.au3>
#include <GUIConstantsEx.au3>

; -----------------------------------------------------------------------
; --- M A I N   P R O G R A M --- I N I T I A L I Z A T I O N
; -----------------------------------------------------------------------



; Main Window
Global $GUI_NAME = "MvP Tracker"
$mainwindow = GUICreate($GUI_NAME, 1290, 768)

GUICtrlCreateLabel("Track MvP/Mini Bosses using this tool.", 10, 10)
GUICtrlCreateLabel("Click the button when the Boss dies and it'll give you an average spawn time.", 10, 24)

Global $mvp_timer = 165 ;minutes for countdown
Global $mini_timer = 105 ;minutes for countdown
Global $seconds = $mvp_timer * 60 ;convert to seconds
Global $seconds_mini = $mini_timer * 60 ;convert to seconds

; MvP Images
$Mistress = GUICtrlCreatePic('', 10, 100, 150, 100)
$Phreeoni = GUICtrlCreatePic('', 170, 100, 150, 100)
$Kraken = GUICtrlCreatePic('', 330, 100, 150, 100)
$Eddga = GUICtrlCreatePic('', 490, 100, 150, 100)
$Maya = GUICtrlCreatePic('', 650, 100, 150, 100)
$OrcHero = GUICtrlCreatePic('', 810, 100, 150, 100)
$Pharaoh = GUICtrlCreatePic('', 970, 100, 150, 100)
$OrcLord = GUICtrlCreatePic('', 1130, 100, 150, 100)

; Mini Images
$Eclipse = GUICtrlCreatePic('', 10, 400, 150, 100)
$DragonFly = GUICtrlCreatePic('', 170, 400, 150, 100)
$Mastering = GUICtrlCreatePic('', 330, 400, 150, 100)
$Ghostring = GUICtrlCreatePic('', 490, 400, 150, 100)
$Dramoh = GUICtrlCreatePic('', 650, 400, 150, 100)
$Toad = GUICtrlCreatePic('', 810, 400, 150, 100)
$Angeling = GUICtrlCreatePic('', 970, 400, 150, 100)
$Deviling = GUICtrlCreatePic('', 1130, 400, 150, 100)

; Mvp Timers
$b_Mistress = GUICtrlCreateButton("Start", 30, 205, 100, 21)
$Mistress_timer = GUICtrlCreateLabel("00:00:00", 60, 230, 97, 21)

$b_Phreeoni = GUICtrlCreateButton("Start", 200, 205, 100, 21)
$Phreeoni_timer = GUICtrlCreateLabel("00:00:00", 230, 230, 97, 21)

GUICtrlSetImage($Mistress, @ScriptDir & "\resources" & '\Mistress.bmp')
GUICtrlSetImage($Phreeoni, @ScriptDir & "\resources" & '\Phreeoni.bmp')
GUICtrlSetImage($Kraken, @ScriptDir & "\resources" & '\Kraken.bmp')
GUICtrlSetImage($Eddga, @ScriptDir & "\resources" & '\Eddga.bmp')
GUICtrlSetImage($Maya, @ScriptDir & "\resources" & '\Maya.bmp')
GUICtrlSetImage($OrcHero, @ScriptDir & "\resources" & '\OrcHero.bmp')
GUICtrlSetImage($Pharaoh, @ScriptDir & "\resources" & '\Pharaoh.bmp')
GUICtrlSetImage($OrcLord, @ScriptDir & "\resources" & '\OrcLord.bmp')

GUICtrlSetImage($Eclipse, @ScriptDir & "\resources" & '\Eclipse.bmp')
GUICtrlSetImage($DragonFly, @ScriptDir & "\resources" & '\DragonFly.bmp')
GUICtrlSetImage($Mastering, @ScriptDir & "\resources" & '\Mastering.bmp')
GUICtrlSetImage($Ghostring, @ScriptDir & "\resources" & '\Ghostring.bmp')
GUICtrlSetImage($Dramoh, @ScriptDir & "\resources" & '\Dramoh.bmp')
GUICtrlSetImage($Toad, @ScriptDir & "\resources" & '\Toad.bmp')
GUICtrlSetImage($Angeling, @ScriptDir & "\resources" & '\Angeling.bmp')
GUICtrlSetImage($Deviling, @ScriptDir & "\resources" & '\Deviling.bmp')
Global $sec, $min, $hr
Global $rand_time = Random(1, 30, 1)
Global $sec = Mod($seconds, 60)
Global $min = Mod($seconds / 60, 60)
Global $hr = Floor($seconds / 60 ^ 2)   

Func Mistress_timer()
    ;Local $sec, $min, $hr
    ;Local $rand_time = Random(1, 30, 1)
    $sec = Mod($seconds, 60)
    $min = Mod($seconds / 60, 60)
    $hr = Floor($seconds / 60 ^ 2)
    GUICtrlSetData($Mistress_timer, StringFormat("%02i:%02i:%02i", $hr, $ran_min, $sec))
    If $seconds <= 0 Then
        ; place spawned announcement here
        AdlibUnRegister("Mistress_timer")
        MsgBox(0, "Information", "Countdown reached 00:00:00")
        Exit
    EndIf
    $seconds -= 1
EndFunc

Func Phreeoni_timer()
    ;Local $sec, $min, $hr
    $sec = Mod($seconds, 60)
    $min = Mod($seconds / 60, 60)
    $hr = Floor($seconds / 60 ^ 2)
    GUICtrlSetData($Phreeoni_timer, StringFormat("%02i:%02i:%02i", $hr, $ran_min, $sec))
    If $seconds <= 0 Then
        AdlibUnRegister("Phreeoni_timer")
        MsgBox(0, "Information", "Countdown reached 00:00:00")
        Exit
    EndIf
    $seconds -= 1
EndFunc









; Idle loop
While 1
    GUISetState(@SW_SHOW, $mainwindow)
    $nMsg = GUIGetMsg()
    Sleep(20)
    Switch $nMsg
    
        Case $GUI_EVENT_CLOSE
            AdlibUnregister()
            Exit
        Case $b_Mistress
            $ran_min = $min + $rand_time
            Mistress_timer()
            ;AdlibRegister("Mistress_timer", 1000)
        Case $b_Phreeoni
            $ran_min = $min + $rand_time
            Phreeoni_timer()
            ;AdlibRegister("Phreeoni_timer", 1000)
    EndSwitch
WEnd

 

Link to comment
Share on other sites

  • Developers

Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - 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.

See you soon with a legitimate question I hope.

The Moderation team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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