AS Sculpt Map Swap

From Second Life Wiki
Revision as of 10:37, 18 June 2012 by Silent Mole (talk | contribs) (Created page with "<lsl> →‎Swap the sculpt map shown on the prim in the linkset named "BODY": // Looping order of the sculpt maps. list MAPS = [ "MAP1", "MAP2", "MAP3" ]; // internal value…")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<lsl>

/*

 Swap the sculpt map shown on the prim
 in the linkset named "BODY"
  • /

// Looping order of the sculpt maps. list MAPS = [ "MAP1", "MAP2", "MAP3" ]; // internal values integer current_map = 0; integer LinkID = 0;

integer Linked(string Needle) {

   integer Prims = llGetNumberOfPrims()+1;
   while(--Prims) if(llGetLinkName(Prims) == Needle) return Prims;
   return 0;

}

default {

   state_entry() {
       LinkID = Linked( "BODY" );
       llSetTimerEvent( 1.0 );
   }
   
   timer() {
       if ( current_map >= llGetListLength(MAPS) ) current_map = 0;
       
       llSetLinkPrimitiveParamsFast( LinkID, 
                                     [PRIM_TYPE, PRIM_TYPE_SCULPT, 
                                     llList2String(MAPS,current_map), 
                                     PRIM_SCULPT_TYPE_SPHERE] );
       
       ++current_map;
   }

}

</lsl>