Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- key Owner;
- key Toucher;
- string previous_online = "0";
- integer lchan = -98;
- integer lhandle;
- key ReqOwnerStatus;
- list Messages;
- default
- {
- on_rez(integer start_param)
- {
- llResetScript();
- }
- state_entry()
- {
- Owner = llGetOwner();
- llSetTimerEvent(60.0);
- }
- touch_start(integer total_number)
- {
- if(previous_online == "0")
- {
- Toucher = llDetectedKey(0);
- llListenRemove(lhandle);
- llListen(lchan, "", Toucher, "" );
- llTextBox(Toucher, "The owner is offline. Please leave a message for them.", lchan);
- }
- else
- {
- llInstantMessage(llDetectedKey(0),"secondlife:///app/agent/"+(string)Owner+"/about" + " is online! Click their name in this message to open their profile.");
- }
- }
- listen(integer chan, string name, key id, string msg)
- {
- if(chan == lchan)
- {
- llInstantMessage( Toucher, "You message has been stored and will be delivered to the owner when they are online again.");
- Messages += "secondlife:///app/agent/"+(string)id+"/about"+": "+ msg;
- }
- }
- timer()
- {
- ReqOwnerStatus = llRequestAgentData(Owner, DATA_ONLINE);
- }
- dataserver(key RequestId, string data)
- {
- if(RequestId == ReqOwnerStatus)
- if(data!=previous_online)
- {
- // llSay(0,"Changed at "+llGetTimestamp()+"; "+(string)target+" DATA_ONLINE = "+data);
- if(data == "1")
- {
- if(Messages != []) // If message list is not blank.
- {
- integer llength = llGetListLength(Messages);
- integer i;
- for(i = 0; i < 0; ++ i)
- {
- llInstantMessage(Owner,llList2String(Messages,i));
- }
- }
- }
- else if(data == "0")
- {
- // Do nothing if offline.
- }
- previous_online=data;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement