07-20-2008 21:11
Hi guys/gals,

I need some help...I found this script on the forums and wanted to know how I could go about paging a detected key instead of IM'ing the owner? I am building a kiosk for our estate managers and giving this out to each and rezzing on 20+ sims would be very time consuming... any help is greatly appreciated.

I would also like not to have any hover text show when online or offline, as I have created name plates instead.

Thanks in advance!

CODE

string owner_name = "Owner ";
key namerequest;
key onlinerequest;

integer online = FALSE;

list agents = [];
list handles = [];
list messages = [];

init()
{
llSetText("Initializing...", <1,1,1>, 1);
llSetTimerEvent(5);
namerequest = llRequestAgentData(llGetOwner(), DATA_NAME);
}

regurgitate()
{
integer i;
for (i=0; i<llGetListLength(messages); i++) {
llInstantMessage(llGetOwner(), llList2String(messages, i));
}
messages = [];
}

default
{
on_rez(integer param)
{
init();
}

state_entry()
{
init();
}

timer()
{
onlinerequest = llRequestAgentData(llGetOwner(), DATA_ONLINE);
}

touch(integer touch_num)
{
integer i;
for (i=0; i<touch_num; i++) {
agents += llDetectedKey(i);
handles += llListen(0, "", llDetectedKey(i), "");
llSay(0, llDetectedName(i) + ", please say your message on one line and it will be recorded and/or sent.");
}
}

listen(integer channel, string name, key id, string message)
{
integer agent_index = llListFindList(agents, [id]);
if (agent_index != -1) {
llListenRemove(llList2Integer(handles, agent_index));
handles = llDeleteSubList(handles, agent_index, agent_index);
agents = llDeleteSubList(agents, agent_index, agent_index);
if (online) {
llInstantMessage(llGetOwner(), name + ": " + message);
llSay(0, "Thank you, " + name + ", your message has been sent.");
} else {
messages += name + ": " + message;
llSay(0, "Thank you, " + name + ", your message has been recorded, and will be sent when " + owner_name + " is online.");
}
}
}

dataserver(key request, string data)
{
if (request == namerequest) {
owner_name = data;
llSetTouchText("Send IM");
} else {
if (data == "1") {
llSetColor(<0,1,0>, ALL_SIDES);
llSetText( + " .\n.", <1,1,1>, 1);
online = TRUE;
regurgitate();
} else {
llSetColor(<0,0,0>, ALL_SIDES);
llSetText(owner_name + " is offline.\nClick here to leave a message.", <0,0,0>, 1);
online = FALSE;
}
}
}
}