Difference between revisions of "Taper Door (minimalistic)"
Jump to navigation
Jump to search
(Created page with "Example prim settings for these types of doors: Type: Box Size: <2.625, 3.75, 0.01001> Rotation: <270., 0., 0.> Hollow: 0.90 Taper-x: -1 Taper-y: 0 <pre> // Created by Kopilo Ha…") |
m (<lsl> tag to <source>) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
Example prim settings for these types of doors: | Example prim settings for these types of doors: | ||
Type: Box | *Type: Box | ||
Size: <2. | *Size: <2.5, 3.75, 0.01> | ||
Rotation: <270 | *Rotation: <270, 0, 0> | ||
Hollow: 0.90 | *Hollow: 0.90 | ||
Taper-x: -1 | *Taper-x: -1 | ||
Taper-y: 0 | *Taper-y: 0 | ||
< | <source lang="lsl2"> | ||
// Created by Kopilo Hallard | // Created by Kopilo Hallard | ||
// Creative Commons - Attribute only | // Creative Commons - Attribute only | ||
Line 88: | Line 88: | ||
} | } | ||
</ | </source> |
Latest revision as of 08:28, 25 January 2015
Example prim settings for these types of doors:
- Type: Box
- Size: <2.5, 3.75, 0.01>
- Rotation: <270, 0, 0>
- Hollow: 0.90
- Taper-x: -1
- Taper-y: 0
// Created by Kopilo Hallard
// Creative Commons - Attribute only
// http://creativecommons.org/licenses/by/3.0/
//to alter script, see touch start,
//first value is magnitude (how much to change by, larger is 'faster')
//second value is rate of change (smaller is faster)
//Example DecreaseTaper(0.01, 0.02)
//0.01 = change by 0.01,
//0.02 = pause for 20ms between each change
//time to keep door open defined here:
float openpause = 2.0; //2.0 = 2 seconds
// Area not to touch starts here (scroll down to make changes)
list baseObject;
integer indexLoc;
vector getCurrentTaper() {
integer objectType = llList2Integer(baseObject, 0);
if(objectType < 3) {
//box, cylinder, prism, index 5
indexLoc = 5;
return llList2Vector(baseObject, 5);
}
else if(objectType > 3 && objectType != 7) {
//ring tube torus, index 8
indexLoc = 8;
return llList2Vector(baseObject, 8);
}
return <-42,-42,-42>;
}
DecreaseTaper(float mag, float speed) {
baseObject = llGetPrimitiveParams([PRIM_TYPE]);
vector tmp = getCurrentTaper();
if(tmp.z != -42) { //safety check
while (tmp.x > 1) {
tmp.x -= mag;
baseObject = llListReplaceList(baseObject, [tmp], indexLoc, indexLoc);
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TYPE] + baseObject);
llSleep(speed);
}
llSleep(openpause);
IncreaseTaper(mag, speed);
}
}
IncreaseTaper(float mag, float speed) {
vector tmp = getCurrentTaper();
if(tmp.z != -42) { //safety check
while (tmp.x < 2) {
tmp.x += mag;
baseObject = llListReplaceList(baseObject, [tmp], indexLoc, indexLoc);
llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TYPE] + baseObject);
llSleep(speed);
}
}
}
default
{
state_entry()
{
baseObject = llGetPrimitiveParams([PRIM_TYPE, PRIM_POSITION]);
}
touch_start(integer total_number)
{
//Alter values here
DecreaseTaper(0.01, 0.02);
//That's all
}
}