Retracting door. Acts like a security shutter. The textures are offset to follow the movement so as the shutter folds away or folds out the texture stays in the correct place. This first version may be a little ropey but I got bored testing. I'll work on an update later.
Create Basic Shutter
Drop this script on a fresh prim to create a basic shutter shape with a simple shutter texturing provided by using the "Siding" bump map.
// V1 // default { state_entry() { llSetPrimitiveParams([7, <4.0, 6.0, 0.01>, 8, <0.0, 0.707107, -0.707107, 0.0>, 9, 0, 0, <0.375, 0.875, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 17, -1, "5748decc-f629-461c-9a36-a35a221fe21f", <6.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.570796, 18, -1, <1.0, 1.0, 1.0>, 1.0, 19, 0, 1, 13, 19, 1, 1, 0, 19, 2, 1, 0, 19, 3, 1, 0, 19, 4, 1, 13, 19, 5, 1, 0, 19, 6, 1, 0, 25, -1, 0.02]); llRemoveInventory(llGetScriptName()); // Self deleting script. } }
Shutter Script
This script actually operates the door (by touch).
// V2 // float delay = 10.0; // Seconds before auto closure. Set to zero to disable. float volume = 1.0; // Volume for sounds. 0.0 to 1.0 float speed = 0.02; // Speed of shutter action. The larger the figure the faster the action. key texture = TEXTURE_BLANK; // UUID of the texture to use on the two most prominent faces. key start = "03127ba7-9dbb-b6ab-0622-dcf8f1cd841a"; // UUID of initializing sound. key loop = "55fc1f41-9b74-bc66-8ad5-89b6c489851c"; // UUID of retraction loop sound. key end = "c7579f2c-6a23-f2b6-8d82-84a052b1bc30"; // UUID of termination sound. integer open; float rot; float Y; OperateDoor(integer i) { vector v = llGetScale(); float y = v.y; llTriggerSound(start, volume); llLoopSound(loop, volume); if(i) { Y = y; float o = 1.0; while(y > speed) { llSetLinkPrimitiveParamsFast(-4, [PRIM_SIZE,, PRIM_TEXTURE, 4, texture, , <(o -= (speed / 2)),0.0,0.0>, rot, PRIM_TEXTURE, 0, texture, , <(-o),0.0,0.0>, rot]); if(o < (-1.0 + (speed / 2))) o = 1.0; } llSetTimerEvent(delay); } else { llSetTimerEvent(0.0); float o = 0.0; while(y < Y) { llSetLinkPrimitiveParamsFast(-4, [PRIM_SIZE, , PRIM_TEXTURE, 4, texture, , <(o += (speed / 2)),0.0,0.0>, rot, PRIM_TEXTURE, 0, texture, , <(-o),0.0,0.0>, rot]); if(o > (1 - (speed / 2))) o = 0.0; } } llPlaySound(end, volume); } default { state_entry() { rot = (90.0 * DEG_TO_RAD); } touch_start(integer nd) { OperateDoor((open = (!open))); } timer() { OperateDoor((open = 0)); } }