Jump to content
Sign in to follow this  
Tiara Jarrico

Scripting Question

You are about to reply to a thread that has been inactive for 2669 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!  

Share this post


Link to post
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");      }   }}

 

Share this post


Link to post
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.

Share this post


Link to post
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");      }   }}

 

 

Share this post


Link to post
Share on other sites

If rezzed on a no script parcel (below 75m) the scripts will not run. TakeControls doesn't matter. If you leave the zone scripts will continue to run. (that's very probable in case of an attachment)

As said before, a no copy / no mod object is required.

 

Share this post


Link to post
Share on other sites

llDetachFromAvatar() on attach event will do the trick. My demos can be worn only once; if rezzed on the ground they die.

Share this post


Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 2669 days.

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

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...