Slideshow Script

Expired

default
{
    state_entry()
    {
        llSay(0, "Raz Image Cycler");
        llSetTimerEvent(5.0);
    }
    timer()
    {
        integer number = llGetInventoryNumber(INVENTORY_TEXTURE);
        float rand = llFrand(number);
        integer choice = (integer)rand;
        string name = llGetInventoryName(INVENTORY_TEXTURE, choice);
        if (name != "")
        {
            llSetTexture(name, 0);
            //llSay(0, name);
        }
    }
}

 

Flowing Water Script

Expired

default
{
    state_entry()
    {
      llSetStatus(STATUS_PHANTOM, TRUE);
      llSetTextureAnim(ANIM_ON|LOOP|SMOOTH, ALL_SIDES, 1, 1, 0, 0, -.225);
    }
}

 

Texture Repeater

Expired

Texture Repeater. Observes textures and texture parameters on the prim. As soon those have changed, updates other prims in the linkset to repeat the changes. This allows the user to texture the covered or hard to aim faces of that prims.

The script copies the texture UUID and parameters given the face 0 to the face 0 on of every other script in linkset. Than the texture UUID and parameters of the face 1 to the face 1 of other prims and so on until all faces are checked.

The script was created for my GlassBox mesh tutorial – where we create mesh prims with faces that cover others completely and make them quite hard to texture inworld on regular way. The script was published here in hope it is also usable other wise, but also to keep my blog post shorter.

 

Usage

Create a box (or other appropriate form) via build tools and put the script into - this turns the prim into repeater tool. Now you can prepare the prim faces by texturing, or just link it with all prims you want bulk-texture. The face textures are copied immediately by linking. If needed you can now texture the repeater prim – all texture parameters are copied to other prims than.

The repeater must not be the root prim of the linket. You can also use two or more repeaters (not recommended), the script copies only changed parameters and avoids so a permanent texture updates by multiple repeaters.

After usage, click the repeater, the script will ask for link permission. If you accept, the repeater will unlink and destroy itself, but leaving back the textured linkset inworld (if you doubt prim loss, please comment out the llDie() command.) If you put something into the repeater prim, like a notecard, texture or another script, the repeater script skips self-destroying to prevent loosing that unexpected content.

 

 

Disclaimer

You can use this script in your project, if commercial or not. If you modify the script, please extend the script header by your name and update notes.

This script is provided as is. Although tested and found as error-free, no responsibility is taken for any misuse of the script, or damage caused by using it.

 

 

Repeater script

 

 

//----------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 3 of
// the License, or (at your option) any later version.
//
// You may ONLY redistribute this program with copy, mod and transfer
// permissions and ONLY if this preamble is not removed.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, see .
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// $RCSfile: repeater.lslp,v $
//
// Texture repeater. Observes textures and texture parameters
// on the prim. As soon those have changed, updates other prims
// to repeat the changes. This allows to texture covered or hard
// to aim prim faces.
//
// Version 1.2:
//  + Delay allows a clean deactivating of repeaters with lower priority.
//  + Data buffer allows to change all faces at once which runs faster.  
//
// Version 1.1: 
//  + Added support for all prim faces, not just 6.
//  + Changing shape resetts script - extending faces is observed.
//  + Pingpong texture updates prevented via inactive state.
//
//----------------------------------------------------------------------------
// Author  Jenna Felton
// Version 1.2, $Revision: 1.10 $
//         $Date: 2013/03/06 15:54:53 $
//----------------------------------------------------------------------------
 
//----------------------------------------------------------------------------
 
// Delay before asigning textures, the longer the number the more chance
// for going standby in time.
float   DELAY = .25;
 
// Inactive state is for the case, more repeaters are linked to same link
// set. Than to prevent the ping-pong texture update, all repeaters except
// one in prim with lowest link numbers change to this state and stop
// observing textures.
// State change is enforced in default state while script reset. Leaving
// this state is possible only due relinking and rezzing the object.
// Update rev.1.7: Used variable instead of state to prevent loosing
//   link messages due state change.
integer inActive = FALSE;
 
// The lists prevent change of values that are always changed. 
// To do so we fill up the lists by dummy values that are never 
// something used for texture settings. This way the script will 
// notice the difference between the set texture and stored dummy
// value.
 
list    lImage = []; // e.g. [10, 10, 10, 10, 10, 10] for 6 faces.
list    lFBrgt = [];
list    lColor = [];
list    lBumps = [];
list    lTextg = [];
list    lPGlow = [];
 
integer gLength;
 
