A bit of coding later and I had something that worked well enough. It's not as fancy as it could be, and with Mistress' input on how things looked I made it so it was fairly subtle (for example, greater particle age makes for a more impressive effect but it also ends up hiding your avatar depending on the dance), but I'm pleased with the result.
On the off-chance that it's useful to someone else, here's the script:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////// | |
// Z&A Light Ribbon | |
// By Antony Fairport | |
// | |
// Z&A Light Ribbon - Quick and simple glowstick/ribbon | |
// | |
// Revision history: | |
// ------------------------------------------------------------ | |
// | |
// 2016-06-25 | |
// Initial revision. | |
////////////////////////////////////////////////////////////////////// | |
// Make the ribbon | |
MakeRibbon( vector vStartColour, vector vEndColour ) | |
{ | |
// Get the size of the stick, so we can adjust the particle. | |
vector vStickSize = llGetScale(); | |
llParticleSystem( [ | |
PSYS_PART_FLAGS, PSYS_PART_RIBBON_MASK | | |
PSYS_PART_INTERP_COLOR_MASK | | |
PSYS_PART_EMISSIVE_MASK, | |
PSYS_PART_MAX_AGE, 0.75, | |
PSYS_SRC_TEXTURE, TEXTURE_BLANK, | |
PSYS_PART_START_SCALE, < vStickSize.z, 0.02, 0.0 >, | |
PSYS_PART_START_ALPHA, 0.5, | |
PSYS_PART_END_ALPHA, 0.0, | |
PSYS_PART_START_GLOW, 0.2, | |
PSYS_PART_END_GLOW, 0.05, | |
PSYS_PART_START_COLOR, vStartColour, | |
PSYS_PART_END_COLOR, vEndColour | |
] ); | |
} | |
////////////////////////////////////////////////////////////////////// | |
// Refresh the ribbon, loading colours from object desc. | |
RefreshRibbon() | |
{ | |
// Get the description as a list. | |
list lColours = llParseString2List( llGetObjectDesc(), [ "~" ], [] ); | |
// The start and end colours. | |
vector vStart = < 1.0, 0.0, 0.0 >; | |
vector vEnd = < 0.01, 0.0, 0.0 >; | |
// If we seem to have got enough stuff from the description... | |
if ( llGetListLength( lColours ) > 1 ) | |
{ | |
// ...assume we're getting colours. | |
vStart = (vector) llList2String( lColours, 0 ); | |
vEnd = (vector) llList2String( lColours, 1 ); | |
} | |
// Texture the stick itself. | |
llSetLinkPrimitiveParamsFast( LINK_THIS, [ | |
PRIM_GLOW, ALL_SIDES, 0.2, | |
PRIM_FULLBRIGHT, ALL_SIDES, TRUE, | |
PRIM_COLOR, ALL_SIDES, vStart, 1.0 | |
] ); | |
// Make the ribbon. | |
MakeRibbon( vStart, vEnd ); | |
} | |
////////////////////////////////////////////////////////////////////// | |
// Default state. | |
default | |
{ | |
////////////////////////////////////////////////////////////////// | |
// State entry. | |
state_entry() | |
{ | |
// Restrict memory. We don't need much. | |
llSetMemoryLimit( 12 * 1024 ); | |
// Get the ribbon off. | |
RefreshRibbon(); | |
} | |
////////////////////////////////////////////////////////////////// | |
// When rezzed... | |
on_rez( integer _ ) | |
{ | |
RefreshRibbon(); | |
} | |
////////////////////////////////////////////////////////////////// | |
// Handle being atached. | |
attach( key id ) | |
{ | |
if ( id ) | |
{ | |
RefreshRibbon(); | |
} | |
} | |
////////////////////////////////////////////////////////////////// | |
// Handle changes. | |
changed( integer change ) | |
{ | |
// If the owner has changed... | |
if ( change & CHANGED_OWNER ) | |
{ | |
// ...reset the script. | |
llResetScript(); | |
} | |
// If the size of the stick changed... | |
else if ( change & CHANGED_SCALE ) | |
{ | |
// ...refresh the particles. | |
RefreshRibbon(); | |
} | |
} | |
} |
< 1.0, 0.0, 0.0 >~< 0.0, 0.0, 0.0 >
will have the colour start at bright red and fade to black. The fade likely won't be very noticeable because it also fades to invisible (you can change that by tweaking the PSYS_PART_END_ALPHA value in the script, of course).
Hopefully this is of use to someone. :)
Very cool. I noticed those at the dance but didn't realise you had made them. I like the level of light, not too much :)
ReplyDeleteSort of happened as a last-minute idea and then RL intruded -- my plan was to make a dispenser for them to put out at the set, or hand them out or something.
DeleteStill, code's here for anyone to play with now. :)