Skip to content

IncProgress

Anthony Headley edited this page Apr 23, 2020 · 1 revision

IncProgress (int:progress_index, int:increment_value) : nil

Brief:

Increments are decrements the progress bar by the increment_value

Paramiters:

Name Type Description Optional
progress_index int Progress bar to affect
increment_value int A Signed integer that specifies the amount to increase or decrease the progress bar by

Returns:

Type Description
nil

Examples:

    -- setup the progress bar
    local progress = StartProgress("Progress")
    SetProgressRange(progress, 1, 100)          -- set the range from 1 to 100, inclusive
    SetProgress(progress, 100)                  -- set the progress to 100
    SetProgressText(progress, " Waiting...")    -- append the " Waiting..." text
    coroutine.yield(1)                          -- wait 1 second
    -- Phase 1
    SetProgressText(progress, " Phase 1")       -- Change the appended text to "Phase 1"
    for i = 1, 50, 1 do                         -- every 0.1 seconds "increment" -1
        IncProgress(progress, -1)        
        coroutine.yield(0.1)
    end
    -- Phase 2
    SetProgressText(progress, " Phase 2")       -- Phase 2
    for i = 1, 25, 1 do                         -- every 0.1 seconds increment 2
        IncProgress(progress, 2)        
        coroutine.yield(0.1)
    end
    -- Phase 3
    SetProgressText(progress, " Phase 3")       -- Phase 3
    SetProgressRange(progress, 1, 1000)          -- set the range from 1 to 1000, inclusive

    for i = 1000, 0, -1 do                       -- directly set the progress to the value of i
        SetProgress(progress, i)
        coroutine.yield(0.01)
    end
    SetProgressText(progress, " Done")          -- Done
    coroutine.yield(1)
    StopProgress(progress)

Also See:

Clone this wiki locally