Goodwrench Grayson
Classic Gaming Nut
Join date: 18 Jun 2004
Posts: 223
|
10-13-2004 13:43
A few weeks ago, I'd posted a request for specific jobs I need for my property. You can find the many things that I need at this ol' thread: /invalid_link.htmlWhile I've had some definite interest from people, I've not been able to coordinate work very effectively thanks to the usual SL attribute: Being pulled in a thousand directions by potential projects when all you may wanna do is visit some virtual part (or freaky virtual sex depending on your demeanor).  Anyway, I'd like to focus on the Day/Night Sconces from that post. I'll elaborate again here: I'd like to create and place sconces around my place. However, the texture-animated flame that I will create is something I'd like to appear once night falls and disappear again when the sun rises. The flame prims (2 intersecting prims) would also be turned to "Light". Any takers? Thanks in advance...
_____________________
We used to remember our Roots at The Mushroom Kingdom - memorial can be found at Davenport 200, 150 Section 8 Server - my home on the web
|
Masakazu Kojima
ケロ
Join date: 23 Apr 2004
Posts: 232
|
10-13-2004 14:45
If I understand what you want right, the easiest way to do this would be to name the flame prims in the linkset something specific, like "flame", and then have the script find them (llGetNumberOfPrims(), llGetLinkName()) and set their alpha (llSetLinkAlpha()) depending on the sun direction (llGetSunDirection()) or sim time of day (llGetTimeOfDay()). The sun direction is more reliable since it is really independant of the time of day, the time of day just gets reset when the sun passes the midnight position. Something like this (completely untested): string FLAME_NAME = "flame"; // the name of the flame objects float MIN_SUN_Z = 0.2; // if sun_direction.z > this, sun is up. float ALPHA_ON = 1.0; // alpha when flame is on float ALPHA_OFF = 0.0; // alpha when flame is off integer TIMER_INTERVAL = 600; // how often to check sun, in seconds
// finds all linked objects called <name> and sets the alpha of all their // faces to <alpha> set_linked_alpha(string name, float alpha) { integer i; integer prims = llGetNumberOfPrims(); for ( i = 1; i <= prims; i++ ) { if ( llGetLinkName(i) == name ) llSetLinkAlpha(i, alpha, ALL_SIDES ); } }
// returns TRUE if the sun is in the sky, FALSE if not integer check_sun() { vector v = llGetSunDirection(); if ( v.z > MIN_SUN_Z ) return TRUE; return FALSE; }
// turn flame on or off depending on sun set_flame() { if ( check_sun() ) set_linked_alpha( FLAME_NAME, ALPHA_OFF ); else set_linked_alpha( FLAME_NAME, ALPHA_ON ); }
state default { state_entry() { llSetTimerEvent( TIMER_INTERVAL ); set_flame(); } on_rez(integer param) { llResetScript(); } timer() { set_flame(); } }
Hopefully that works or is enough information for you to make it cooperate.
|
Goodwrench Grayson
Classic Gaming Nut
Join date: 18 Jun 2004
Posts: 223
|
10-13-2004 15:03
Wow... that's one thorough response.  I'll give it a shot when I finally get to leave work... just know that I'm what we in the biz call "LSL Challeneged" so I may have some problems. That said, I'm psyched! It's just nice to know that its doable and that I know who I can pester if necessary. 
_____________________
We used to remember our Roots at The Mushroom Kingdom - memorial can be found at Davenport 200, 150 Section 8 Server - my home on the web
|
Barbarra Blair
Short Person
Join date: 18 Apr 2004
Posts: 588
|
10-14-2004 09:51
A simpler way might just be to put a script in each child prim that changes the prim from wood alpha to light flame and so on.
|
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
10-14-2004 10:35
True, but the way Masakazu Kojima suggested requires only one timer, and one script. Goodwrench Grayson could have 50+ flames. In-fact he could have 100 flames. And it would only requires one or two timers. If Goodwrench Grayson did the flames as you suggest, and wanted one hundred flames. That would be a one hundred timers, and one hundred scripts. That would be a waist of sim resources.
I wish I thought of the script. Quite an elegant solution.
|
Jake Cellardoor
CHM builder
Join date: 27 Mar 2003
Posts: 528
|
10-14-2004 12:13
Something else to consider: the savings derived by applying Masakazu's solution to 50 or 100 flames would require all the sconces to be linked together, which may or may not be convenient. Also note that, if the linked set contains a lot of prims that *aren't* flames, that script will do a lot of testing to find the flame prims. So it'd be most efficient to link only the sconces together, separate from the rest of the build. If most of the prims in the link set are not flames, then it might be worthwhile to store the link numbers of just the flame prims, and call llSetLinkAlpha on just those.
|