Jump to content
Sign in to follow this  
Wandering Soulstar

LI Count and Scripts

Recommended Posts

Not quite certain which forum this should go in .. here or Scripts .. bu figured I'd drop it here, and cross link to the Scripting forum .. if that is incorrect please let me know and I'll clean up. Post in Scripting Forum

Hi all!

Am getting, what I am sure is 'correct' behavior and was hoping someone could point me to an easy work around. The situation is as follows:

  • Have a pair of prims (convex hull) linked ... so 1 Li
  • Add one script, still 1 Li, add a second script, still 1 Li, add a third, now 2 Li
  • Remove one script, (so two total in object), still 2 Li
  • Have to remove a second (so leaving only one) to get to 1 Li
  • and now back to the top, add second and still only 1 Li

Note: The scripts being added and removed are very very light, and have tried with different combos of script sizes and still the same.

So I need to know if there is anyway to get the object back to it's 1 Li weight that does not involve deleting the second script. As my current system is set up, the object rezzes, third script does some stuff .. then enables the other two and kills itself. If not I'll have to change my system.

Thanks!

Wanda

 

 

Edited by Wandering Soulstar

Share this post


Link to post
Share on other sites

If scripts influence the land impact, the LI is determined by the item's server weight and it's fairly easy to calculate: Each part of the linkset (prim, mesh or sculpt) adds 0.5 to the server weight, each active script will add somewhere between 0.2 and 0.3 (I can't remember exactly how much).

There's no room for tweaking there and I'm afraid the only way to reduce LI is to reduce the number of parts or scipts in the linkset.

  • Thanks 1

Share this post


Link to post
Share on other sites

Appreciate the response Chin, but the problem (which I likely did not explain properly) is that the Li goes up to 2Li when the third script is added, but does not go back down to 1Li until both the third and second are removed. 

Share this post


Link to post
Share on other sites
1 hour ago, Wandering Soulstar said:

Appreciate the response Chin, but the problem (which I likely did not explain properly) is that the Li goes up to 2Li when the third script is added, but does not go back down to 1Li until both the third and second are removed. 

That's interesting.

It may be your viewer simply fails to update the LI calculation when you remove one script. Try to take the item into your inventory and re-rez it and see if that solves the problem. If so, there's nothing to worry about, the server will get the LI right and that is what counts.

But with two scripts the land impact will be almost exactly 1.5. If the land impact isn't calculated from scratch when a script deletes itself, it is possible that a minute rounding error is enough to tip the weight calculation slightly above or below that magic point. If that is the case, the only solution is to see if you can manage with only two scripts, or maybe even better with a single one.

I don't know what kind of scripts it is of course but my immediate thought is that this may be one of the rare occasions when lsl's all but forgotten state feautre may be useful.

Edited by ChinRey

Share this post


Link to post
Share on other sites

Thanks Chin.

Tried taking it into inven and re-rezzing and still staying at 2 Li, both in the object edit window as well as in the Land About - Objects tab

Have done a number of tests and it definitely is some overall 'glitch' that can easily be reproduced:

  1. Create two simple prims, setting to Convex-Hull and then linking them
  2. LI  shown as 1
  3. In the object edit add one default script
  4. Li remains 1
  5. Add a second default script
  6. Li remains 1
  7. Add a third default script
  8. Li now is 2
  9. Remove one script
  10. Li remains 2
  11. remove a second script
  12. Li now one
  13. Go back to step 5

Have had to take the two down to one, using States, which I use regularly ?, was not an option for a number of reasons, but have the two condensed successfully to one.

 

Share this post


Link to post
Share on other sites

And just realised that my problem is not as easily solved as combining the two of my scripts together. This prim-set is part of an overall build, and there are 10 of them. The problem is that I want to put them into a  rez-fauz package. To do that I need to add in the rez-fauz script, which will then delete itself after the build has been rezzed in place .. but leaving all 10 of the prim-sets at 2 Li each instead of 1 Li each ?

  • Sad 1

Share this post


Link to post
Share on other sites

Further 'weird' results. With the two scripts in the prim-set and weighing 1 Li:

  • Change the properties of one of the scripts (i.e. mod/copy/trans) and goes to 2 Li
  • Interact with one of the scripts (touch event), and goes to 2 Li
  • look at it funny ... 2 Li

<sigh>

Share this post


Link to post
Share on other sites
2 hours ago, Wandering Soulstar said:

Change the properties of one of the scripts (i.e. mod/copy/trans) and goes to 2 Li

Which properties?

Share this post


Link to post
Share on other sites
2 hours ago, Wandering Soulstar said:

Further 'weird' results. With the two scripts in the prim-set and weighing 1 Li:

  • Change the properties of one of the scripts (i.e. mod/copy/trans) and goes to 2 Li
  • Interact with one of the scripts (touch event), and goes to 2 Li
  • look at it funny ... 2 Li

It's a rounding error then. Do something that forces the weight to be recalculated from scratch and the problem is corrected.

It goes something like this:

2 prims + 2 scripts = 0.5*2 + 0.24999*2 = 1.4998 - rounded down to 1

2 prims + 3 scripts = 0.5*2 + 0.24999*3 = 1.74997 - rounded up first to 1.75 then to 2

2 prims + 3 scripts - 1 script = 1.75 - 0.24999 = 1.5001 - rounded up to 2

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, Love Zhaoying said:

Which properties?

Any property ..  immaterial which

57 minutes ago, ChinRey said:

It's a rounding error then. Do something that forces the weight to be recalculated from scratch and the problem is corrected.

Actually it is not as simple as that under closer inspection.

  1. Starting from scratch as above, two prims with ConvexHull set, linked.
  2. General Li 1, and at detail Server at 1.0
  3. Add two default Scripts, General Li 1 and Server 1.3
  4. Touch to execute the two touch events. General 1 and Server now 1.5
  5. take to inven and then rez. General 2 and Server 1.5
  6. repeat steps 1 to 3
  7. In Object content click permissions and remove one (does not matter which ), General now 1 and Server 1.5

So it seems that executing an event in the scripts increases the server weight ... as does changing the permissions.

Share this post


Link to post
Share on other sites

It's floting point math and no bug.

1.5 + 0.5 = 2.0 yes? not quite 
Decimal round numbers do not match binary numbers. So a round decimal number is not a round number when converted to binary format. If you typecast it back to decimal it is not the same number anymore.

1.5 + 0.5 = something close to 2.0

subtracting the 0.5 means you subtract 0.5 from a number that isn't exactly 2.0 and the result is something close to 1.5

Repeat adding and subtracting 1000 times and you may even get a visible difference (if the errors don't compensate each other but accumulate)

If I compare floats in a script I always think twice what exactly am I doing here.

 

In this case the result is out of your scope and you have to live with it.

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Nova .. the rounding part I understand, and is the result of going to three scripts and then back to two. That problem was supposed to be resolved by only having two scripts, from the start. But I now see what it is .. actually with two scripts it is going to normally be Li 2. What I mentioned above about things happening when you executed events, or changed script properties was really in the end just the system finally realising that it had two scripts .. pushing the server to 1.5 .. and thus to 2 Li.

So in short, a joined pair of convex-hull prims, with two scripts in one of them .. will be 2 Li ... and that is just the way things are <sigh>.

Share this post


Link to post
Share on other sites
1 hour ago, Nova Convair said:

It's floting point math and no bug.

A piece of nostalgia for computer old-timers: https://en.wikipedia.org/wiki/Pentium_FDIV_bug

 

1 hour ago, Wandering Soulstar said:

So in short, a joined pair of convex-hull prims, with two scripts in one of them .. will be 2 Li ... and that is just the way things are <sigh>.

Yes, it seems the weight calculated for each script is exactly 2.5 after all. It's jsut that the number aren't always updated when you add a script.

There's one thing I copletely forgot about, the script weight is capped to the number of prims in the linkset. So that third script never added anything to the calculated weight at all, it jsut forced an update of the figures.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...