About the death and rebirth of my auto greeter

 One of the peculiarities of lsl scripts is that like any other programming language, they evolve over time. Inevitably some very old things can stop working properly.

An example is an automated greeter that sends a welcome message to all visitors. Additionally it also maintains a list with the last 100 visitors.

Since I built it in 2007 or 2008 I have never sold more than 5 or 6. One of the reasons is that there is one that is free and uses an external LAMP server (Linux + Apache + MySql + PHP) or similar.

It is also true that I must have updated it a few times since then. Other scripters even having the competition of the free greeter have considerably improved their scripts by adding other features that the free greeter does not have.

I have recently observed that my automated greeter is not working properly when click the option to list the last 100 visitors. It only shows the first 64 in the list, then it stops.

At first I did not know how to diagnose what was happening. The script that maintains the database has to send the visitors one by one to the main script and send them to the owner through a llOwnerSay ().

I put a lot of llOwnerSay of traces and the messages just didn't get through.I opted to completely redo the script while keeping and improving some features such as multi-language support. I removed the llSensor () and changed it to llGetAgentList().

I no longer use a different script for each supported language. I have a different text note for each language and I have the code in the main script. However, I have decided to have the database in a different script so that I can have more information such as the date and time of arrival and how long the visit lasted.

I've been testing the new greeter for a season and when I hit 100 visits, I was disappointed that I still had the same problem.

To investigate what was the cause I made two scripts and put them in a primitive, managing to reproduce the problem.

This source script sends 100 messages when i click on the prim.

default
{
    state_entry()
    {
        
    }

    touch_start(integer total_number)
    {
        integer counter;
        for(counter = 0; counter < 100; counter++)
        {
            llMessageLinked(LINK_THIS, counter, "************************", NULL_KEY);
        }
        llOwnerSay("Done.");
    }
}

This other script receives the linked messages.

default
{
    state_entry()
    {
        llSetText(".", <1.0, 1.0, 1.0>, 1.0);
    }

    link_message(integer sender, integer value, string text, key id)
    {
         llSetText(". : " + (string) value, <1.0, 1.0, 1.0>, 1.0);
    }

    touch_start(integer total_number)
    {
        llSetText(".", <1.0, 1.0, 1.0>, 1.0);
    }
}

Only the first 64 messages arrive. One of the things that I have noticed is that now the call llMessageLinked () is not blocking at all nor does it have lag.

I don't remember if it was blocking in the past but it wasn't as immediate as it is now.

I gather that at some point LL has added a message queue with a capacity of 64 messages and discards all that arrive if the queue is full.

I have added a small delay every 10 messages, I hope that with that the script will work again. I'll see what happens when I have over 100 visitors again.

I have also observed a very curious peculiarity, the script that sends a message can also receive the same messages. Before that did not happen. This is probably a side effect of the message queue.



Comments

Popular posts from this blog

Linksets in SecondLife (2)

Linksets in SecondLife (1)