Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

sending multiple IM's from welcome mat

Tashi Insoo
Registered User
Join date: 27 Feb 2007
Posts: 4
01-04-2009 10:20
I use the following script at my store. It sends me as owner an IM telling me a client has arrived, I would like to modify it so I can insert the keys to my salespeople so that they would also receive the IM. I would need to be able to add different people and i don't mind playing inside the script, don't need a notecard. Any help would be appreciated.

START
string welcome;

// Global variables
list visitor_list;
float range = 3.0; // in meters
float rate = 1.0; // in seconds


// Functions
integer isNameOnList( string name )
{
integer len = llGetListLength( visitor_list );
integer i;
for( i = 0; i < len; i++ )
{
if( llList2String(visitor_list, i) == name )
{
return TRUE;
}
}
return FALSE;
}

init()
{
welcome = llGetObjectDesc();
llOwnerSay( "Visitor List Maker started...";);
llOwnerSay( "The owner can say 'help' for instructions.";);
llSensorRepeat( "", "", AGENT, range, TWO_PI, rate );
llListen(0, "", llGetOwner(), "";);
}
// States
default
{
state_entry()
{
init();
}
on_rez( integer param )
{
init();
}
touch_start( integer num )
{
welcome = llGetObjectDesc();
}

sensor( integer number_detected )
{
integer i;
for( i = 0; i < number_detected; i++ )
{
if( llDetectedKey( i ) != llGetOwner() )
{
string detected_name = llDetectedName( i );
if( isNameOnList( detected_name ) == FALSE )
{
llInstantMessage( llDetectedKey( i ), welcome + detected_name);
visitor_list += detected_name;
llInstantMessage(llGetOwner(), "Tashi's Toys landing at " + llGetRegionName() + " has just detected " + llKey2Name(llDetectedKey(0)) + "!";);
llGiveInventory(llDetectedKey(0), "Tashi's Toys";);
}
}
}
}

listen( integer channel, string name, key id, string message )
{
if( id != llGetOwner() )
{
return;
}

if( message == "help" )
{
llOwnerSay( "This object records the names of everyone who" );
llOwnerSay( "comes within "+ (string)range + " meters." );
llOwnerSay( "Commands the owner can say:" );
llOwnerSay( "'help' - Shows these instructions." );
llOwnerSay( "'say list' - Says the names of all visitors on the list.";);
llOwnerSay( "'reset list' - Removes all the names from the list." );
llOwnerSay ( "TO change the greeting - change the object description and touch the object" );
}
else
if( message == "say list" )
{
llOwnerSay( "Visitor List:" );
integer len = llGetListLength( visitor_list );
integer i;
for( i = 0; i < len; i++ )
{
llOwnerSay( llList2String(visitor_list, i) );
}
llOwnerSay( "Total = " + (string)len );
}
else
if( message == "reset list" )
{
visitor_list = llDeleteSubList(visitor_list, 0, llGetListLength(visitor_list));
llOwnerSay( "Done resetting.";);
}
}
}
END
ab Vanmoer
Registered User
Join date: 28 Nov 2006
Posts: 131
01-04-2009 10:27
If you don't want the hassle of trying to modify the script yourself you might want to take a look at http://www.xstreetsl.com/modules.php?name=Marketplace&file=item&ItemID=1087756
which does what you are looking for.
Regards,
ab
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
01-04-2009 11:11
If you don't mind modifying the script yourself, write a statement that says something like

key Bob = "00000000-0000-0000-0000-000000000000";

where you use the key for Bob's avatar instead of the zeroes. Then duplicate the statement that says

llInstantMessage(llGetOwner(), "Tashi's Toys landing at " + llGetRegionName() + " has just detected " + llKey2Name(llDetectedKey(0)) + "!";);

and substitute Bob for llGetOwner(). Your code block will look like

CODE

llInstantMessage(llGetOwner(), "Tashi's Toys landing at " + llGetRegionName() + " has just detected " + llKey2Name(llDetectedKey(0)) + "!");
key Bob = "66864f3c-e095-d9c8-058d-d6575e6ed1b8";
llInstantMessage(Bob, "Tashi's Toys landing at " + llGetRegionName() + " has just detected " + llKey2Name(llDetectedKey(0)) + "!");
CODE


Do the same for Sally, Pete, and Abdul and you're set to go.
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
01-04-2009 11:38
What's the advantage to or difference between using "llKey2Name(llDetectedKey(0))" over "llDetectedName(0)"?
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
01-04-2009 11:44
From: SuezanneC Baskerville
What's the advantage to or difference between using "llKey2Name(llDetectedKey(0))" over "llDetectedName(0)"?

