Jump to content
  • 0

resObject iteration limit?


InBeTwine Exonar
 Share

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

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

Question

Hi folks,

I have created a simple prim (Water Platform 1) that will rez another simple prim (Water Platform 2) when touched and then die. Platform 1, when touched, will rez Platform 2 and then die. Each of the Platforms contains the other platform in its inventory. This works fine for only the first two times - on the third time Platform 2 seems to lose Platform 1 from its inventory and sends an error message that it cannot find Platform 1.

 

Platform 1 script:

default
{
    state_entry()
    {
        llSetText("Touch to Switch Targets", <0.0,1.0,0.0>, 1);
    }
    
    touch_start(integer total_number)
    {
        llRezObject("Water Platform 2", llGetPos()+<0,4,0>,ZERO_VECTOR,ZERO_ROTATION,0); // the rez object is contained in this object's inventory
        llDie();
    }
}

 

Platform 2 script

default
{
    state_entry()
    {
        llSetText("Touch to Switch Targets", <0.0,1.0,0.0>, 1);
    }
    
    touch_start(integer total_number)
    {
        llRezObject("Water Platform 1", llGetPos()-<0,4,0>,ZERO_VECTOR,ZERO_ROTATION,0); // the rez object is contained in this object's inventory
        llDie();
    }
}

 

Any ideas?

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Are both platforms copiable?  If not, when you rez one it's not in your inventory any more.  Make it llDie() and it's gone forever.

No, wait... Scratch that...  You can't do that.  Suppose you rez platform 1.  It has the script and a copy of platform 2 in it.  You click it and rez platform 2, but THAT platform 2 doesn't have a copy of platform 1 and another platform 2 in it.  To make this work, you'd need to have an infinite stack of pre-filled versions of both platforms, all nested like Russian dolls.  Your only alternative is to combine your scripts into one master script and put it into a third object that will rez either platform on command.

Link to comment
Share on other sites

  • 0

You will probably want to take this to Forums > LSL Scripting where we can discuss it more fully (Answers is meant to be simple Q&A and nothing about scripts is ever simple 8~0 )

That said - this is a recursive thing.  A1 contains B1.  B1 contans A2 <- NOT A1, but a copy of it.  Does A2 contain B2?  If it does, then does B2 contain A3, contain B3 ... Bn contain An?

Obviously not, because you can't keep nesting things like that forever and it's pointless doing it for anything but a couple of levels.  What you do instead for self/circular-replicating items is:

  • A1 contains B1 and (A2 which also contains B1) <- so in effect A1 and A2 are identical
  • A1 rezzes B1
  • A1 gives A2 to B1 using llGiveInventory()
  • B1 now has a fully-functional copy of A
  • B1 rezzes A2
  • A2 is identical to A1 so return to start and loop indefinitely

ETA: Rezzing objects is also throttled to prevent infinite replication "the gray goo fence" but I can't find the information about that at the moment - expect more in the scripting forum.

Link to comment
Share on other sites

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