Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Online Indicator OnlineIndicator  

OnlineIndicator

OnlineIndicator

Category: Online Indicator
By : Encog Dod
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for OnlineIndicator
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. OnlineIndicator_1.lsl
1 // From the book:
2 //
3 // Scripting Recipes for Second Life
4 // by Jeff Heaton (Encog Dod in SL)
5 // ISBN: 160439000
6 X// Copyright 2007 by Heaton Research, Inc.
7 //
8 // This script may be freely copied and modified so long as this header
9 // remains unmodified.
10 //
11 // For more information about this book visit the following web site:
12 //
13 // http://www.heatonresearch.com/articles/series/22/
14
15 string name = "";
16 string last_online = "";
17 key nameKey = NULL_KEY;
18 integer isAvailable = TRUE;
19 integer isOnline = FALSE;
20
21 list MONTHS = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
22
23 string get_date()
24 {
26
27 integer hours = t / 3600;
28 integer minutes = (t % 3600) / 60;
29 integer seconds = t % 60;
30
31 string time = (string)hours + ":";
32 if(minutes < 10) time += "0" + (string)minutes + ":";
33 else time += (string)minutes + ":";
34 if(seconds < 10) time += "0" + (string)seconds;
35 else time += (string)seconds;
36
37 string DateToday = "";
38 string DateUTC = llGetDate();
39 list DateList = llParseString2List(DateUTC, ["-", "-"], []);
40 integer year = llList2Integer(DateList, 0);
41 integer month = llList2Integer(DateList, 1);
42 integer day = llList2Integer(DateList, 2);
43 month = month - 1;
44 if(day < 10) DateToday = "0";
45 DateToday += (string)day + "-";
46
47 DateToday += llList2String(MONTHS,month);
48 DateToday += " ";
49 DateToday += (string)year;
50
51 time = time + " " + DateToday;
52 return time;
53 }
54
55
56 default
57 {
59 {
61 }
62
64 {
65 llSetText("Online Detector\nTouch to Claim",<1,1,1>,1);
66 }
67
68 touch_start(integer total_number)
69 {
70 if(name == "")
71 {
72 nameKey = llDetectedKey(0);
73 name = llDetectedName(0);
74 llSetText(name + "\nSetting up...",<1,1,1>,1);
75 llSetTimerEvent(4.0);
76 return;
77 }
78
79 if(llDetectedName(0) == name)
80 {
81 if(isAvailable == FALSE)
82 {
83 isAvailable = TRUE;
84 llWhisper(0, "IM's will be sent to you.");
85 return;
86 }
87 else
88 {
89 isAvailable = FALSE;
90 llWhisper(0, "IM's will not be sent to you.");
91 return;
92 }
93
94 }
95 else
96 {
97 if(isAvailable && isOnline)
98 {
99 llInstantMessage(nameKey, llDetectedName(0) + " is paging you from " + llGetRegionName());
100 llWhisper(0,"A message has been sent to " + name);
101 }
102 }
103 }
104
105
106 timer()
107 {
108 if(nameKey)
109 {
111 }
112 }
113
114 dataserver(key query, string data)
115 {
116 string text = "";
117
118 if((integer)data == 1)
119 {
120 isOnline = TRUE;
121 llSetColor(<0,1,0>,ALL_SIDES);
122 text = name + " is ONLINE";
123 if(isAvailable) text += "\nClick to Send IM";
124 llSetText(text, <0.25,1.0,0.25>,1);
125 last_online = "";
126 }
127 else
128 {
129 isOnline = FALSE;
130 llSetColor(<1,0,0>,ALL_SIDES);
131 text = name + " is OFFLINE";
132
133 if(last_online == "") last_online = get_date();
134 text += "\nLast Online: " + last_online;
135 llSetText(text, <1.0,0.25,0.25>,1);
136 }
137 }
138 }

Back to the Best Free Tools in Second Life and OpenSim.