Difference between revisions of "Greeting Card"
Jump to navigation
Jump to search
BETLOG Hax (talk | contribs) m |
m (<lsl> tag to <source>) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 11: | Line 11: | ||
<br> | <br> | ||
You'll figure out which way to orient the prims when you link and touch it. | You'll figure out which way to orient the prims when you link and touch it. | ||
< | <source lang="lsl2"> | ||
//============================================================== | //============================================================== | ||
// BETLOG Hax | // BETLOG Hax | ||
Line 17: | Line 17: | ||
// For eKitten Magic | // For eKitten Magic | ||
//============================================================== | //============================================================== | ||
// **** LICENCE START **** | // **** LICENCE START **** | ||
// http://creativecommons.org/licenses/by-sa/3.0/ | // http://creativecommons.org/licenses/by-sa/3.0/ | ||
Line 36: | Line 33: | ||
//---------------------------------- | //---------------------------------- | ||
// CONFIGURATION | // CONFIGURATION | ||
string gSound = ""; | string gSound = "";//optional, one in contents will work too | ||
float gVolume = 1.0; | float gVolume = 1.0; | ||
// | |||
string gAnim = "";//optional, one in contents will work too | |||
// | // | ||
float gAngle = 160.0; | float gAngle = 160.0; | ||
Line 48: | Line 47: | ||
{ if(gSound!="") | { if(gSound!="") | ||
llLoopSound(gSound,gVolume); | llLoopSound(gSound,gVolume); | ||
if(gAnim!="") | |||
llStartAnimation(gAnim); | |||
} | } | ||
else | else | ||
{ llStopSound(); | |||
if(gAnim!="") | |||
llStopAnimation(gAnim); | |||
} | |||
llSetLinkPrimitiveParams(2,[PRIM_ROTATION | llSetLinkPrimitiveParams(2,[PRIM_ROTATION | ||
,llEuler2Rot(<gAngle*(float)gOpen, 0.0, 0.0>*DEG_TO_RAD)/llGetLocalRot() | ,llEuler2Rot(<gAngle*(float)gOpen, 0.0, 0.0>*DEG_TO_RAD)/llGetLocalRot() | ||
Line 66: | Line 70: | ||
{ gSound=sound; | { gSound=sound; | ||
llPreloadSound(gSound); | llPreloadSound(gSound); | ||
} | |||
} | |||
if(gAnim=="") | |||
{ string anim = llGetInventoryName(INVENTORY_ANIMATION,0); | |||
if(anim!="") | |||
{ gAnim=anim; | |||
llPreloadSound(gAnim); | |||
} | } | ||
} | } | ||
Line 76: | Line 87: | ||
} | } | ||
//========================================================================= | //========================================================================= | ||
</ | </source> | ||
[[Category:LSL Examples]] | [[Category:LSL Examples]] |
Latest revision as of 14:11, 24 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Greeting Card
--BETLOG Hax UTC+10: 20091004 0012 [SLT: 20091003 0712]
The prims are dimpled, root 0.0-0.5 and child 0.5-1.0
The child prim is cut 0.375-0.875
Texture repeats are adjusted accordingly
You'll figure out which way to orient the prims when you link and touch it.
//==============================================================
// BETLOG Hax
// UTC+10: 20091003 2019 [SLT: 20091003 0319]
// For eKitten Magic
//==============================================================
// **** LICENCE START ****
// http://creativecommons.org/licenses/by-sa/3.0/
// Attribution licence:
// You must:
// -Include this unaltered licence information.
// -Supply my original script with your modified version.
// -Retain the original scripts' SL permissions. [+c/+m/+t]
// Or:
// -Link to the wiki URL from which you copied this script.
// https://wiki.secondlife.com/wiki/Greeting_Card
// -Document: "Uses parts of <scriptname> by BETLOG Hax"
// **** LICENCE END ****
//----------------------------------
// SHARED CONFIGURATION
//----------------------------------
// CONFIGURATION
string gSound = "";//optional, one in contents will work too
float gVolume = 1.0;
//
string gAnim = "";//optional, one in contents will work too
//
float gAngle = 160.0;
//----------------------------------
// CORE CODE
integer gOpen;
//----------------------------------
f_toggle()
{ if(gOpen)
{ if(gSound!="")
llLoopSound(gSound,gVolume);
if(gAnim!="")
llStartAnimation(gAnim);
}
else
{ llStopSound();
if(gAnim!="")
llStopAnimation(gAnim);
}
llSetLinkPrimitiveParams(2,[PRIM_ROTATION
,llEuler2Rot(<gAngle*(float)gOpen, 0.0, 0.0>*DEG_TO_RAD)/llGetLocalRot()
]);
}
//=========================================================================
default
{ on_rez(integer param)
{ llResetScript();
}
state_entry()
{ if(gSound=="")
{ string sound = llGetInventoryName(INVENTORY_SOUND,0);
if(sound!="")
{ gSound=sound;
llPreloadSound(gSound);
}
}
if(gAnim=="")
{ string anim = llGetInventoryName(INVENTORY_ANIMATION,0);
if(anim!="")
{ gAnim=anim;
llPreloadSound(gAnim);
}
}
f_toggle();
}
touch_start(integer total_number)
{ gOpen=!gOpen;
f_toggle();
}
}
//=========================================================================