// Prepares cache to observe every face.
prepareCache() {
    integer face;
    gLength = llGetNumberOfSides();
 
    for (face = 0 ; face  1 && perms & PERMISSION_CHANGE_LINKS) {
            perms = llGetLinkNumber();
            if (perms > 0) {
                llBreakLink(perms);
            }
 
            if (llGetNumberOfPrims() > 1) {
                llOwnerSay("ERROR: Could not unlink the prim." 
                     +" Please try again");
                return;
            }
 
            if (llGetInventoryNumber(INVENTORY_ALL) == 1) {
                llDie();
            }
            else {
                llOwnerSay("WARNING: There is unexpected content"
                    +" into the prim. Destroying aborted");
            }
        }
    }
}
 
//----------------------------------------------------------------------------

 

 

 

Menu Engine (Textures) ( V1 )

Expired

These scripts are set up to make hierarchical multi paged dialog menus for object contents simple. The whole system works from notecards (NCs). We start with a main NC containing any number of NC names that are the titles of sub menus. They in turn may contain names of further sub menus ad infinitum. Any number of cards and any number of eventual sub sectioned prim contents may be added. The following setup walkthrough should explain better.

These scripts are setup for texture display by menu but could simply be edited to rez objects or give items or both. The important bit is how simple it is to organize the menus.

    https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); color: rgb(0, 0, 0); font-family: verdana, helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
  • STEP 1

Fill the prim with whatever contents you're using. For the sake of demonstration lets assume it is textures and there are hundreds of them. To make life easier drop the "Helper" script into the contents and wait for the names of the contents to be chatted to you. You can then copy paste all the names in one go to a NC for ease.

    https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); color: rgb(0, 0, 0); font-family: verdana, helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
  • STEP 2

Decide how you want to arrange the textures into groups. If you feel like wading through page after page of uncategorized texture names you can simply copy the whole list of names to one card, save it and drop it in the prim with the "Engine" script and you're done. But to make using the menus far more pointed we can set up sub menus and sub sub menus.

So what we do is add the names of the textures in groups to separate NCs. We then name those NCs according to the category we choose. Again for the sake of simplicity lets say we have predominantly red, green and blue textures but, we also have cubist and swirly of each color.

IN EVERY NOTECARD WE ADD THE NAMES OF EITHER SUB MENU NOTECARD NAMES OR TEXTURE NAMES (contents) ONE PER NOTECARD LINE.

What we would have is:

Notecard Name: Textures (or whatever you choose) containing -

 

Cubist
Swirly

 

 

Then also

Notecard Name: Cubist containing -

 

 

Cubist Red
Cubist Green
Cubist Blue

 

 

And

Notecard Name: Swirly containing -

 

Swirly Red
Swirly Green
Swirly Blue

 

 

Then NCs named: Cubist Red, Cubist Green, Cubist Blue, Swirly Red, Swirly Green & Swirly Blue each containing a list of texture names that suit the selections on the menu that would logically lead you to those.

    https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); color: rgb(0, 0, 0); font-family: verdana, helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
  • STEP 3

Save all the NCs and drop them into the prim with the engine script and the textures. Write the name of the primary NC into the script (at the top) and it's all done.

The user would see on the first page: "Cubist" & "Swirly"

Then on the next page if they chose "Cubist""Cubist Red", "Cubist Green" & "Cubist Blue"

Or on the next page if they chose "Swirly""Swirly Red", "Swirly Green" & "Swirly Blue"

When clicking on any of the choices that lead to a list of texture names (however many there are) the next choice they make will set the texture for display. As I said before the scripts could be simply modified to do some other thing. I may write some alternative solutions based on this engine later.

The limits of this system are effectively moot. You can have as many textures as you can save to as many NCs as you need and as many NCs as will fit in the object with the other contents. The number of sub categories can be as many as is practical.

Finally, there is a "RETURN" button on every page to go back a step. So if you don't like what you are seeing you can step back to the last page of categories and back again if you wish right to the start. Every page that needs them will have ">>" (forward) and "<<" (back) buttons for cycling through the selections of that category.

 

 

Helper

 

Drop this on your loaded prim/object to get a local chatted readout of every texture name in the prim/object. Makes the initial setting up slightly easier since you can just copy paste the chat to a notecard.

 

 

// V1 //
 
default
{
    state_entry()
    {
        string name = llGetObjectName();
        integer it = llGetInventoryNumber(INVENTORY_TEXTURE);
        while(it)
        {
            llSetObjectName(llGetInventoryName(INVENTORY_TEXTURE, (--it)));
            llOwnerSay("/me ");
            llSleep(0.01);
        }
        llSetObjectName(name);
        llRemoveInventory(llGetScriptName()); // Self deleting script.
    }
}

 

 

The Engine

 

