Project: SFPoser Animation Controller

Back to project

File name: 4. SFposer encoder for SETPRIM shortcodes
Code: View Raw Code
// Use this script  to generate the SETPRIM{} or SETPARTICLE{} shortcode
// See state_entry for instructions!

string encodeList(list lst)
{
    list aux;
    integer i;
    for (i=0; i < llGetListLength(lst); i++)
    {
        integer tp = llGetListEntryType(lst,i);
        if (tp== TYPE_INTEGER)  aux += "I"; 
        else if (tp== TYPE_VECTOR)  aux += "V"; 
        else if (tp== TYPE_ROTATION)  aux += "R"; 
        else if (tp== TYPE_KEY)  aux += "K"; 
        else if (tp== TYPE_FLOAT)  aux += "F"; 
        else aux += "S"; 
        aux += llList2String(lst, i);
    }
    return llDumpList2String(aux, ";"); 
}



default
{
    state_entry()
    {

        // Enter the *name* of your prim here
        string MYPRIMNAME="My Prim";
        
        // Replace the content of MYLIST with the list you would use for llSetPrimitiveParams() or llParticleSystem() and then save the script
        list MYLIST = [PRIM_GLOW, ALL_SIDES, 0.5, PRIM_COLOR, ALL_SIDES, <0,1,1>, 1.0 ];
        
        
        

        /// If this is a particle emitter, replace SETPRIM with SETPARTICLES in the following line 
        llSay(0, "Your shortcode is:\nSETPRIM{" +MYPRIMNAME+"; "+encodeList(MYLIST)+"} ");
    }
}