Plug-Ins: Difference between revisions

From CasperTech Wiki
Jump to navigation Jump to search
No edit summary
m (Ruthven willenov moved page Category:Plug-Ins to Plug-Ins)
 
(One intermediate revision by the same user not shown)
(No difference)

Latest revision as of 23:28, 31 May 2017

Examples on this page are not officially supported or maintained by CasperTech
CasperTech reserves the right to NOT offer technical assistance for products or units which have been significantly altered.
CasperTech does NOT offer assistance with customizations or alterations.

Get Your Stuff Listed Here

Want your plug-in added? Send Ruthven Willenov a message and any necessary scripts,notecards, textures, etc with instructions how to use it and he will test it and list it as soon as possible

Animated Texture on Main Panel

This script programmed with the notecard will animate the textures on the main panel with a multi-frame texture. As written, it only supports ANIM_ON|LOOP type animations, and does not use any of the other animate texture styles such as: Rotate, Reverse, Ping Pong,Smooth,or Scale You should have knowledge of how to create/use animated textures in order to program this script NOTE Some vendors have a texture offset on the main panel in order to display the non-animated texture correctly. Animated textures will not display correctly on these vendors.

1.Drop the below script into the vendor you wish to use animated textures on. 2.Change the link and face number in the globals to the appropriate numbers for the main panel 3.Save the script 4.Create a notecard named "Texture Config" (without quotes), or if you want to name it something different, change the name in the script to match Each line should be written with the following info for each animated texture, separated by a comma or pipe character:

Original Texture UUID, Animated Texture UUID,SizeX,SizeY,Start Frame,End Frame,Frames per Second
  Original Texture UUID (This is the texture you use for the product listing. The vendor sends a link message with this UUID when it changes the displayed item)
  Animated Texture UUID(This is the texture you want to change to when you want it to animate. It can be the same as the original uuid, 
    or can also be a name instead of a uuid if the texture is dropped into the vendor with the script)
  SizeX(This is the number of frames the animated texture has horizontally)
  SizeY(This is the number of frames the animated texture has virtically)
  Start Frame(This is the index number of the frame you want to start the animation with)
  End Frame(This is the index number of the frame you want to end the animation with)
   0 for both Start and End Frame will use all frames in texture
  Frames Per Second(This determines how fast the animation will play)
  Examples:
    Line with Animated Texture UUID
    eada511a-4a6d-eb68-4abb-f51adc6d2972|b19ba640-6629-7778-1270-226de25a8c0c|3|2|0|3|0.33
    Line with Animated Texture Name
    eada511a-4a6d-eb68-4abb-f51adc6d2972|Fire Breathing GargoyleAnimGrid6x2|3|2|0|3|0.33

Script


list config;
string notecard = "Texture Config";
key ncuuid;
key configread;
integer line;
integer link = 1;//set to appropriate link number for main panel
integer face = 1;//set to appropriate face number for main panel
settextureanim(string texture)
{
    llSetLinkTextureAnim(link,FALSE, face, 0, 0, 0.0, 0.0, 1.0);
    integer idx = llListFindList(config,[texture]);
    if(~idx)
    {
        string animtexture = llList2String(config,idx+1);
        integer x = llList2Integer(config,idx+2);
        integer y = llList2Integer(config,idx+3);
        integer start = llList2Integer(config,idx+4);
        integer num = llList2Integer(config,idx+5);
        float fps = llList2Float(config,idx+6);
        llSetLinkPrimitiveParamsFast(link,[PRIM_TEXTURE,face,animtexture,<1,1,0>,<0,0,0>,0.0,PRIM_COLOR,1,<1.0,1.0,1.0>,0.0]);
        llSetLinkTextureAnim(link,ANIM_ON|LOOP,face,x,y,start,num,fps);
        llSetLinkAlpha(link,1.0,face);
    }
}
            
        
default
{
    state_entry()
    {
        integer num = llGetNumberOfPrims();
        if(num == 1){link = 0;}//necessary if object is a single prim
        llSetLinkTextureAnim(link,FALSE, face, 0, 0, 0.0, 0.0, 1.0);
        ncuuid = llGetInventoryKey(notecard);
        if(ncuuid == NULL_KEY)
        {
            llOwnerSay("Texture Config notecard not present. Turning off Touch Response");
        }
        else
        {
            llOwnerSay(notecard + " present. Loading configurations");
            config = [];
            line = 0;
            configread = llGetNotecardLine(notecard,line);
        }
    }
    
    dataserver(key reqid, string data)
    {
        if(reqid == configread)
        {
            if(data != EOF)
            {
                list temp = llParseString2List(data,["|",","],[]);
                integer len = llGetListLength(temp);
                if(len == 7)
                {
                    llOwnerSay("Line " +(string)line + " loaded.");
                    config += temp;
                }
                else
                {
                    if(line && data != "")
                    {
                        llOwnerSay("Line " + (string)line + " doesn't have exactly 7 elements. Line ignored. Leave as is, or correct it if you want to use it.");
                    }
                }
                line++;
                configread = llGetNotecardLine(notecard,line);
            }
            else
            {
                llOwnerSay("Finished loading configurations.");
            }
        }
    }
    
    link_message(integer sn, integer n, string m, key id)
    {
        if(n >=0)
        {
            settextureanim((string)id);
        }
    }
    
    changed(integer change)
    {
        if(change & CHANGED_INVENTORY)
        {
            llSetLinkTextureAnim(link,FALSE, face, 0, 0, 0.0, 0.0, 1.0);
            key temp = llGetInventoryKey(notecard);
            if(temp != NULL_KEY && temp != ncuuid)
            {
                ncuuid = temp;
                llOwnerSay(notecard + " changed. Loading new configurations");
                config = [];
                line = 0;
                configread = llGetNotecardLine(notecard,line);
            }
            else if(temp == NULL_KEY)
            {
                llOwnerSay("Texture Config notecard not present.");
            }
        }
    }
}