This is the main script for the menu system. Add it to the same prim that has the contents (textures and NCs). Add the name of the primary NC to the top of the script.

 

// V1 //
 
string main = "Categories"; // Name of primary notecard. Contains the first categories.
 
integer channel = -56782348; // This should be a very negative number.
 
integer face = -1; // The face number to display the texture on. -1 means ALL_SIDES
 
///////////////////////////////////////////////////////////////////////////////////////
////////////////DON'T EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU'RE DOING////////////////
///////////////////////////////////////////////////////////////////////////////////////
 
list multi_page = ["<<", "RETURN", ">>"];
 
key short_data_req;
 
key long_data_req;
 
list dialog_list;
 
integer nc_line;
 
string nc_name;
 
list data_list;
 
integer busy;
 
key nonl_req;
 
list choices;
 
integer nonl;
 
integer lis;
 
key agent;
 
ClearLists()
{
    dialog_list = [];
    data_list = [];
}
 
Dialog(list l)
{
    llListenRemove(lis);
    lis = llListen(channel, "", agent, "");
    llDialog(agent, ("\n\n" + nc_name), l, channel);
    llSetTimerEvent(30.0);
}
 
BuildList(string s)
{
    dialog_list += [llGetSubString(s, 0, 23)];
    data_list += [s];
}
 
default
{
    on_rez(integer param)
    {
        llResetScript();
    }
    timer()
    {
        llResetScript();
    }
    touch_start(integer nd)
    {
        while(nd)
        {
            key toucher = llDetectedKey(--nd);
            if(!busy)
            {
                busy = TRUE;
                agent = toucher;
                nonl_req = llGetNumberOfNotecardLines((nc_name = main));
                choices = [nc_name];
                return;
            }
            //llInstantMessage(toucher, "This device is in use. Please wait"); // This will cause a slight delay if used.
        }
    }
    dataserver(key q, string data)
    {
        if(q == nonl_req)
        {
            if((nonl = ((integer)data)) > 11)
            {
                long_data_req = llGetNotecardLine(nc_name, (nc_line = 0));
                return;
            }
            else
            {
                short_data_req = llGetNotecardLine(nc_name, (nc_line = 0));
                return;
            }
        }
        else if(q == short_data_req)
        {
            if(data != EOF)
            {
                BuildList(llStringTrim(data, STRING_TRIM));
                short_data_req = llGetNotecardLine(nc_name, (++nc_line));
                return;
            }
            Dialog(([llList2String(multi_page, 1)] + dialog_list));
            return;
        }
        else if(q == long_data_req)
        {
            if(data != EOF)
            {
                BuildList(llStringTrim(data, STRING_TRIM));
                if(llGetListLength(data_list) <9)
                {
                    if((++nc_line) == nonl)
                    {
                        nc_line = 0;
                    }
                    long_data_req = llGetNotecardLine(nc_name, nc_line);
                    return;
                }
            }
            Dialog((multi_page + dialog_list));
        }
    }
    listen(integer chan, string name, key id, string msg)
    {
        if(id == agent)
        {
            llSetTimerEvent(0.0);
            llListenRemove(lis);
            if(llListFindList(multi_page, [msg]) == -1)
            {
                string data = llList2String(data_list, llListFindList(dialog_list, [msg]));
                integer type = llGetInventoryType(data);
                ClearLists();
                if(type == INVENTORY_NOTECARD)
                {
                    nonl_req = llGetNumberOfNotecardLines((nc_name = data));
                    choices += [nc_name];
                    return;
                }
                else if(type == INVENTORY_TEXTURE)
                {
                    llSetTexture(data, face);
                    busy = FALSE;
                    return;
                }
            }
            else if(llListFindList(multi_page, [msg]) != -1)
            {
                ClearLists();
                if(msg == llList2String(multi_page, 1))
                {
                    if(llGetListLength(choices) > 1)
                    {
                        nonl_req = llGetNumberOfNotecardLines((nc_name = llList2String((choices = llList2List(choices, 0, -2)), -1)));
                        return;
                    }
                    else
                    {
                        nonl_req = llGetNumberOfNotecardLines((nc_name = main));
                        choices = [nc_name];
                        return;
                    }
                }
                else if(msg == llList2String(multi_page, 2))
                {
                    if((++nc_line) == nonl)
                    {
                        nc_line = 0;
                    }
                    long_data_req = llGetNotecardLine(nc_name, nc_line);
                    return;
                }
                else if(msg == llList2String(multi_page, 0))
                {
                    if((nc_line -= 17) <0)
                    {
                        nc_line = (nonl + nc_line);
                    }
                    long_data_req = llGetNotecardLine(nc_name, nc_line);
                }
            }
        }
    }
}