-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathHUD.lsl
More file actions
210 lines (186 loc) · 6.05 KB
/
HUD.lsl
File metadata and controls
210 lines (186 loc) · 6.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
string BASEURL="http://beacon.opensimworld.com/index.php/osgate";
integer channel;
integer zListener=-1;
key dialogUser;
string status;
string listData;
integer curStart=0;
list destAddr;
string mode;
integer selectedItem;
string lastCommand;
key req;
showTPDialog()
{
list e = getListItem(selectedItem);
string str = "Destination: "+ llList2String(e,2) +
"\nHG address: "+ llList2String(e,3)+" \n" +
"\nSelect how to teleport. If you are in the same grid as the destination region, select 'Local Grid'";
llDialog(llGetOwner(),str , [ "HyperGrid", "LocalGrid", "Close"], channel);
}
showListDialog()
{
list tok = llParseString2List(listData, ["\n"], []);
string title = llList2String(tok,0);
integer i;
string str = "";
integer j;
destAddr = [];
list opts = [];
opts += ["<<" , "CLOSE", ">>"];
for (i=curStart+1 ; i < llGetListLength(tok) && i <= curStart+9;i++)
{
list e = llParseString2List(llList2String(tok, i), ["#"], []);
str += "["+(string)i+ "] "+llList2String(e, 2) + " ("+llList2String(e, 1)+" users)\n";
opts += [(string)i];
}
llDialog(dialogUser, title+ "\n"+str, opts, channel);
mode = "loc";
}
list getListItem(integer idx)
{
list tok = llParseString2List(listData, ["\n"], []);
list e = llParseString2List(llList2String(tok, idx), ["#"], []);
return e;
// str += (string)i+ " "+llList2String(e, 2) + " ("+llList2String(e, 1)+" users)\n";
}
startListening()
{
if (zListener >=0) llListenRemove(zListener);
channel = -1 - (integer)("0x" + llGetSubString( (string) llGetKey(), -7, -1) );
zListener = llListen(channel, "",llGetOwner(),"");
llSetTimerEvent(300);
}
default
{
state_entry()
{
}
on_rez(integer n)
{
}
timer()
{
if (zListener >=0)
{
llListenRemove(zListener);
zListener = -1;
}
status = "";
llSetTimerEvent(0);
}
touch_start(integer n)
{
list opts = ["+Like", "+Bookmark", "CLOSE", "Popular", "Latest", "Random", "Bookmarks", "RegionInfo"];
dialogUser = llDetectedKey(0);
startListening();
llDialog(dialogUser, "Select region list:\n", opts, channel);
status = "wait_menu";
}
listen(integer chan, string who, key id, string msg)
{
if (status == "waitkey")
{
if (msg != "")
{
string url=BASEURL+"/setkey/?k="+msg;
req = llHTTPRequest(url, [], "");
status = "";
return;
}
return;
}
else if (msg == "CLOSE")
{
return;
}
else if (msg == "OpenSimWorld")
{
llLoadURL(dialogUser, "Visit opensimworld.com for more destinations", "http://opensimworld.com/?r=hud");
}
else if (msg == "Help")
{
llLoadURL(dialogUser, "Visit opensimworld.com for more destinations", "http://opensimworld.com/help/?r=hud");
}
else if (msg == "<<")
{
if (curStart>0)
curStart -= 9;
showListDialog();
}
else if (msg == ">>")
{
curStart+=9;
showListDialog();
}
else if (msg == "HyperGrid" || msg == "LocalGrid" || msg == "HG Map" || msg == "LocalMap")
{
list e = getListItem(selectedItem);
llOwnerSay("Destination region is "+ llList2String(e,2) +" in HG address "+ llList2String(e,3)+" ");
vector pos = (vector)llList2String(e,4);
vector lookat = (vector)llList2String(e,5);
if (msg == "HyperGrid")
{
osTeleportOwner(llList2String(e,3), pos, lookat);
}
else if (msg == "LocalGrid")
{
osTeleportOwner(llList2String(e,2), pos, lookat);
}
else if (msg == "HG Map")
{
//This only works on touch events or in attachments :(
// llMapDestination(llList2String(e,3), <128,128,22>, <0,0,0>);
}
else if (msg == "LocalMap")
{
llMapDestination(llList2String(e,2), <128,128,22>, <0,0,0>);
}
}
else if ((integer)msg>0)
{
selectedItem = (integer)msg;
showTPDialog();
}
else
{
string url=BASEURL+"/list2/?q="+llEscapeURL(msg);
req = llHTTPRequest(url, [], "");
}
}
http_response(key request_id, integer stcode, list metadata, string body)
{
//llOwnerSay("Got: "+body);
if (llGetSubString(body, 0,3) == "MSG^")
{
list tok = llParseString2List(body, ["^"], []);
if (llList2String(tok,1) != "-")
llDialog(llGetOwner(), llList2String(tok, 1), ["CLOSE"], channel);
if (llList2String(tok, 2) != "")
llSay(0, llList2String(tok, 2));
}
else if (llGetSubString(body, 0,3) == "URL^")
{
list tok = llParseString2List(body, ["^"], []);
llLoadURL(llGetOwner(), llList2String(tok, 1), llList2String(tok,2));
}
else if (llGetSubString(body, 0,3) == "REQ^" || llGetSubString(body, 0,3) == "CMT^")
{
list tok = llParseString2List(body, ["^"], []);
startListening();
llTextBox(llGetOwner(), llList2String(tok, 1), channel);
if (llList2String(tok, 2) != "")
llSay(0, llList2String(tok, 2));
if (llGetSubString(body, 0,3) == "REQ^")
status = "waitkey";
else
status = "waitcmt";
}
else
{
listData = body;
curStart =0;
showListDialog();
}
}
}