Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Welcome mat script that notifies others besides owner

Jo Yardley
Registered User
Join date: 25 Feb 2009
Posts: 76
05-26-2009 06:11
Hello all.

After spending a fortune on the complicated and not so good working hippovisit system and finding free scripts that worked just as well, I am very happy with my new welcome mat.
It does what I want it to do, it says welcome, gives a LM, a note, the rules, etc.
BUT, there is one thing that I did like about the hippovisit thing (IF it would have worked without my managers all having to buy the system as well...) and that is that it notifies others besides me of visitors to my sim.

I am looking for a script that sends a IM to people I choose, no complicated huds that start beeping, no flashy mess, just a basic IM.
Is there a welcome mat script out there that does this?
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
05-26-2009 06:23
From: Jo Yardley
I am looking for a script that sends a IM to people I choose, no complicated huds that start beeping, no flashy mess, just a basic IM.
Is there a welcome mat script out there that does this?
What do yo you want the IM to say? You have to be much more specific if you want answers to your needs.
Besides that the question should be in 'products wanted' and not in this forum I think.
_____________________
From Studio Dora
Jo Yardley
Registered User
Join date: 25 Feb 2009
Posts: 76
05-26-2009 06:25
From: Dora Gustafson
What do yo you want the IM to say? You have to be much more specific if you want answers to your needs.
Besides that the question should be in 'products wanted' and not in this forum I think.


Oh I'm sorry, I thought it belonged in scripts.
What I want is a "door mat" that tells me and other people who is visiting my sim, I want it to alert them by a IM.
So someone visits my sim, crosses the mat and a IM is send to me: "mr x is visiting your sim", all doormats and welcome scripts do this already.
I wonder what the script would be that also sends a IM like that to my managers.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
05-26-2009 07:32
When you write your script, just include an llInstantMessage statement for each person to whom you want a message to go. All you need to know is their Keys. If you have several managers, you can put their keys in a list and call them up in a loop, something like this ...

CODE

collision(integer num_detected)
{
string avName = llDetectedName(0);
list managers = ["key for manager1", "key for manager2", "key for manager3"];
// Make the managers list as long as you like
integer manyHeads = llGetListLength(managers);
integer i;
for (i = manyHeads-1;i <= 0;--i)
{
llInstantMessage(llList2Key(managers,i), avName + " has just tripped over your doormat.");
}
}
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
05-27-2009 09:40
Somewhere in this forum I saw a really clever way of doing this, which makes the list of managers easy to maintain and also gets round the 2 second delay caused by llInstantMessage().

In the main script, have
CODE
  collision_start(integer num)
{
//do stuff to give notecards and lms
llMessageLinked(LINK_THIS,0,llDetectedName(0),llDetectedKey(0));
}

and then have a separate script for each manager, in the same prim, and use the manager's uuid as the name of the script:
CODE
key staff_member;
default
{
state_entry()
{
staff_member = (key)llGetScriptName();
if(staff_member){
//it's ok so don't say anyting
}
else {
llOwnerSay("not a valid key");
}
}

link_message(integer sender, integer num, string str, key id)
{
llInstantMessage(staff_member, str+", whose uuid is "+(string)id+", has just entered the shop");
}
}

Question -- I've put this together from memory; is there a better way of warning you if you've not used a valid key as the script's name?
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
05-27-2009 10:31
I don't think I'd worry too much about not getting the staff member's key right. After all, you only have to do it once, when you're setting up the script in the first place. The easiest way to do it, though, is to just to include a line in state_entry that says

llSetObjectDesc((string) llGetOwner());

and give a copy of the device to each manager. As soon as the object is activated, its description will automatically be set to the manager's UUID. Pick up the key from the object description when you need it, not from the script name.

Actually, unless this is a VERY high traffic area, I really wouldn't worry about the 2 second delay in an IM either. Does it really matter whether a manager has to wait 2 seconds to hear that someone has entered the shop? (If it IS a high traffic area, your managers will be ready to throttle you with the spam from this device and won't wait 2 seconds to do it either. :rolleyes: )
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-27-2009 13:24
From: Rolig Loon
I don't think I'd worry too much about not getting the staff member's key right. After all, you only have to do it once, when you're setting up the script in the first place. The easiest way to do it, though, is to just to include a line in state_entry that says

llSetObjectDesc((string) llGetOwner());

and give a copy of the device to each manager. As soon as the object is activated, its description will automatically be set to the manager's UUID. Pick up the key from the object description when you need it, not from the script name.

and how to get multiple manger keys in a single prim? ;)

although actually I have a way using names...
object is touched by the manager, sets it's name to the manger key, then the object is dropped inside another prim along with a copy of the messaging script (which will be autonumbered) that ends with " -"
CODE

state_entry(){
target = (key)llGetInventoryName( INVENTORY_OBJECT, llGetSubString( llGetScriptName(),-2, -1 ) );
}
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
05-27-2009 17:49
OK, I was in a playing mood today. Here's a script that does what the OP wants. You can feed it the names and keys of managers in either of two ways. If you put them on a notecard in the doormat's inventory, each line should have a manger's name and key, separated by an equal sign, like this

Bob Smith = 953d10f1-44bf-462a-8bc1-f656333ea031.

