Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Puzzled

Kokoro Fasching
Pixie Dust and Sugar
Join date: 23 Dec 2005
Posts: 949
03-08-2006 07:51
I have put together these two scripts from various sources, and when I issue the command to turn on, it turns on just for 1 cycle of the particle, then stops. If I use the particle by itself it works fine.

The BaseCommand script is in the base object, which was the last item selected before making the link. The other script is in each child item

Control Script
CODE

key owner;
integer listenID;


init()
{
owner = llGetOwner(); //get owner's key
llListenRemove(listenID); //remove any previous listen
listenID = llListen(1,"",owner,""); //setup a listen for current owner
}

integer mfCompare(string required, string message)
{
if (llSubStringIndex(llToLower(message), llToLower(required)) == 0) { return TRUE;}
return FALSE;
}

default
{
//state_entry - launches whenever the script is reset (or on change of
//state but this script doesn't use other states!)
state_entry()
{
init();
}

//on_rez - launches whenever the object is rezzed
on_rez(integer times)
{
init();
}

//listen - when something is said that matches the llListen setup in init()
//this function will run, with message = what was said
listen(integer channel, string name, key id, string message)
{
//checks to see if what the owner has said matches the cmd string, if it does then
//we going inside the if statement
if (mfCompare("bling off",message)) {
llMessageLinked(LINK_SET, 0,"BOFF",NULL_KEY);
}
if (mfCompare("bling on",message)) {
llMessageLinked(LINK_SET, 0,"BON",NULL_KEY);
}
}
}


child prim script:
CODE

integer iBlingState = TRUE;

TurnBlingOn()
{
llParticleSystem([ 7,0.3,0,291,5,<0.04,0.25,0.0>,6,<0.03,0.25,0.0>,9,2,13,0.309999,15,20,17,0.1,18,0.1]);
iBlingState = TRUE;
}

TurnBlingOff()
{
llParticleSystem([]);
iBlingState = FALSE;
}


default
{
link_message(integer sender_num, integer num, string sMsg, key id)
{
if (sMsg == "BON")
{
TurnBlingOn();
};
if (sMsg = "BOFF")
{
TurnBlingOff();
};
}
}


Everything looks like it should turn on and stay on, but it doesn't. Any ideas?
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
03-08-2006 08:21
Sorry, I didn't look at this carefully, but I've been nervous about these unnecessary semi colons.
From: Kokoro Fasching
CODE
default
{
link_message(integer sender_num, integer num, string sMsg, key id)
{
if (sMsg == "BON")
{
TurnBlingOn();
};<---
if (sMsg = "BOFF")
{
TurnBlingOff();
};<---
}
}
_____________________
:) Seagel Neville :)
Kelly Linden
Linden Developer
Join date: 29 Mar 2004
Posts: 896
03-08-2006 08:25
Your second IF in the child script is incorrect. It currently is if (sMsg = "BOFF";) but it needs to be if (sMsg == "BOFF";)
_____________________
- Kelly Linden
Marcus Moreau
frand
Join date: 25 Dec 2004
Posts: 602
03-08-2006 08:40
Just a few things that may not be the cause:

- The bitmask for PSYS_PART_FLAGS seems really high in your case (0,291). You're only using scale (and maybe wind, etc).
- You could mess with PSYS_SRC_MAX_AGE, although I thought the default if not set was basically infinite.
- Just an elegance question: do you need the iBlingState boolean?
- You might change your particle attributes to the actual string labels (or keep a version of that string around somewhere) - makes trouble shooting a bit easier. At least for me.

I see these other two replies, which may have more to offer for your problem. My suggestions are only coding cleanups.

MM
_____________________
Marcus Moreau

Disenfranchised island owner...

"This statement is false."
User #121869 or something close
Kokoro Fasching
Pixie Dust and Sugar
Join date: 23 Dec 2005
Posts: 949
03-08-2006 09:17
Thank you all - it was the second IF statement.. and I wasn't seeing it no matter how much I looked at it. :)

I removed the extra ; also, just in case. The logical's are part of future expansion.. I wanted to get each section working first, and not have to try to debug a huge script. *grin*
Marcus Moreau
frand
Join date: 25 Dec 2004
Posts: 602
03-08-2006 09:24
From: Kokoro Fasching
Thank you all - it was the second IF statement.. and I wasn't seeing it no matter how much I looked at it. :)

I removed the extra ; also, just in case. The logical's are part of future expansion.. I wanted to get each section working first, and not have to try to debug a huge script. *grin*


Yeah, I figured that might be the case. Wasn't trying to nitpick. :) Glad you got it working!

MM
_____________________
Marcus Moreau

Disenfranchised island owner...

"This statement is false."
User #121869 or something close