PDA

View Full Version : Progress Bar in Layout



xchrisx
07-24-2008, 11:40 AM
I have coded a progress bar in modeler several times, however I would like to make one for a layout lscript. currently im trying to get away with using the info commands (lucky for me i have my alert level set to Low), but this is exactly what im trying to avoid. I dont want anyone using my script with the High alert level running my script on 1000 objects at once for example and having to press OK for each one. can anyone shed some light on this? i have tried searching the forums but the word "bar" is too short to search for on many of the forums.

thanks
-c

Lightwolf
07-24-2008, 12:33 PM
From the LScript V2.7 release notes:


Scripts can now use the StatusMsg() CS command (added to LightWave 8). This command allows a script to display a message in Layout's "tooltip" area on the main interface without requiring any user interaction (e.g., pressing a button to dismiss a dialog box).
In addition, the text message you provide can be prefaced by a meta-character sequence consisting of a floating point value between 0.0 and 1.0, enclosed within curly braces. If this value is present, it will cause the message displayed to have a background progress bar drawn as well.
For example:

"{.25}Loading object..."

This message would be displayed with 25% of the text background in a different color. By repeatedly calling StatusMsg() with an increasing value in this area, your script can animate a progress status bar along with the message.


generic
{
for(x = 1;x <= 100;x++)
{
StatusMsg("{" + x/100.0 + "}This is a test");
sleep(100);
}
StatusMsg("Done!");
}
Cheers,
Mike

xchrisx
07-24-2008, 03:23 PM
awesome! thanks a bunch Lightwolf, ill try it as soon as i get home. Gotta hunt through these forums and see if i can find the rest of those release notes.

Lightwolf
07-24-2008, 03:26 PM
awesome! thanks a bunch Lightwolf, ill try it as soon as i get home. Gotta hunt through these forums and see if i can find the rest of those release notes.
They are a part of the SDK, if you unzip it they ought to be in: "SDK\html\lscript".

Cheers,
Mike

walfridson
08-01-2008, 03:01 PM
Been using StatusMsg recently and have discovered a strange behaviour.

@script generic
@name "info"
@warnings
generic
{
StatusMsg("{" + 1.0 + "}Recording ON");
}

I've added a menu button to this script.
When launching the script I get what I want first. Then when moving the mouse cursor over a menu item I get the result shown below
http://walen.se/statusmsg.jpg

Help or bug?

Lightwolf
08-01-2008, 03:43 PM
Help or bug?
Hm, it looks like a bug to me...

Cheers,
Mike

walfridson
08-01-2008, 03:59 PM
Done.