Alternatively, you (the owner) can create a manager list by typing a manager's name and having the manager click on the doormat to confirm it and store his/her key. The owner can generate a list of managers with their keys and can remove a manager from the list with simple commands. The system is reasonably tamper-proof so long as you set the doormat to no mod. You communicate with the doormat on a random channel which you (and only you) get by clicking on the doormat.

CODE

// Namelist Doormat
// by Rolig Loon -- May 2009
integer CHAN;
integer update = FALSE;
string newName = "";
list managers = [];
string gName;
integer gLine = 0;
key gQueryID;

default
{
state_entry()
{
if (llGetInventoryNumber(INVENTORY_NOTECARD) != 0)
// You may read manager names and keys from a notecard if you wish.
// Each line should look like this .... Manager Name = 66864f3c-e095-d9c8-058d-d6575e6ed1b8
{
gLine = 0;
gName = llGetInventoryName(INVENTORY_NOTECARD, 0);
gQueryID = llGetNotecardLine(gName, gLine);
}
}

dataserver(key query_id, string data)
{
if (query_id == gQueryID)
{
if (data != EOF)
{
managers = llParseString2List(data,[" = "],[]);
++gLine;
}
}
}

listen(integer channel,string name, key id, string message)
{
string DoThis = llToLower(llGetSubString(message,0,2));
newName = llGetSubString(message,4,llStringLength(message)-1);
if (DoThis == "add")
{
if (newName == "")
{
llOwnerSay("No name was provided after \""+ (string)CHAN +" add \"");
}
else
{
update = TRUE;
llOwnerSay("Please tell "+newName+" to click on the doormat now.");
}
}
else if (DoThis == "zap")
{
integer pos = llListFindList(managers,[newName]);
if(pos != -1)
{
managers = llDeleteSubList(managers,pos,pos+1);
llOwnerSay(newName + " has been removed.");
}
else if (newName == "")
{
llOwnerSay("No name was provided after \""+ (string)CHAN +" add \"");
}
else
{
llOwnerSay("Sorry, there is no " + newName + "on the list.");
}
newName = "";
}
else if (DoThis == "lis")
{
llOwnerSay("Manager List:");
integer len = llGetListLength(managers);
if (len > 0)
{
integer i;
for (i=0;i<=len-1;i=i+2)
{
llOwnerSay(llList2String(managers,i) + " = " +llList2String(managers, i+1));
}
}
else
{
llOwnerSay("The list is empty.");
}
}
else
{
llOwnerSay("Unrecognized command.");
}
}

touch_start(integer total_number)
{
if (llDetectedKey(0) == llGetOwner())
{
CHAN = (integer)llFrand(100.0);
llListen(CHAN,"",llGetOwner(),"");
llOwnerSay("Type \"/"+(string)CHAN+" add Newmanager Name\" or \"/" +(string)CHAN + " zap Exmanager Name\" or \"/"+(string)CHAN +"
list\"");
}
if (update)
{
if(newName == llDetectedName(0))
{
llInstantMessage(llDetectedKey(0),"Your name has been added to the manager list.");
llOwnerSay(newName + " has been added.");
managers += [llDetectedName(0),llDetectedKey(0)];
}
else
{
llOwnerSay(newName +" was NOT added. Check spelling.");
}
update = FALSE;
newName = "";
}
}

collision_start(integer num_detected)
{
string avName = llDetectedName(0);
integer manyHeads = llGetListLength(managers);
integer i;
for (i = manyHeads-1;i >= 0;i = i-2) // Notify all managers that someone has touched the doormat
{
llInstantMessage(llList2Key(managers,i), avName + " has just tripped over your doormat.");
}
}

changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
llResetScript();
}
}
}
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
05-27-2009 19:14
Actually you can save some trouble by just using the names and checking against llDetectedName. It only works when they are in the same sim, but then again, they would have to be to step on the mat.....................................................................
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
05-27-2009 21:23
Volume detect will avoid triggering "collision detectors". Then your welcome mat can do it's welcoming, without panicking a new user with a multi-tool that they were just "shot" by something.

http://rpgstats.com/wiki/index.php?title=LlVolumeDetect
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
05-27-2009 21:25
From: Jesse Barnett
Actually you can save some trouble by just using the names and checking against llDetectedName. It only works when they are in the same sim, but then again, they would have to be to step on the mat.....................................................................


True enough.... I told you I was playing... :) Besides, this way a person can't invite herself onto the managers' list... The owner has to do the setup and then the manager confirms it, and I grab the manager's key in the process. The only really silly part is using a random channel. It's not at all necessary, since the script will only listen to the Owner anyway. Thing is, I can't ever remember which channel a script is expecting me to use, so I decided to the let script make one up and tell me.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
05-27-2009 21:40
From: Winter Ventura
Volume detect will avoid triggering "collision detectors". Then your welcome mat can do it's welcoming, without panicking a new user with a multi-tool that they were just "shot" by something.

http://rpgstats.com/wiki/index.php?title=LlVolumeDetect


Yeah, well, it is sorta like the tail wagging the dog. The script spends more effort on maintaining the list of managers than on being a doormat but, hey, where's the magic in being a doormat?

This script notifies the managers when a casual visitor walks over the mat, which is what the OP wanted. (That wouldn't be my choice, personally, but that was the request.) It doesn't say hello --- ooops, just remembered that it was supposed to do that --- just sends the requested IMs.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at