Jump to content

Show linked set


Ayane Philly
 Share

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

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

Recommended Posts

In the state_entry event..

1. Get the number of prims in the linkset with llGetNumberOfPrims.

2. Start a loop that repeats for each prim.

3. During each loop, use llSetLinkAlpha to make a prim visible. 

Also make sure that the object is invisible before you rez it. 

Edited by Wulfie Reanimator
  • Like 1
Link to comment
Share on other sites

Yes, a loop, as in ....

 

timer()
{
    iCount = (++iCount)%(llGetNumberOfPrims() + 1);  // Assuming that iCount is a global integer variable
    if (iCount == 0)
    {
        llSetLinkAlpha(LINK_SET, 0.0,ALL_SIDES);
     }
     else
     {
          llSetLinkAlpha(iCount,1.0,ALL_SIDES);
     }
}

    

  • Like 1
Link to comment
Share on other sites

Three ways of doing loops (generally it's a matter of personal preference which people use):

http://wiki.secondlife.com/wiki/Do_while

http://wiki.secondlife.com/wiki/For

http://wiki.secondlife.com/wiki/While

Also, this might be helpful (shame the formatting is shot and we can't get in to edit it):  http://wiki.secondlife.com/wiki/User:Kireji_Haiku/How_to_deal_with_lists_in_LSL

Link to comment
Share on other sites

6 hours ago, Innula Zenovka said:

Also, this might be helpful (shame the formatting is shot and we can't get in to edit it):  http://wiki.secondlife.com/wiki/User:Kireji_Haiku/How_to_deal_with_lists_in_LSL

Also some of the examples are not efficient when they call llGetListLength() via for loop condition input instead of assigning it to a local prior and referencing it for condition input every increment instead. Using it as an initializer is fine of course.

Some will probably just argue preference there too, though.

Edited by Lucia Nightfire
  • Like 2
Link to comment
Share on other sites

an example you can test with...

integer count = 1;
integer prims;
default
{
    state_entry()
    { 
    }
    on_rez(integer param)
    {  llSetLinkAlpha(LINK_SET, 0.0,ALL_SIDES);      
       prims = llGetNumberOfPrims();
       llSetTimerEvent( 0.5);
    }
    timer()
    {  llSetLinkAlpha(count, 1.0,ALL_SIDES);
       count++;
        if( count == prims)
        { llSetTimerEvent( 0.0 );
        }     
       llSetTimerEvent(2.0 );
    }
}

 

Link to comment
Share on other sites

The timer event looks wrong to me, since I think that the way it's written, as soon as you turn the timer event off, you turn it straight back on again.

Since the timer event will continue to fire until you turn it off, there's no need to keep calling llSetTimerEvent in the timer, so I'd simply say

    timer()
    {  llSetLinkAlpha(count, 1.0,ALL_SIDES);

        if( ++count == prims)
        { 
		llSetTimerEvent( 0.0 );
        }     
    }

 

Edited by Innula Zenovka
  • Like 1
Link to comment
Share on other sites

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