Multi-displays Texture Cycler
Revision as of 23:10, 24 January 2015 by ObviousAltIsObvious Resident (talk | contribs) (<lsl> tag to <source>)
Features
- Display all textures in sequence, distributed to all screens in the set.
- Internal delay between each screen, to give viewer some time to load
- Single script!
Usage
- Link all screens into a linkset, with another root prim separate from the screens.
- Name all the screens as DISPLAY#n, where n is a number, starting from 1, 2, 3, ...
- Put all textures into the root prim
- Put the script in last
- Texture will be displayed on Side#1 of the prim. Make sure it is faced right.
Scripts
float cycleTimer = 30;
list displays;
integer totalDisplays;
integer currentTexture = 0;
displayOff(integer link){
llSetLinkPrimitiveParamsFast(link, [
PRIM_COLOR, 1, <0,0,0>, 1,
PRIM_TEXTURE, 1, TEXTURE_BLANK, <1,1,0>, <0,0,0>, 0
]);
}
displayOn(integer link, string name, key texture){
llSetLinkPrimitiveParamsFast(link, [
PRIM_COLOR, 1, <1,1,1>, 1,
PRIM_TEXTURE, 1, texture, <1,1,0>, <0,0,0>, 0,
PRIM_TEXT, name, <1,1,1>, 1
]);
}
showTextures(){
integer count = llGetInventoryNumber(INVENTORY_TEXTURE);
if(count < 1) return;
integer i;
for(i=0; i<totalDisplays; ++i){
string textureName = llGetInventoryName(INVENTORY_TEXTURE, currentTexture);
key textureKey = llGetInventoryKey(textureName);
if(textureKey == NULL_KEY) textureKey = TEXTURE_BLANK;
displayOn(llList2Integer(displays, i), textureName, textureKey);
currentTexture = ++currentTexture % count;
llSleep(0.5);
}
}
default{
state_entry(){
// Scan for displays
integer i = llGetNumberOfPrims();
string name;
integer num;
for(; i>0; --i){
if(llGetSubString((name = llGetLinkName(i)), 0, 7) == "DISPLAY#"){
num = (integer)llGetSubString(name, 8, -1);
// Force the ID into link list
while(llGetListLength(displays) < num) displays += [0];
displays = llListReplaceList(displays, [i], num - 1, num - 1);
// Prepare display screen
displayOff(i);
}
}
totalDisplays = llGetListLength(displays);
if(totalDisplays < 1)
llOwnerSay("ERROR: No target display found! Please name target prims as \"DISPLAY#1\", \"DISPLAY#2\", ..., \"DISPLAY#n\"");
else llSetTimerEvent(cycleTimer);
}
timer(){
showTextures();
}
}