When an avatar sits on one of the seats they receive a greeting message and some instructions.
This is fine for one avatar..but as soon as another avatar sits (or stands up), everyone on board receives the greetings message again. This gets annoying after a while.
I have been trying to find a way to send the message only once to each avatar, but the change & CHANGED_LINK event keeps triggering in all links no matter what I try.
I am sure I am missing some simple technique....any suggestions would be greatly appreciated
The script below is used in each of the seats....
CODE
// Ferry seat script
// 1. Sets sit position
// 2. Receives Greeting message from Relay Script (notecard reader)
// 3. Detects Avatar and First Name
// 4. IM's the avatar with Greeting Message and Instructions
// 5. Starts sit or other animation
//============== GLOBAL VARIABLES ==================
// Postion and Rotation of avatar relative to the centre of the object
vector pos = <0.2, -0.75, -0.42>;
vector rot = <90.0,0.0,0.0>;
string greeting;
//============== SCRIPT START ==================
default
{
state_entry()
{
llSitTarget(pos, llEuler2Rot(rot*DEG_TO_RAD));
}
link_message(integer sender_num, integer num, string str, key id)
{
if (num == -6)
{
greeting = str;
}
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
if (llAvatarOnSitTarget() != NULL_KEY)
{
key avatar = llAvatarOnSitTarget();
string Name;
string FirstName;
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
Name = llKey2Name(avatar);
FirstName = llGetSubString(Name, 0, llSubStringIndex(Name, " ") - 1);
llInstantMessage(avatar, "Hello " + FirstName + " " + greeting);
llSleep(1);
llInstantMessage(avatar, "You can stop the boat once in each region by touching the towel");
}
}
}
run_time_permissions(integer perm)
{
string anim = llGetInventoryName(INVENTORY_ANIMATION, 0);
if (anim != "")
{
llStopAnimation("sit");
llStartAnimation(anim);
}
}
}
//============== SCRIPT END ==================


