Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Attached item listening for itself?

Ginge Reymont
Registered User
Join date: 10 Oct 2005
Posts: 190
11-04-2005 08:55
This is my script or can attached items not listen to themselves?


CODE
default
{
state_entry()
{
llListen(999,"","","");
}
collision(integer num_detected) {
llSay(999,"off.");
state killed;
}
listen(integer channel, string name, key id, string message)
{
if (message == "off")
{
state killed;
}
}
}

state killed
{
state_entry()
{

}
}
Thraxis Epsilon
Registered User
Join date: 31 Aug 2005
Posts: 211
11-04-2005 09:05
No an item can not listen to itself
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
11-04-2005 09:17
Nor should it need to. In the example code you posted above, replace the llSay(999,...) and all the associated listen code can be dropped. The statement "state killed;" inside the collision is enough.

If you are looking to also have manual control on the killing, you can keep the listen and talk to it by chatting "/999 off". If you wish to do this you should limit the listener like so:
CODE

default() {
state_entry() {
// only trigger listen event on command "off" by owner on chan 999
llListen(999, "", llGetOwner(), "off");
}

collision_start(integer i) {
state killed;
}

listen(integer c, string n, key k, string m) {
// don't need to do any testing of c, k, or m here as the llListen already "checked" em
state killed;
}
}

state killed {
....
}
_____________________
Ginge Reymont
Registered User
Join date: 10 Oct 2005
Posts: 190
11-04-2005 09:26
No there is another object involved thats why...
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
11-04-2005 14:55
Everyone else pretty much already has it, but yea...objects cannot listen to themselves...and they should never have to listen to themselves. If there is another object involved...have your object listen to that one.

Anything your object does to itself should not require it to listen to itself.
_____________________
--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.
Oasis Perun
Registered User
Join date: 2 Oct 2005
Posts: 128
maybe this??
11-13-2005 11:31
Hey yal.. i remembered this post when i ran across this in the Wiki today... llMessageLinked(LINK_THIS, 0, "Touched.", NULL_KEY);//sends a linked msg to all the other scripts in the same prim.

dont know how much help this is but the full example is here::

http://secondlife.com/badgeo/wakka.php?wakka=ExampleLinkMessage


PS:

does anybody know how this would compare to using notecards to store users defined settings? you could still "hide" the main code just have the 2nd script respond to value requests from the 1st via llMessageLinked.