I've seen this code from an old 2012 thread, and all the ones who reply act like SetMin/SetMax is actually normal for DProgress... wat?
[lua]local myProgressBar = vgui.Create( "DProgressBar" , DermaPanel)
myProgressBar:SetSize( 150, 40 )
myProgressBar:SetPos( 25, 25 )
myProgressBar:SetMin( 0 )
myProgressBar:SetMax(200)
myProgressBar:SetValue(bum) -- this is the "propamount" being displayed.[/lua]
Why cant [b]I[/b] set the min/max for stuff and set the value? It is horribly inconvenient for it to have to be on a scale of 0 to 1 and it is incompatible with most variables.
i would guess it could be something to do with a progress bar being a human readable way of saying "is this thing loaded" (sort of) and when it's 100% it's basically saying yes it's true that this is loaded thus the 1, though that's somewhat irrelevant when you can set you're own min/max so idk
it makes sense in my head anyway
(value-min) / (max-min)
-snip-
[QUOTE=Robotboy655;46126392](value-min) / (max-min)[/QUOTE]
What is that supposed to mean?
[QUOTE=RonanZer0;46126337]
Why cant [b]I[/b] set the min/max for stuff and set the value? It is horribly inconvenient for it to have to be on a scale of 0 to 1 and [B]it is incompatible with most variables.[/B][/QUOTE]
It's called like grade 7 math.
Ever converted a number to percentage?
let's say you have 50 out of 60, and want it between 0 and 1
just do 50/60!
= 0.83333333333333333333333333333333
set that as the value!
MAGIC!
[QUOTE=AnonTakesOver;46126848]It's called like grade 7 math.
Ever converted a number to percentage?
let's say you have 50 out of 60, and want it between 0 and 1
just do 50/60!
= 0.83333333333333333333333333333333
set that as the value!
MAGIC![/QUOTE]
My bad, I forgot that you can modify values in function.
Sorry, you need to Log In to post a reply to this thread.