Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

I need help please

Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
11-02-2005 13:45
Hello,
I thought that I could get this to work, I've stumbled around, to me it looked right but it doesn't work. Can some nice person please look at this code and tell me where I went wrong.
Thank you all so very much.
CODE

default
{
state_entry()
{
key id = llGetOwner();
llListen(3,"","","");
}
changed(integer change)
{
if (change & 128)
{
llResetScript();
}
}
listen(integer channel,string name,key id,string message)
{
if (message == "stop")
{
llLoopSound ("j3turbo", 0.0); // I want to turn the sound off, this way seems to work. LOL, its hard not being a coder
llSetColor(<0.5,0.5,0.5>, ALL_SIDES);
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_METAL]);
}
{if (message == "start")
llLoopSound ("j4turbo", 20.0);
llSetColor(<1,0,0>, ALL_SIDES);
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_LIGHT]);
}
}
}

cua Curie
secondlifes.com/*****
Join date: 14 Nov 2003
Posts: 196
11-02-2005 13:54
This should do what you want. No idea what you were attempting with the change event, so I took it out.

CODE
default
{
state_entry()
{
key id = llGetOwner();
llListen(3,"","","");
}

listen(integer channel,string name,key id,string message)
{
if (message == "stop")
{
llStopSound(); // I want to turn the sound off, this way seems to work. LOL, its hard not being a coder
llSetColor(<0.5,0.5,0.5>, ALL_SIDES);
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_METAL]);
}

if (message == "start")
{
llLoopSound ("j4turbo", 1);
llSetColor(<1,0,0>, ALL_SIDES);
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_LIGHT]);
}
}
}
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
11-02-2005 14:00
In the state_entry() event, you set some variable called "id", but you don't use it anywhere ?
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
11-02-2005 14:02
IIRC, that changed event is apparently an undocumented constant that stands for "changed owner".

When you say the script doesn't work... what doesn't work? What do you want it to do? Are you typing /3 start and /3 stop to try and activate it?
Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
11-02-2005 14:08
The color change and the change from metal to light, and back didn't work.

From: Ziggy Puff
IIRC, that changed event is apparently an undocumented constant that stands for "changed owner".

When you say the script doesn't work... what doesn't work? What do you want it to do? Are you typing /3 start and /3 stop to try and activate it?
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
11-02-2005 14:21
I think I see a potential bug. Try this:

CODE

default
{
state_entry()
{
key id = llGetOwner();
llListen(3,"",id,"");
}

listen(integer channel,string name,key id,string message)
{
if (message == "stop")
{
llStopSound(); // I want to turn the sound off, this way seems to work. LOL, its hard not being a coder
llSetColor(<0.5,0.5,0.5>, ALL_SIDES);
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_METAL]);
}

if (message == "start")
{
llLoopSound ("j4turbo", 1);
llSetColor(<1,0,0>, ALL_SIDES);
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_LIGHT]);
}
}
}


Or this:

CODE

default
{
state_entry()
{
key id = llGetOwner();
llListen(3,"",NULL_KEY,"");
}

listen(integer channel,string name,key id,string message)
{
if (message == "stop")
{
llStopSound(); // I want to turn the sound off, this way seems to work. LOL, its hard not being a coder
llSetColor(<0.5,0.5,0.5>, ALL_SIDES);
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_METAL]);
}

if (message == "start")
{
llLoopSound ("j4turbo", 1);
llSetColor(<1,0,0>, ALL_SIDES);
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_LIGHT]);
}
}
}


The first version should listen only to the owner, the second should listen to anyone. And make sure you're issuing the commands on channel 3, i.e. type "/3 start" (without the quotes).
cua Curie
secondlifes.com/*****
Join date: 14 Nov 2003
Posts: 196
11-02-2005 14:50
The reason it wouldn't work in the orignal was there was a bracket issue. I fixed that. The script worked fine after that.

If you want to set it up to allow only the owner to activate the script, and you intend to transfer it to other people then go ahead and put the changed owner code back in. Otherwise you don't need it and it wasn't the problem. I just removed it to simplfy the issue and forgot to take out the variable in state entry.
_____________________
"It is better to keep your mouth shut and appear stupid than to open it and remove all doubt." - Mark Twain

"We are what we pretend to be, so we must be careful what we pretend to be." - Kurt Vonnegut
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
11-02-2005 14:56
Ah. Thanks. I didn't realize you'd changed something in the script besides the llStopSound, and I didn't know if "" worked as a null key. Sorry about that :)
Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
11-02-2005 15:13
Thank you all so very much for fixing this. I was pulling my hair out trying to get it to work.
Thank you