Jump to content

Scripting Question


Tiara Jarrico
 Share

You are about to reply to a thread that has been inactive for 4052 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'm looking for a particular script or help in writing the code for it.... 

The scripts function is to basically count how many times its been rezzed (by being worn and/or drug out), but for the creator to limit the number of times the object is able to be rezzed and then delete when the limit is reached.

For example... if I had a prim object that could only be rezzed 3 times, the object would count how many times its been rezzed in local chat ("blah has 2 uses left") and on the 4th time of being rezzed it would instantly "poof" delete ("blah has 0 uses left & will delete").

I've tried to search for this but I'm not even sure what key words to use and have had no luck so far :o( ..

Thanks for reading and hope someone can help!  

Link to comment
Share on other sites

integer max = 3;integer count = 0;default{   on_rez(integer param)   {      count++;      if (count == max){        llOwnerSay("blah has 0 uses left & will delete");        llDie();      } else {        integer remaining = max - count;        llOwnerSay("blah has " + remaining + " uses left");      }   }}

 

Link to comment
Share on other sites

It complicates things that being worn counts as a rezzing because it's impossible to delete a worn attachment (except temporary attachments), and it will continue to be wearable from inventory no matter what any script does. Instead, the script will need to render the thing useless, perhaps by shrinking it down to nothing, changing its name to "delete me", deleting all object contents except maybe the script itself which might go into some trivially useless state that only issues "Please delete me" via llRegionSay() to DEBUG_CHANNEL.

Also, it seems if you're going to the trouble to make it delete itself, you'll want to make it no-copy (so you'll want to test it with an alt, so the next-owner perms apply). And you'll probably want it to be no-mod so the deletion script can't simply be removed.

If the count has to be really precise, that's a further complication, in which case you'll need to llTakeControls() so the thing can run on no-script land. (Well, technically, keep running on no-script land.)

Finally, it's worth noting that each login while wearing the object will count as a new rezzing; if that's a problem, might leverage the fact that the attach() event doesn't fire on logout, but does when an object is actually detached.

Link to comment
Share on other sites

That code won't compile...


outtaspace wrote:

integer max = 3;integer count = 0;default{   on_rez(integer param)   {      integer count++;      if (count == max){        llOwnerSay("blah has 0 uses left & will delete");        llDie();      } else {        integer remaining = max - count;        llOwnerSay("blah has " + remaining + " uses left");      }   }}

 

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4052 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...