Running multiple progress bars simultaneously Topic is solved

Ask gaming related questions
Celery3422
Posts: 2
Joined: 27 Dec 2023, 00:42

Running multiple progress bars simultaneously

27 Dec 2023, 00:55

Hello! Writing a cooldown script for a game that does not have one. I can use one progress bar just fine, but when I use another while the first is running, the previous one pauses and the next one runs. I'd like for all of the progress bars to run when activated and continue to run even after another starts. Thank you!

Code: Select all

MyGui := Gui()
MyGui.Show
MyGui.BackColor := "EEAA99"
WinSetTransColor("EEAA99", MyGui)
MyGui.Opt("-Caption +AlwaysOnTop")
MyGui.Move(446, 782, 900, 900)

Skill := []
SkillProgress := []

; create progress bars
Loop 10 {
    ProgressBar := MyGui.AddProgress("w60 h5 cFFFFFF Background000001 vTempVar", 100)
    Skill.Push(ProgressBar)
    Skill[A_Index].Name := A_Index
    Skill[A_Index].Move(0 + 65 * (A_Index - 1), 5)
    SkillProgress.Push(MyGui["" A_Index])
}

; updates progress bars
SkillUsed(x) {
    SkillProgress[x].Value := 0
    Loop {
        if SkillProgress[x].Value > 100
            break
        SkillProgress[x].Value += 1
        Sleep 100
    }
}

; skills
e:: {
    SkillUsed(1)
}

r:: {
    SkillUsed(2)
}
niCode
Posts: 335
Joined: 17 Oct 2022, 22:09

Re: Running multiple progress bars simultaneously  Topic is solved

27 Dec 2023, 06:49

This seemed to work for me:

Code: Select all

MyGui := Gui()
MyGui.Show
MyGui.BackColor := "EEAA99"
WinSetTransColor("EEAA99", MyGui)
MyGui.Opt("-Caption +AlwaysOnTop")
MyGui.Move(446, 782, 900, 900)

Skill := []
SkillProgress := []

; create progress bars
Loop 10 {
    ProgressBar := MyGui.AddProgress("w60 h5 cFFFFFF Background000001 vTempVar", 0)
    Skill.Push(ProgressBar)
    Skill[A_Index].Name := A_Index
    Skill[A_Index].Move(0 + 65 * (A_Index - 1), 5)
    SkillProgress.Push(MyGui["" A_Index])
}

SkillUsed(x) {
    if SkillProgress[x].Value > 0
        return
    SetTimer(FillProgressBar, 100)

    FillProgressBar() {
        SkillProgress[x].Value += 1
        if SkillProgress[x].Value >= 100 {
            SetTimer(, 0)
            SkillProgress[x].Value := 0
        }
    }
}

; skills
e::SkillUsed(1)
r::SkillUsed(2)
Celery3422
Posts: 2
Joined: 27 Dec 2023, 00:42

Re: Running multiple progress bars simultaneously

30 Dec 2023, 02:41

Ah thank you, works perfectly!
I don't really understand how SetTimer runs them at the same time though, but thanks again

Return to “Gaming Help (v2)”

Who is online

Users browsing this forum: vanove and 8 guests