Difference between revisions of "Greeting Card"
BETLOG Hax (talk | contribs) m |
BETLOG Hax (talk | contribs) m |
||
Line 36: | Line 36: | ||
//---------------------------------- | //---------------------------------- | ||
// 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 50: | ||
{ 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 73: | ||
{ gSound=sound; | { gSound=sound; | ||
llPreloadSound(gSound); | llPreloadSound(gSound); | ||
} | |||
} | |||
if(gAnim=="") | |||
{ string anim = llGetInventoryName(INVENTORY_ANIMATION,0); | |||
if(anim!="") | |||
{ gAnim=anim; | |||
llPreloadSound(gAnim); | |||
} | } | ||
} | } |
Revision as of 02:26, 4 October 2009
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.
<lsl>
//==============================================================
// BETLOG Hax
// UTC+10: 20091003 2019 [SLT: 20091003 0319]
// For eKitten Magic
//==============================================================
// BETLOG Hax
//
//----------------------------------
// **** 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(); }
} //========================================================================= </lsl>