..none - in fact you could expect it to be less reliable, e.g. on user crash.

/esc

Re: your forum tag Suezanne... the release version of Chrome sucks a great deal less. Have you tried it recently?
_____________________
http://slurl.com/secondlife/Together
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-04-2009 12:11
Keep in mind that there is a significant script delay for each call to llInstantMessage(). Often this kind of system that distributes messages to multiple people will be broken up into several scripts to alleviate some of that delay using concurrency. It's also a nice way to set things up to have each script know who it should send the message to and the main script just saying "send out this message to the group". You can even setup the script so that you don't have to open it up for each new recipient: just copy the script, edit the name to include the recipient's key, and plop it in your object. The trickiest part of that is probably breaking llGetScriptName() to get the key out of it.

From: Escort DeFarge
Re: your forum tag Suezanne... the release version of Chrome sucks a great deal less. Have you tried it recently?


Eh? That I know of it is still in Beta. Did you see some news about it being released? :confused:
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
01-04-2009 12:27
The significant script delay is something like 2 seconds on each llInstantMessage call, which is an eternity but still probably not a nasty wait for the user, I would guess. Unless this is a high traffic area, IMs aren't going to pile up and cause trouble. If it is a heavy traffic area, the user is going to really regret sending that monster stack of annoying IMs to himself and all the sales crew.
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
01-04-2009 12:29
From: Hewee Zetkin



Eh? That I know of [Chrome] is still in Beta. Did you see some news about it being released? :confused:

http://googleblog.blogspot.com/2008/12/google-chrome-beta.html
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
01-04-2009 12:36
From: Escort DeFarge
the release version of Chrome sucks a great deal less. Have you tried it recently?
It is supposed to update automatically. It says it's up to date. Shows version 1.0.154.42.
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-04-2009 13:18


Huh. And STILL no Linux version. Can you believe LL did a better job than Google? LOL.
Thanto Usitnov
Lord Byron wannabe
Join date: 4 Aug 2006
Posts: 68
01-04-2009 16:42
I think the best way to implement it is to have one script for each person you want to IM, and have each one listen for link messages. When the main script's sensor detects something, have it send a link message to itself with the name of the person detected, which the tertiary IM scripts will pick up and forward to their targets. This way, the delay between IMs is a constant 2 second delay, regardless of how many sales people you have - each one should get the message at the same time.

Each tertiary script should be fairly simple - on link message, send an IM to the target sales person with the info from the link message. Each one should be identical except for the person being targeted by the IM.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-04-2009 18:38
couldn't you use a list of keys and run the im through a loop? or would the delay mess that up?
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
01-04-2009 19:31
That's sort of what I suggested, although in a less elegant stack instead of a loop. I assume that the 2 second delay will simply separate execution of one IM call from the next, not cause them to pile up. I haven't tried it, though.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-04-2009 19:39
well what i meant was, does the delay cause the script to sleep like llSetPrimitiveParams, or does it cause to sometimes skip a call when running llInstantMessage thru a loop?
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
01-04-2009 19:48
That's what I thought you meant. I dunno.

EDIT: OK, so I just tried this in world .....

CODE

default
{
state_entry()
{
integer i;
for (i=1; i<20; i++)
{llInstantMessage(llGetOwner(), "Message #" +(string)i);}
}
}


It sent a perfect series of IMs, spaced about 2 seconds apart, without skipping a beat or dropping a message. Of course that's all to the same key (mine), but as a test of whether you can loop IMs reliably, it's at least a reassuring answer.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-04-2009 19:59
From: Ruthven Willenov
well what i meant was, does the delay cause the script to sleep like llSetPrimitiveParams, or does it cause to sometimes skip a call when running llInstantMessage thru a loop?

Sleeps. I'm not aware of IM's getting dropped, though it's possible. Certainly they can be delayed (I've seen as much as hours between function call and delivery). But I suspect that's more a problem with the IM subsystem as with the LSL function.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-04-2009 20:18
ah ok, all i needed to know, also, i have used the same script but instead of using the sensor i changed to a collision to get rid of the sensor lag. i have it listening on a negative channel for NULL_KEY and on a seperate prim i have a dialog menu that can be accessed by group members with touch (i would implement the menu into the same script, but the menu has commands for other devices as well. maybe later on i'll work on putting the menu together with it, the problem with that is, this user is using the touch to set the welcome message derived from the object description. would it be any laggier to just call that from each sensor (or in my case collision)? IE:

llInstantMessage( llDetectedKey( i ), llGetObjectDesc() + detected_name);
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369