Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Online Indicator- Instant Message Sender

Dragger Lok
(loading ...)
Join date: 10 Sep 2006
Posts: 228
09-15-2007 20:22
Hi, have a great script if it would work- fear a second life update has killed it, is there any way to fix it? Indicator works well, instant message goes no where....

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(owner_name + " is online.\nClick here to send IM.", <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;
}
}
}
}
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
09-16-2007 06:55
Haven't studied the script details, but if it's really an llInstantMessage() misbehavior, may want to check and .
Dragger Lok
(loading ...)
Join date: 10 Sep 2006
Posts: 228
Great Read
09-16-2007 12:26
great read but hoping its not that bad a problem-