Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Texture Switch

Dain Lambert
Registered User
Join date: 24 Aug 2004
Posts: 77
10-05-2004 19:56
Sorry if this is a stupid question. I'd like to be able to show a series of pictures on a screen. I have found many scripts that seem to randomly show the pictures. What I would like is for the script to just go through the pictures in some order, without repeating. I'd also like it to do this through a touch interface, so that when I touch it the picture would switch. I'm pretty sure this can be done but I am truly a novice when it comes to scripts. Any help will be greatly appreciated. I guess I'd also like to be able to show the pictures without any interaction (touch) over and over again. But the biggest request would be to have it done non-randomly and with no repeats.

Thanks.
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
10-06-2004 00:02
CODE
integer number;
integer pointer = 0;
float interval = 60.0;
string displaytext = "";
vector displaycolor = <0.0,0.5,1.0>;
integer face = 0;


cycle()
{
string name = llGetInventoryName(INVENTORY_TEXTURE, pointer);
if (name != "")
{
llWhisper(0, name);
llSetObjectDesc(name);
llSetTexture(name, face);
}
pointer++;
if(pointer>number)
{
pointer=0;
}
}

default
{
state_entry()
{
number = llGetInventoryNumber(INVENTORY_TEXTURE);
llSetText(displaytext, displaycolor,1);
llSetTimerEvent(interval);
cycle();
}

timer()
{
cycle();
}

touch_start(integer num)
{
if(llDetectedKey(0) == llGetOwner())
{
llSay(0, "RESET!");
llResetScript();
}
cycle();
}
}


If anyone else touches the prim, it changes the pic. If the owner does, it resets the script to pick up inventory changes. Every minute it changes the pic by itself.

You can change the variables at the top to change the behaviors, and even add floating text over your displaying prim.