Particle script, flower emitter recently stopped working
|
|
ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
|
03-24-2007 19:59
The attached script that was written to emit vegetation has worked well for two years but stopped working in the last week or so. Now instead of showing the flower texture that is referenced, it shows the default white particles. Does anyone have any idea what broke or how to fix it? The flower textures is referenced in this line (as a global variable). "key g_keyTexture = "FOL_hycinth2";" I can get it to work again by changing this line "PSYS_SRC_TEXTURE, g_keyTexture ," to read "PSYS_SRC_TEXTURE, "FOL_hycinth2" ," but I'm really curious why the "global variable" method doesn't work anymore. //************************************ // Created by Jimmy Thomson // Nov. 8th, 2004 // // *major remade to changing the system work* // // Description : // This script is the emiters that generate // the field of vegetation. It recieve the // parameter from the remote control, the server // side // // Copyright : // This script is Open-Source, you can use // and modify it to answer your own requirements // No need to ask permission, enjoy ;) // // Note : // I made this script in the context of a prototype // to evaluate the possibility to use particle // system to generate vegetation. It come // without garantee or technical support. Plz use // forum if you experimenting difficulties. // // Jimmy
// Defining the coverage of each emiter float MINRADIUS = 0.5 ; // Minimum distance to generate grass (makes a hole in the middle) float MAXRADIUS = 6 ; // Maximum distance to generate grass (area to cover)
// Here is the parameters of the particles system (controlled by the Server script) key g_keyTexture = "FOL_hycinth2"; vector g_colParticle = <1.0, 1.0, 1.0>; vector g_vecSize = <0.5, 0.5, 0.5>; // only sx and sy matter float g_fAlpha = 0.75; float g_fDensity = 1.5;
// Here is the other parameters of the particles system (but not under the Server script) float g_fBurstRate = 0.2;
// Added for debug purpose, allowed to make the client (planters) visible // 0.0 = invisible integer g_bVisibility = 1;
// Its possible to have many remote control at once // here is the ID that have to be the same as the client string g_strSystemID = "default";
// Define the ID of the subsystem (from 0 to 4) string g_strSubsysID = "1";
default { state_entry() { llListen(9494, "", NULL_KEY, ""); // Resetting the system llParticleSystem([]); llSetLinkAlpha(0, 1.0, ALL_SIDES); llSetTimerEvent(1.0); } timer() { // we emit the particle a ramdon distance from the source float fRadius = llFrand( MAXRADIUS - MINRADIUS ) + MINRADIUS; // more away we're of the source, more particle is needed to cover the area integer iPartCount = (integer) ((2.0 * 3.1416 * fRadius * g_fDensity) * g_fBurstRate); if (iPartCount < 1) { iPartCount++; } // llWhisper(0, "fRadius = " + (string) fRadius + " g_fDensity = " + (string)g_fDensity + " iPartCount = " + (string)iPartCount ); llParticleSystem([PSYS_PART_FLAGS, PSYS_PART_INTERP_COLOR_MASK, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE, PSYS_PART_START_COLOR, g_colParticle , PSYS_PART_START_ALPHA, g_fAlpha , PSYS_PART_END_COLOR, g_colParticle , PSYS_PART_END_ALPHA, g_fAlpha , PSYS_PART_START_SCALE, g_vecSize , PSYS_PART_END_SCALE, g_vecSize , PSYS_PART_MAX_AGE, 30.0 , // 30 is the max PSYS_SRC_ACCEL, <0,0,0> , PSYS_SRC_TEXTURE, g_keyTexture , PSYS_SRC_BURST_RATE, g_fBurstRate , PSYS_SRC_INNERANGLE, 0.0 , PSYS_SRC_OUTERANGLE, PI , PSYS_SRC_BURST_PART_COUNT, iPartCount , PSYS_SRC_BURST_RADIUS, fRadius , PSYS_SRC_BURST_SPEED_MIN, 0.0 , PSYS_SRC_BURST_SPEED_MAX, 0.0 , PSYS_SRC_MAX_AGE, 0.0 , PSYS_SRC_OMEGA, <0,0,0> ]); } listen( integer channel, string name, key id, string message ) { list list_param = llParseString2List(message, [" "], []); if((llList2String(list_param, 0) == g_strSystemID) && (llList2String(list_param, 1) == g_strSubsysID)) { g_keyTexture = llList2String(list_param, 2); g_colParticle.x = llList2Float(list_param, 3); g_colParticle.y = llList2Float(list_param, 4); g_colParticle.z = llList2Float(list_param, 5); g_vecSize.x = llList2Float(list_param, 6); g_vecSize.y = llList2Float(list_param, 7); g_fAlpha = llList2Float(list_param, 8); g_fDensity = llList2Float(list_param, 9); } } touch_start(integer num) { if (llDetectedKey(0) == llGetOwner()) { if (g_bVisibility == 0) { g_bVisibility = 1; llSetLinkAlpha(0, 1.0, ALL_SIDES); } else { g_bVisibility = 0; llSetLinkAlpha(0, 0.0, ALL_SIDES); } } } }
_____________________
 VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30 http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240 http://shop.onrez.com/Archtx_Edo
|
|
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
|
03-24-2007 20:28
There may be something I'm missing here, but my first reaction is "Why did it ever work? You're declaring a key and setting it to a string."
Try changing the global declaration to this and see what happens:
string g_keyTexture = "FOL_hycinth2";
edit: or leave it a key, but insert the key of the texture instead of the name.
|
|
Element Smirnov
Registered User
Join date: 13 Oct 2006
Posts: 108
|
03-24-2007 21:42
|
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
03-24-2007 22:12
I'm with Anti here...
...you were probably getting away with the initial key declaration for a while because the texture was laying within the contents of the object?
...it's very possible that the particle system improvements have 'tightened-up' the system and you will need to declare your variable correctly. PERSONALLY, I would replace the name string with a key (if you don't know the key, just right-click the texture and choose 'Copy Asset UUID', then paste in the right place (CTRL + V));
_____________________
--AeonVox--Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
|
|
ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
|
03-25-2007 08:18
From: Anti Antonelli There may be something I'm missing here, but my first reaction is "Why did it ever work? You're declaring a key and setting it to a string."
Try changing the global declaration to this and see what happens:
string g_keyTexture = "FOL_hycinth2";
edit: or leave it a key, but insert the key of the texture instead of the name. >>> Anti, you are right, it doesnt make sense, but that is the way the script was written when it was given to me and in my experience either key UUID's or names has always worked interchangably in most scripts. Replacing the global declaration with the string does work. >>> Element, Thanks, I was aware of that post. I suspect yoy are right, LL's changes to the particle system has something to do with it, but there is nothing in that post that is directly addresses this issue. Thanks anyway. >>> Ken, Yes i agree using UUID's is preferable, this particular vegetation system was made by a friend who likes to provide here customers with several textures they can change from time to time by changing the global variable reference. She is not a scripter, neither am I, but this worked for her. I just wanted to help her fix it. Thank you all for responding.
_____________________
 VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30 http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240 http://shop.onrez.com/Archtx_Edo
|
|
ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
|
03-25-2007 09:23
The recommended changes have been made to the script below, it works find now. You can either insert the name of the alpha plant texture where it says "name_of_plant" or insert the UUID key number of the texture. If you use the texture name, you have to include the texture in the contents of the object with the script. //************************************ // Created by Jimmy Thomson // Nov. 8th, 2004, Rev. March 25, 2007 // // *major remade to changing the system work* // // Description : // This script is the emiters that generate // the field of vegetation. It recieve the // parameter from the remote control, the server // side // // Copyright : // This script is Open-Source, you can use // and modify it to answer your own requirements // No need to ask permission, enjoy ;) // // Note : // I made this script in the context of a prototype // to evaluate the possibility to use particle // system to generate vegetation. It come // without garantee or technical support. Plz use // forum if you experimenting difficulties. // // Jimmy
// Defining the coverage of each emiter float MINRADIUS = 0.5 ; // Minimum distance to generate grass (makes a hole in the middle) float MAXRADIUS = 6 ; // Maximum distance to generate grass (area to cover)
// Here is the parameters of the particles system (controlled by the Server script) string g_keyTexture = "name_of_plant"; //insert texture name or UUID vector g_colParticle = <1.0, 1.0, 1.0>; vector g_vecSize = <0.5, 0.5, 0.5>; // only sx and sy matter float g_fAlpha = 0.75; float g_fDensity = 1.5;
// Here is the other parameters of the particles system (but not under the Server script) float g_fBurstRate = 0.2;
// Added for debug purpose, allowed to make the client (planters) visible // 0.0 = invisible integer g_bVisibility = 1;
// Its possible to have many remote control at once // here is the ID that have to be the same as the client string g_strSystemID = "default";
// Define the ID of the subsystem (from 0 to 4) string g_strSubsysID = "1";
default { state_entry() { llListen(9494, "", NULL_KEY, ""); // Resetting the system llParticleSystem([]); llSetLinkAlpha(0, 1.0, ALL_SIDES); llSetTimerEvent(1.0); } timer() { // we emit the particle a ramdon distance from the source float fRadius = llFrand( MAXRADIUS - MINRADIUS ) + MINRADIUS; // more away we're of the source, more particle is needed to cover the area integer iPartCount = (integer) ((2.0 * 3.1416 * fRadius * g_fDensity) * g_fBurstRate); if (iPartCount < 1) { iPartCount++; } // llWhisper(0, "fRadius = " + (string) fRadius + " g_fDensity = " + (string)g_fDensity + " iPartCount = " + (string)iPartCount ); llParticleSystem([PSYS_PART_FLAGS, PSYS_PART_INTERP_COLOR_MASK, PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE, PSYS_PART_START_COLOR, g_colParticle , PSYS_PART_START_ALPHA, g_fAlpha , PSYS_PART_END_COLOR, g_colParticle , PSYS_PART_END_ALPHA, g_fAlpha , PSYS_PART_START_SCALE, g_vecSize , PSYS_PART_END_SCALE, g_vecSize , PSYS_PART_MAX_AGE, 30.0 , // 30 is the max PSYS_SRC_ACCEL, <0,0,0> , PSYS_SRC_TEXTURE, g_keyTexture , PSYS_SRC_BURST_RATE, g_fBurstRate , PSYS_SRC_INNERANGLE, 0.0 , PSYS_SRC_OUTERANGLE, PI , PSYS_SRC_BURST_PART_COUNT, iPartCount , PSYS_SRC_BURST_RADIUS, fRadius , PSYS_SRC_BURST_SPEED_MIN, 0.0 , PSYS_SRC_BURST_SPEED_MAX, 0.0 , PSYS_SRC_MAX_AGE, 0.0 , PSYS_SRC_OMEGA, <0,0,0> ]); } listen( integer channel, string name, key id, string message ) { list list_param = llParseString2List(message, [" "], []); if((llList2String(list_param, 0) == g_strSystemID) && (llList2String(list_param, 1) == g_strSubsysID)) { g_keyTexture = llList2String(list_param, 2); g_colParticle.x = llList2Float(list_param, 3); g_colParticle.y = llList2Float(list_param, 4); g_colParticle.z = llList2Float(list_param, 5); g_vecSize.x = llList2Float(list_param, 6); g_vecSize.y = llList2Float(list_param, 7); g_fAlpha = llList2Float(list_param, 8); g_fDensity = llList2Float(list_param, 9); } } touch_start(integer num) { if (llDetectedKey(0) == llGetOwner()) { if (g_bVisibility == 0) { g_bVisibility = 1; llSetLinkAlpha(0, 1.0, ALL_SIDES); } else { g_bVisibility = 0; llSetLinkAlpha(0, 0.0, ALL_SIDES); } } } }
_____________________
 VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30 http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240 http://shop.onrez.com/Archtx_Edo
|
|
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
|
03-25-2007 10:30
Good to hear you got it working - and thanks to your friend for making that script open to use, and to you for fixing it up and posting it here 
|