Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

email events being recieved in multiple prims...

Dragon Eccleston
Registered User
Join date: 25 Dec 2005
Posts: 42
08-12-2006 19:55
I've been noticing that sometimes an llGetNextEmail() call in a child prim will trigger the email() events in both that child and sometimes the root prim as well. Text code:

email reciever:
CODE

default
{
state_entry()
{
llSetTimerEvent(5);
llGetNextEmail("", (string)llGetLinkNumber()); //Get email sent to this prim only
}
timer()
{
llGetNextEmail("", (string)llGetLinkNumber()); //Get email sent to this prim only
}
email(string time, string address, string subject, string message, integer num_remaining)
{
if ((integer)subject == llGetLinkNumber())
llOwnerSay("Prim " + (string)llGetLinkNumber() + " asked for this e-mail, and there are " + (string)num_remaining + " left for me to get!");
else
llOwnerSay("Prim " + (string)llGetLinkNumber() + " got an e-mail sent to prim " + subject + ", I think I have " + (string)num_remaining + " left, but I probably don't...");
if (num_remaining)
llGetNextEmail("", (string)llGetLinkNumber()); //Get email sent to this prim only
}
}


email sender:
CODE

integer NUM_MAILS = 1; // lets you vary the number of test messages it sends

default
{
state_entry()
{
integer i;
for (i = 0; i < NUM_MAILS; ++i)
llEmail((string)llGetKey() + "@lsl.secondlife.com", (string)llGetLinkNumber(), "testing one two three"); // Send email to containing prim with the link number as the subject to differentiate all the emails
llOwnerSay("emails sent");
llRemoveInventory(llGetScriptName());
}
}


Now create an object with at least 3 prims, place the email reciever scripts in all prims. Here's where things get funny, because SL doesn't always redirect the events, just sometimes, and it doesn't always redirect them from all child prims, sometimes just one. First drop a copy of email sender in each prim to verify it works, should get this:

[19:39] Object: Prim 1 asked for this e-mail, and there are 0 left for me to get!
[19:39] Object: Prim 2 asked for this e-mail, and there are 0 left for me to get!
[19:40] Object: Prim 3 asked for this e-mail, and there are 0 left for me to get!

Tho you may start getting the error messages right away, if you don't start playing with the scripts, delete/re-add the reciever scripts, add multiple sender scripts, do any other strange thing, after a while you'll probably start getting things like this:

[19:39] Object: Prim 1 asked for this e-mail, and there are 0 left for me to get!
[19:39] Object: Prim 2 asked for this e-mail, and there are 0 left for me to get!
[19:40] Object: Prim 1 got an e-mail sent to prim 3, I think I have 0 left, but I probably don't...
[19:40] Object: Prim 3 asked for this e-mail, and there are 0 left for me to get!

Which was the real output from my test initialization above, then I went back after I typed this up and suddenly prim 3 was fine, however dropping a few email senders in prim 2 resulted in the following:

[19:42] Object: Prim 3 asked for this e-mail, and there are 0 left for me to get!
[19:42] Object: Prim 3 asked for this e-mail, and there are 0 left for me to get!
[19:42] Object: Prim 1 got an e-mail sent to prim 2, I think I have 1 left, but I probably don't...
[19:42] Object: Prim 2 asked for this e-mail, and there are 1 left for me to get!
[19:42] Object: Prim 1 got an e-mail sent to prim 2, I think I have 0 left, but I probably don't...
[19:42] Object: Prim 2 asked for this e-mail, and there are 0 left for me to get!

At first prim 1 was getting prim 3's email events, now it's getting prim 2's, but not prim 3's. Oh wait I just checked again:

[19:45] Object: Prim 1 got an e-mail sent to prim 2, I think I have 0 left, but I probably don't...
[19:45] Object: Prim 2 asked for this e-mail, and there are 0 left for me to get!
[19:45] Object: Prim 1 got an e-mail sent to prim 3, I think I have 0 left, but I probably don't...
[19:45] Object: Prim 3 asked for this e-mail, and there are 0 left for me to get!

all child email events are being registered by the root prim, and now:

[19:47] Object: Prim 3 asked for this e-mail, and there are 0 left for me to get!
[19:47] Object: Prim 2 asked for this e-mail, and there are 0 left for me to get!
[19:48] Object: Prim 3 asked for this e-mail, and there are 0 left for me to get!
[19:48] Object: Prim 2 asked for this e-mail, and there are 0 left for me to get!

no child email events are being registered by the root prim. In less than 10 minutes of writing this post the email event in the root prim has demonstrated 4 different behaviors... I presume the last behavior is the correct one, the email events going to the child and the child alone. Has anyone else seen this?

As a side note I attached the object being tested to my HUD to make it easier to work with, however I've done testing with objects on the ground and seen similar results.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-13-2006 00:24
Doesn't surprise me. Be careful of 'money' events too....
Dragon Eccleston
Registered User
Join date: 25 Dec 2005
Posts: 42
08-13-2006 07:25
This is different than the money event thing, the money events act like all touch and collision events, i.e. the root prim events carry over to children unless the children have their own events to deal with it. The email event is behaving differently with all other conditions being equal.