This script is for a progress bar. It is relatively simple to use.
To use this create a sphere. change the Dimple setting to 0.5 B. Now switch back to box. This should result in a Half-Box. Now insert the following code into your box.
Now to work the script just name the PRIM 'progress' or 'bar'...something simple to remember. To have it work the magic simple call up llMessageLinked() with the name of the PRIM for the string and the percentage for the LinkNum.
The following should make the progress bar set to 50%. Be creative now and place a texture behind it with the percentage markings. This will add a nice touch to vendors and renters. Have fun!
Questions or comments are welcome.
CODE
llMessageLinked(LINK_SET, 50, "Name of PRIM", NULL_KEY);
CODE
float full = 3.175; // This is the size of you progress bar when at 100%
float fInc; // This will be used to hold the calculated percentage increments
default
{
state_entry()
{
fInc = full / 100; // Calculate increments in scale by 1%
}
link_message(integer snum, integer num, string msg, key id)
{
if(llToLower(msg) == llToLower(llGetObjectName())) // Check for call
{
if(num < 0) num = 0; // Make sure value is valid
else if(num > 100) num = 100;// ditto
float fScale = (fInc * num) + 0.01; // Ensure we are valid in size
vector vNew = llGetScale(); // Get original scale
llSetScale(<vNew.x, vNew.y, fScale>); // Set new scale
}
}
}