-
-
Notifications
You must be signed in to change notification settings - Fork 5
SetProgressRange
Anthony Headley edited this page Apr 23, 2020
·
1 revision
Sets the progress bar range from minimum to maximum, inclusive.
Name | Type | Description | Optional |
---|---|---|---|
progress_index | int | Progress bar to affect | |
minimum | int | a signed integer specifing the left side of the progress bar | |
maximum | int | a signed integer specifing the right side of the progress bar |
Type | Description |
---|---|
nil |
-- 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)