Progress Bar
|
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
|
09-23-2009 21:11
Usually most visual bar indicators have got only two rough steps, empty space or a full block, so what I have done instead is to create a function capable of handling a list of characters to dynamically create a smooth progress bar. And I thought since sharing is caring, I'll give it to others to play with as well. The float input is from 0.0 to 1.0, since there is no error-checking embedded for speed you'll need to be careful to stay within those limits. You can compute the input for the function by taking the intermediary value and dividing by the maximum. For example (Health / Health_Maximum). You can set the amount of characters the bar is made out of which can be equivilant to a 'detail' setting. Have fun: https://wiki.secondlife.com/wiki/Progress_BarFeel free to post any feedback/criticism you had or whatever.
_____________________
 Geometric Library, for all your 3D maths needs. https://wiki.secondlife.com/wiki/Geometric Creator of the Vertical Life Client
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
09-23-2009 21:26
Nice! Good work on researching useful characters for the partial bars. That's the part I would not relish doing. Heh.
|
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
|
09-23-2009 22:19
Thanks! Yes, it was rather painful going through the unicode ranges, especially since my browser didn't display most of them, so I had to copy-paste into the script editor to verify if a character displayed correctly and what it was.
Updated the wiki page, rearranged stuff and added a new much more simplified testing script to get the basic idea, instead of shuffling into the big dev-test script.
Added three new character sets of directional chars, which are not progress bars per say, but you could provide some useful directional indicators. Say for wind direction. I think the directionals might need re-arranging or inputs might need offseting. Currently points north/upwards/forwards at 0.0, goes in a full circle clockwise up to 1.0 where it points to the north west.
_____________________
 Geometric Library, for all your 3D maths needs. https://wiki.secondlife.com/wiki/Geometric Creator of the Vertical Life Client
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
09-24-2009 12:30
Well, it kept me amused.  list Charset_LeftRight = [" ","▏","▎","▍","▌","▋","▊","▉","█"]; float Input; integer Length = 10; string Bars( float Cur, integer Bars, list Charset ) { // Bars routine by Nexii Malthus // Input = 0.0 to 1.0 // Bars = char length of progress bar // Charset = [Blank, < Shades >, Solid]; integer Shades = llGetListLength(Charset)-1; Cur *= Bars; integer Solids = llFloor( Cur ); integer Shade = llRound( (Cur-Solids) * Shades ); integer Blanks = Bars - Solids - 1; string str; while( Solids-- >0 ) str += llList2String( Charset, -1 ); if( Blanks >= 0 ) str += llList2String( Charset, Shade ); while( Blanks-- >0 ) str += llList2String( Charset, 0 ); return str; } default { changed( integer change ) { if (change & CHANGED_TELEPORT) { llSetText("", < 1, 1, 1 >, 1.0); Input = 0.0; llSetTimerEvent(0.1); } }
attach(key attached) { if (attached == NULL_KEY) // object has been detached { llSetText("", < 1, 1, 1 >, 1.0); } else // object has been //attached// { llSetText("", < 1, 1, 1 >, 1.0); Input = 0.0; llSetTimerEvent(0.1); } }
timer() { string Text;
if (Input >= 1.0) { llSetTimerEvent(0.0); llSetText("", < 1, 1, 1 >, 1.0); return; }
integer Percent = llRound(Input * 100); Input += 0.02; if (Input < 1.0) Text = "Loading▕"+ Bars(Input, Length, Charset_LeftRight) + " " + (string)Percent + "%"; else { llSetTimerEvent(5.0); Text = "Loading▕"+ Bars(Input, Length, Charset_LeftRight) + " Complete"; } llSetText(Text, < 1, 1, 1 >, 1.0); } }
Displays a Loading Bar on Attach and following a Teleport. Put it into an invisible prim worn to sit just above the top of your head. Little things. 
|
ab Vanmoer
Registered User
Join date: 28 Nov 2006
Posts: 131
|
09-24-2009 22:26
That is really neat Nexii  Most of my products read configuration notecards while initialising; I think it would be a nice touch to "steal" your code in order to give visual feedback of progress. On the web page you specify the Creative Commons Licence, but you haven't specified what sort of attribution you want.
|
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
|
09-25-2009 08:23
Oh well, I just assume some little common sense, doesn't have to scream all over the place, but something like a little mention in a manual would be cool.
For me it mostly depends on the amount of usage, you can be as creative as you want to be about it, just don't intentionally hide it on purpose.
Another creative way of attribution would be when someone mentions it, For example "Oh those are cool graphics in the hovertext!" "Yeah, it is opensource, you can get it over at https://wiki.secondlife.com/wiki/Progress_Bar"
It is however you want to interpet giving attribution as to mean.
_____________________
 Geometric Library, for all your 3D maths needs. https://wiki.secondlife.com/wiki/Geometric Creator of the Vertical Life Client
|
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
|
09-26-2009 21:23
Added 9 more character sets, ouch, my eyes hurt now  . Won't need to do it again at least. I have basically gone through the entire UTF range  . I feel it might be time to repurpose the page as well, as it is meant to tackle a wide problem associated with using hovertext/chat effectively for alternative display of data visualization. By exploring all the hidden characters embedded deep in the UTF ranges for potential use. The single charsets can also be used inline more easily as well just by using normal list functions  llSay( 0, "Going to "+llList2String(Charset_Num1,Destination-1)+" Floor" ); ( -1 because charset starts at 1, couldn't find the zero equivilants! (Well I did for one charset, but the character wasn't supported by the client)) Say Destination was the 15th floor, output would be like this: Elevator: Going to ⒖ Floor It is a bit of a silly example for chat, but is meant rather as a basic straightforward example.
_____________________
 Geometric Library, for all your 3D maths needs. https://wiki.secondlife.com/wiki/Geometric Creator of the Vertical Life Client
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
09-27-2009 01:17
I hate to be the one to mention this...
Unicode is not as widely supported as you might think. It seems that unicode support varies widely from system to system, depending on which fonts have been installed (and no doubt, OS by OS, and language by language).
I can tell you that on my old WindowsXP install, unicode was only about half supported. While my Vista install does support more of unicode, it doesn't support all the same ones that xp did.
I've found a number of developers "relying" on unicode to make their products usable.. and sometimes it can be a problem. I know that when I attempted to use the arrows in a notecard giving instructions for a vehicle, I received a shock when customers informed me that they couldn't read the manual... I assumed, if I could see the characters, that we ALL could.
I think this is a fine experiment, nbut it should be said that unicode support is NOT universal, so use caution when deciding to integrate it, and try to avoid using unicode as your only method of displaying information.
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
|
09-27-2009 11:35
Hm yes your right, but being on an old computer and Windows XP install myself, I always tend to assume im at the end of the stick of the problem. Is it really different language by language though?
_____________________
 Geometric Library, for all your 3D maths needs. https://wiki.secondlife.com/wiki/Geometric Creator of the Vertical Life Client
|
Domchi Underwood
Registered User
Join date: 4 Aug 2007
Posts: 44
|
09-27-2009 14:03
From: Winter Ventura I hate to be the one to mention this...
Unicode is not as widely supported as you might think. It seems that unicode support varies widely from system to system, depending on which fonts have been installed (and no doubt, OS by OS, and language by language). But SL comes with its own fonts on all platforms, doesn't it? Don't know about alternate viewers though. BTW, very nice progress bars, thanks for sharing them!
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
09-27-2009 14:12
From: Domchi Underwood But SL comes with its own fonts on all platforms, doesn't it? It does include some, but the FontFont Meta LL bundles for proportional text has a very limited character set. The viewer falls back to other platform-specific fonts to fill in the blanks, but you're out of luck if the right ones aren't installed and activated. At some point Meta is supposed to be replaced by DejaVu Sans like some alternative viewers already use, and after that there will be a lot more consistency across platforms. (The monospace font was already changed to DejaVu Sans Mono).
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
09-27-2009 19:34
This is still a valuable exercise, and will deserve revisiting when LL makes changes to the bundled fonts so that unicode is more.. uni-versally supported.
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|