User:Daemonika Nightfire/Scripts/LinkNumber-List in llSetLinkPrimitiveParamsFast

From Second Life Wiki
Jump to navigation Jump to search

LinkNumber-List in llSetLinkPrimitiveParamsFast

With this small script I want to prove that it is possible in llSetLinkPrimitiveParams the link points to put into a list.

It is especially interesting when multiple prims are a linksets changed. For example, it must not be written for each link number, a new complete llSetLinkPrimitiveParams. When would be a very large number of prims is too much work.

Beispiel

Fuer dieses Beispiel habe ich einfach nur 4 Prims miteinander verlinkt und nur 1 script in den root des Linksets gelegt.

Ich habe mich fuer die touch Variante entschieden damit man beim klicken auch was zu sehen bekommt :)

Viel Spass mit meinem Schnipsel :) <lsl> // LinkNumber-List in llSetLinkPrimitiveParamsFast // 11. Juli 2010 by Daemonika Nightfire

integer s; list prims = ["2","4"]; default {

   touch_start(integer total_number)
   {
       integer i = ~llGetListLength(prims);
       if(s == FALSE)
       {
           while (++i)
           {
               llSetLinkPrimitiveParamsFast(llList2Integer(prims,i),[PRIM_TEXT,"Hovertext",<1,1,1>,1]);
           }
           s = TRUE;
       }
       else
       {
           while (++i)
           {
               llSetLinkPrimitiveParamsFast(llList2Integer(prims,i),[PRIM_TEXT,"",ZERO_VECTOR,0]);
           }
           s = FALSE;
       }
   }

} </lsl>

Erweitertes Beispiel mit 2 Listen im wechsel

Ebenfalls mit 4 Prims. <LSL> // LinkNumber-List in llSetLinkPrimitiveParamsFast // 11. Juli 2010 by Daemonika Nightfire

integer s; list prims = ["1","3"]; list prims2 = ["2","4"]; default {

   touch_start(integer total_number)
   {
       integer i = ~llGetListLength(prims);
       integer i2 = ~llGetListLength(prims2);
       if(s == FALSE)
       {
           while (++i && ++i2)
           {
               llSetLinkPrimitiveParamsFast(llList2Integer(prims,i),[PRIM_TEXT,"test",<1,1,1>,1]);
               llSetLinkPrimitiveParamsFast(llList2Integer(prims2,i2),[PRIM_TEXT,"",ZERO_VECTOR,0]);
           }
           s = TRUE;
       }
       else
       {
           while (++i && ++i2)
           {
               llSetLinkPrimitiveParamsFast(llList2Integer(prims,i),[PRIM_TEXT,"",ZERO_VECTOR,0]);
               llSetLinkPrimitiveParamsFast(llList2Integer(prims2,i2),[PRIM_TEXT,"test",<1,1,1>,1]);
           }
           s = FALSE;
       }
   }

} </LSL>