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
Teleport Teleport_Hud  

Teleport_Hud

Drop this script into a hud

Category: Teleport
By : mangowylder
Created: 2012-07-04 Edited: 2012-07-04
Worlds: Second Life

the Zip file

Download all files for Teleport_Hud
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Teleport_Hud_1.lsl
1 // Teleport Hud script
2 //
3 // This script grabs your postion, with the name you set, in the form of a SL teleport app URL.
4 // No notecard. Teleport anywhere.
5 // It is designed to be used in a hud and will open an llDialog box to grab SLurls and show SLurls
6 // in local chat. Just click on the generated SLurl in the chat window to teleport anywhere.
7 // Uses llTextBox for user input to enter the names of the SLurls to add or delete.
8 // As always try to keep the names between 10-12 characters because of the dialog box size limitation.
9 // As written it will store and show 21 SLurls. 10 in the first llDialog box and 11 in the second LLDialog box.
10 // If you have SLurls in the second dialog box list and delete a SLurl from the first dialog box list
11 // the first entry from the second list will be moved to the last entry of the first list.
12 // List SLurls in case you make the name too long for the dialog box to display and you need
13 // the correct name to delete the SLurl. Names are case sensitive.
14
15 // Note - With llTextbox input do not hit the enter key! Just type in the name and click submit.
16
17 // Written by Mango Wylder except where noted.
18
19 // Mango Wylder //
20
21 //Globals//
22 list gLstChoices = ["Grab SLurl", "Show SLurls", "Del SLurl", "Cancel", "Reset", "ListSlurls"];
23 list gLstChoicesMore = ["<< Back"];
24 list gLstChoicesMore1 = ["<<< Back"];
25 list gLstForbidden = ["<< Back", "More", "<<< Back"];
26 list gLstSLurls;
27 list gLstSLurls1;
28 key gKeyToucherID;
29 integer gIntSlurls = 10;
30 integer gIntSlurls1 = 11;
31 integer gIntChannel_Dialog;
32 integer gIntChannel_Dialog1;
33 integer gIntListen_Id;
34 integer gIntListen_Id_Chat;
35 integer gIntGrabSlurl;
36 integer gIntDelSLurl;
37 integer gIntDialog = 0;
38 integer gIdxLst;
39 integer gIdxLstDel;
40 string gStrPlace;
41 string gStrPlacePos;
42 string gStrGenSLurl;
43
44 // This function was snagged from http://wiki.secondlife.com/wiki/SLURL_HUD //
45 // and modified with three hashes for the teleport app URL //
46 // Mango Wylder //
47
48 string gen_slurl() {
49 string regionname = llDumpList2String(llParseString2List(llGetRegionName(),[" "],[]),"%20");
50 vector pos = llGetPos();
51 integer x = (integer)pos.x;
52 integer y = (integer)pos.y;
53 integer z = (integer)pos.z;
54 return "secondlife:///app/teleport/"+regionname+"/"+(string)x+"/"+(string)y+"/"+(string)z+"/";
55 }
56
57 default{
58 state_entry() {
59 gIntChannel_Dialog = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-5,-1)) ); // set a negative integer chat channel for the dialog box
60 gIntChannel_Dialog1 = ( -1 * (integer)("0x"+llGetSubString((string)llGetKey(),-8,-1)) ); // set a negative integer chat channel for the text box
61 }
62
63 touch_start(integer total_number) {
64 gKeyToucherID = llDetectedKey(0);
65 llDialog(gKeyToucherID, "Please make a choice.\n Clicking on Reset will reset the script\n and you will loose all save SLURLS!\n Please select Cancel instead of Ignore", gLstChoices, gIntChannel_Dialog);
66 gIntListen_Id = llListen(gIntChannel_Dialog, "", gKeyToucherID, "");
67 llSetTimerEvent(20); //set a time limit to llListen
68 }
69
70 listen(integer channel, string name, key id, string choice) {
71 if(channel == gIntChannel_Dialog) {
72 if(~llListFindList(gLstChoices, [choice])) { // verify dialog choice
73 if(choice == "Show SLurls")
74 if(llGetListLength(gLstChoicesMore) == 1) {
75 llOwnerSay("There are no SLurls to show. Try adding a SLurl first!");
76 }
77 else
78 llDialog(gKeyToucherID, "Clicking on a SLurl will open a \n teleport link in Local Chat (CTRL H)", gLstChoicesMore, gIntChannel_Dialog);
79
80 else if(choice == "Grab SLurl") {
81 if(gIntDialog == 0) { // ensure we should be here
82 if(llGetListLength(gLstSLurls) >= gIntSlurls) { // Max of 10 Slurls in list one reached so add the More button
83 gLstChoicesMore = gLstChoicesMore + ["More"]; // add the More button to the end of the first SLurl name list
84 // set condition to check the size of the second SLurls list and allow adding to it
85 gIntDialog = 1;
86 }
87 else {
88 gIntGrabSlurl = 1; // set condition to check if allowed to add to SLurl lists
89 gIntListen_Id_Chat = llListen(gIntChannel_Dialog1, "", gKeyToucherID, "");
90 llTextBox(gKeyToucherID,"Please enter a name for this Slurl",gIntChannel_Dialog1 );
91 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
92 }
93 }
94 if(gIntDialog == 1) { // ensure we should be here
95 if(llGetListLength(gLstSLurls1) >= gIntSlurls1) { //max of 21 SLurls reached
96 llOwnerSay("You have reached the maximum allowed SLurls!");
97 llOwnerSay("Please delete a SLurl if you would like to add another.");
98 }
99 else {
100 gIntGrabSlurl = 1; // set condition to check if allowed to add to SLurl lists
101 gIntListen_Id_Chat = llListen(gIntChannel_Dialog1, "", gKeyToucherID, "");
102 llTextBox(gKeyToucherID,"Please enter the name of the Slurl you want to Add",gIntChannel_Dialog1 );
103 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
104 }
105 }
106 }
107 else if(choice == "Del SLurl") {
108 if(gLstSLurls == []) {
109 llOwnerSay("There are no SLurls to delete");
110 }
111 else {
112 gIntListen_Id_Chat = llListen(gIntChannel_Dialog1, "", gKeyToucherID, "");
113 llTextBox(gKeyToucherID,"Please enter the name of the Slurl you want to Delete",gIntChannel_Dialog1 );
114 gIntDelSLurl = 1; // set condition to check if allowed to delete from SLurl lists
115 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
116 }
117 }
118 else if(choice == "ListSlurls") {
119 if(llGetListLength(gLstSLurls) == 0 ) {
120 llOwnerSay("There are no Slurls to list");
121 }
122 else if(llGetListLength(gLstSLurls) >= 0 ) {
123 if(~llListFindList(gLstChoicesMore, ["More"])){
124 list vlstTempList = llList2List(gLstChoicesMore, 1, -2);
125 llOwnerSay(llList2CSV(vlstTempList));
126 vlstTempList = [];
127 }
128
129 else {
130 list vlstTempList = llList2List(gLstChoicesMore, 1, -1);
131 llOwnerSay(llList2CSV(vlstTempList));
132 vlstTempList = [];
133 }
134 if(llGetListLength(gLstSLurls1) >=1 ) {
135 list vlstTempList1 = llList2List(gLstChoicesMore1, 1, -1);
136 llOwnerSay(llList2CSV(vlstTempList1));
137 vlstTempList1 = [];
138 }
139 }
140 }
141 else if(choice == "Cancel") { // user cancels so kill the listen
142 llListenRemove(gIntListen_Id);
143 }
144 else if(choice == "Reset") { // reset the script
145 llListenRemove(gIntListen_Id);
147 }
148 }
149
150 if(~llListFindList(gLstChoicesMore, [choice])){ // find the index of choice in the first list
151 gIdxLst = (llListFindList(gLstChoicesMore, [choice]));
152 gStrPlace = (llList2String(gLstChoicesMore, gIdxLst));
153 // - 1 from the index found in the name list because the name list will always have a back button
154 gStrPlacePos = llList2String(gLstSLurls, gIdxLst - 1);
155 if(choice == "<< Back") {
156 llDialog(gKeyToucherID, "Please make a choice.\n Clicking on Reset will reset the script\n and you will loose all save SLURLS!\n Please select Cancel instead of Ignore", gLstChoices, gIntChannel_Dialog); // present main menu on request to go back
157 }
158 else if(choice == "More") {
159 llDialog(gKeyToucherID, "Clicking on a SLurl will open a \n teleport link in Local Chat (CTRL H)", gLstChoicesMore1, gIntChannel_Dialog); // present submenu on request
160 }
161 else {
162 llOwnerSay("Click here to teleport to " + gStrPlace + ": " + gStrPlacePos);
163 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
164 }
165 }
166
167 else if(~llListFindList(gLstChoicesMore1, [choice])){ // find the index of choice in the second list
168 gIdxLst = (llListFindList(gLstChoicesMore1, [choice]));
169 gStrPlace = (llList2String(gLstChoicesMore1, gIdxLst));
170 // - 1 from the index found in the name list because the name list will always have a back button
171 gStrPlacePos = llList2String(gLstSLurls1, gIdxLst - 1);
172 if(choice == "<<< Back") {
173 llDialog(gKeyToucherID, "Clicking on a SLurl will open a \n teleport link in Local Chat (CTRL H)", gLstChoicesMore, gIntChannel_Dialog); // present main menu on request to go back
174 }
175 else {
176 llOwnerSay("Click here to teleport to " + gStrPlace + ": " + gStrPlacePos);
177 llListenRemove(gIntListen_Id); //remove the listen on channel_dialog
178 }
179 }
180 }
181
182 // end channel dialog
183 // start channel dialog1
184
185 if(channel == gIntChannel_Dialog1){
186 // here's where we grab the SLurl info
187 if(gIntGrabSlurl == 1){ // ensure we should be here
188 if(choice == ""){
189 llOwnerSay("You must enter a name for this SLurl!");
190 llOwnerSay("Add SLurl operation aborted. Please try again");
191 llListenRemove(gIntListen_Id_Chat);
192 }
193 else if(gIntDialog == 0) { // check to see if we should be adding to the first SLurl list
194 gLstChoicesMore = gLstChoicesMore + [choice]; // add the SLurl name to the end of the list
195 gStrGenSLurl = (gen_slurl());
196 gLstSLurls = gLstSLurls + [gStrGenSLurl] ; // add the SLurl pos to the end of the list
197 gIntGrabSlurl = 0; // done grabbling the SLurl so let's not end up here agian unless Grab SLurl is clicked
198 llOwnerSay("SLurl " + choice + " Saved!");
199 llListenRemove(gIntListen_Id_Chat);
200 }
201 else if(gIntDialog == 1) { // check to see if we should be adding to the second SLurl list
202 gLstChoicesMore1 = gLstChoicesMore1 + [choice]; // add the SLurl name to the end of the list
203 gStrGenSLurl = (gen_slurl());
204 gLstSLurls1 = gLstSLurls1 + [gStrGenSLurl] ; // add the SLurl pos to the end of the list
205 gIntGrabSlurl = 0; // done grabbling the SLurl so let's not end up here agian unless Grab SLurl is clicked
206 llOwnerSay("SLurl " + choice + " Saved!");
207 llListenRemove(gIntListen_Id_Chat);
208 }
209 }
210 // here's where we delete the SLurl info
211 if(gIntDelSLurl == 1) { // ensure we should be here
212 if(choice == ""){
213 llOwnerSay("You must enter a name for this SLurl!");
214 llOwnerSay("Delete SLurl operation aborted. Please try again");
215 llListenRemove(gIntListen_Id_Chat);
216 return;
217 }
218 gIdxLstDel = (llListFindList(gLstChoicesMore + gLstChoicesMore1, [choice]));
219 if(gIdxLstDel == -1) {
220 llOwnerSay("That SLurl isn't in the list. Please try Again");
221 gIntDelSLurl = 0;
222 llListenRemove(gIntListen_Id_Chat);
223 }
224 if(~llListFindList(gLstForbidden, [choice])){ // prevent the user from deleting navigation buttons
225 llOwnerSay("Naughty, Naughty!. You can't remove that button!)");
226 gIntDelSLurl = 0;
227 }
228 else if(~llListFindList(gLstChoicesMore, [choice])){ // look for the name in the first SLurl list
229 gIdxLstDel = (llListFindList(gLstChoicesMore, [choice]));
230 gLstChoicesMore = llDeleteSubList(gLstChoicesMore, gIdxLstDel,gIdxLstDel);
231 // index below is -1 because the SLurl name list will always have the Back button
232 gLstSLurls = llDeleteSubList(gLstSLurls, gIdxLstDel - 1 ,gIdxLstDel - 1);
233 // We deleted the SLurl from the first SLurl list so check if there are SLurls in the second list
234 // and move the first one to the end of the first SLurl list
235 if(llGetListLength(gLstChoicesMore1) >= 1) { // there is more than the Back button so a SLurl is in the list
236 string vStrTemp1 = llList2String(gLstChoicesMore1, 1);
237 // Insert the SLurl name before the More button on the first SLurl list
238 gLstChoicesMore = llListInsertList(gLstChoicesMore, [vStrTemp1], -1);
239 string vStrTemp2 = llList2String(gLstSLurls1, 0);
240 // Insert the SLurl position at the end of the first SLurl postion list
241 gLstSLurls = llListInsertList(gLstSLurls, [vStrTemp2], gIntSlurls);
242 // delete the SLurl name and postion from the second SLurl lists
243 // using the first position in the lists for each
244 gLstSLurls1 = llDeleteSubList(gLstSLurls1, 0 , 0);
245 // index 1 because of the Back button
246 gLstChoicesMore1 = llDeleteSubList(gLstChoicesMore1, 1, 1);
247 }
248 // only the back button is in the second list so we can delete the More button in the first list
249 if(llGetListLength(gLstChoicesMore1) == 1) {
250 if(~llListFindList(gLstChoicesMore, ["More"])){
251 gIdxLstDel = (llListFindList(gLstChoicesMore, ["More"]));
252 gLstChoicesMore = llDeleteSubList(gLstChoicesMore, gIdxLstDel,gIdxLstDel);
253 // no SLurls in the second list so set condition to add to first list on next Grab SLurl click
254 gIntDialog = 0;
255 }
256 }
257 llOwnerSay("SLurl " + choice + " removed");
258 gIntDelSLurl = 0;
259 llListenRemove(gIntListen_Id_Chat);
260 }
261 else if(~llListFindList(gLstChoicesMore1, [choice])){ // look for the name in the second SLurl list
262 gIdxLstDel = (llListFindList(gLstChoicesMore1, [choice]));
263 gLstChoicesMore1 = llDeleteSubList(gLstChoicesMore1, gIdxLstDel,gIdxLstDel);
264 gLstSLurls1 = llDeleteSubList(gLstSLurls1, gIdxLstDel - 1 ,gIdxLstDel - 1);
265 // we have deleted the last SLurl in the second list so no need for the More button in the first list
266 if(llGetListLength(gLstChoicesMore1) == 1) {
267 if(~llListFindList(gLstChoicesMore, ["More"])){
268 gIdxLstDel = (llListFindList(gLstChoicesMore, ["More"]));
269 gLstChoicesMore = llDeleteSubList(gLstChoicesMore, gIdxLstDel,gIdxLstDel);
270 // no SLurls in the second list so set condition to add to first list on next Grab SLurl click
271 gIntDialog = 0;
272 }
273 }
274 llOwnerSay("SLurl " + choice + " removed");
275 gIntDelSLurl = 0;
276 llListenRemove(gIntListen_Id_Chat);
277 }
278 }
279 }
280 }
281
282 timer() { //TIMES UP!
283 llListenRemove(gIntListen_Id_Chat);
284 llListenRemove(gIntListen_Id);
285 llSetTimerEvent(0); //Stop the timer from being called repeatedly
286 }
287 }

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