Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetNextEmail only works in basic scipts

Sascha Ryba
Registered User
Join date: 13 Oct 2007
Posts: 8
11-03-2007 09:45
Hi folks,

I wanted to add an email-receiving functionality to an object...

I first tried out llGetNextEmail with a seperate script, it worked fine! Then I added the same code into my already prepared script of the object and it did not work anymore.

Here's the code of the different scripts:

Basic, testing-only script:

default
{
state_entry()
{

}

touch_start(integer totalnumber)
{
llGetNextEmail("", "";);
llSay(0, "check";);
}

email(string time, string address, string subj, string message, integer num_left)
{
llSay(0,"mail! " + (string)num_left + " remaining";);
}
}

Now the part where I included the same funtionality into my second script, which did not work:

default
{
state_entry()
{
aktStatus = statusStehend;
llSay(0, "Script gestartet";);
llSetText("Ich bin ein Demozug! Klick mich an!",<1.0,0.0,0.0>,1.0);
llSetStatus(STATUS_PHYSICS, TRUE);
llSetStatus(STATUS_ROTATE_X, FALSE);
llSetStatus(STATUS_ROTATE_Y, FALSE);
llSetStatus(STATUS_BLOCK_GRAB, TRUE);
}

touch_start(integer total_number)
{
llSay(0, "Touched.";);
llGetNextEmail("","";);
state searching;
}

email(string time, string address, string subj, string message, integer num_left)
{
llSay(0,"mail! " + (string)num_left + " remaining";);
}
}

Where is my mistake? email() is never called, even though I sent several mails to the object...
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
11-03-2007 09:50
It looks like it's changing to a different state. That would do it.
_____________________
Sascha Ryba
Registered User
Join date: 13 Oct 2007
Posts: 8
11-03-2007 09:56
yeah, but the state change occurs AFTER the mail-check... or is there a timelag in which the script performs the state-change and "forgets" to call email()?
Stephen Zenith
Registered User
Join date: 15 May 2006
Posts: 1,029
11-03-2007 10:08
The email even *can't* be called until your touch_start event has ended. However, by the time it finishes, your code is no longer in a state that can handle emails!

I'd put the call to llGetNextEmail in the state_entry event in your searching state, and move the email event there too.
_____________________
Starfire Desade
Can I play with YOUR mind
Join date: 10 Jul 2006
Posts: 404
11-03-2007 10:12
Why are you changing states? You tell it to get the next email, and it starts... then you jump to the next state before your email function can finish and report the email.

If you want a searching state, put the email stuff in that state.
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
11-03-2007 10:49
Yep, you have to change states within the email event, after checking the email. Otherwise it'll never get checked, because changing states before the event is resolved clears the event queue.
_____________________