Edie_Shoreland icon

Simple image changing frame

Edie_Shoreland | PRO | 02/17/19 07:24:55 PM UTC | 0 ⭐ | 9538 👁️ | Never ⏰ | []
Linden Scripting |

0 B

|

None

|

0 👍

/

0 👎

// Roz's Single Prim Autoframe Image Swapper Script
 
float change = 20.0; //Number of seconds before image changes.
 
// Create a box.  Put the photos and textures you'd like to display
// with your frame inside the box's inventory.  Once all photos are
// in the box's inventory, create a new script, cut and paste this
// information to the script and put it in the box's inventory.
 
// Once the script is running, the prim can be resized and edited
 
// CAUTION: THIS SCRIPT WILL AUTOMATICALLY CHANGE THE SHAPE, SIZE AND
// TEXTURE OF THE PRIM YOU PLACE IT IN. 
 
list frames = ["a25bebc8-4739-453d-d44e-fc522cf95488","c58be669-fd49-8a07-7836-4c97a4a4058c","a0ce8c4d-74d1-a38c-53c0-0819c24b32b4","8ab138f4-248a-3884-a1de-e4124032c18c"];
string image;
integer toggle; 
integer next; 
integer photos;
 
default
{
    state_entry()
    {
        llSetTimerEvent(change);
        photos = llGetInventoryNumber(INVENTORY_TEXTURE);
        next = photos - 1;
 
        //Q: Roz, where did that hideously ugly frame come from?
        //A: From right here...
        llSetPrimitiveParams([PRIM_TYPE,PRIM_TYPE_BOX,PRIM_HOLE_SQUARE,<0.0,1.0,0.0>,0.0,ZERO_VECTOR,<0.8,0.8,0.0>,ZERO_VECTOR,PRIM_SIZE,<0.5,0.5,0.015>,PRIM_TEXTURE,ALL_SIDES,llList2Key(frames,(integer)llFrand(4)),<1.0,1.0,0.0>,ZERO_VECTOR,0.0,PRIM_TEXTURE,5,"5748decc-f629-461c-9a36-a35a221fe21f",<1.0,1.0,0.0>,ZERO_VECTOR,0.0,PRIM_TEXTURE,0,llGetInventoryName(INVENTORY_TEXTURE, next),<1.0,1.0,0.0>,ZERO_VECTOR,0.0]);
        //So yes, sure the frame is pretty ugly, but you can always
        //link your image swapping prim to a much nicer frame later
        //on, right?
    }
    
    timer() 
    {   
        next++;
        if (next >= photos) next = 0;
        llSetTexture(llGetInventoryName(INVENTORY_TEXTURE, next), 0);
    } 
 
    //Q: Roz, what if I'd like to just display an image without it
    //   changing every 20 seconds or so?
    //A: Touch the prim to stop the images from cycling, touch it 
    //   again to restart the cycle.
    touch_start(integer total_photos)
    {
        toggle = !toggle;
        if (toggle == TRUE) llSetTimerEvent(0.0);
        else llSetTimerEvent(change);
    }
 
    //Q: But Roz, what if I want to add more pictures to my frame
    //   later on?
    //A: Here you go...
    changed(integer change) 
    { 
        if (change & CHANGED_INVENTORY) photos = llGetInventoryNumber(INVENTORY_TEXTURE);
    } 
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