User:Jesse Barnett/Slurl TP HUD
Jump to navigation
Jump to search
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
- Click Here To see my page and more of my scripts
SLURL TP HUD
Create a button and place it in a HUD position and put this script inside. Don't know what the limit is but I can get more locations in here then I need. Have fun or take it and create something yourself.
To add a location, touch the HUD, pick a category and then say the name on channel 8. That's it, it will automatically record the position. You can have the hud chat out the list of destinations for safe keeping and can also chat these back into the hud if necessary.
//////////////////////////////////////////////////////////////////////////////////////////////////////
// SLURL TP
// "Jun 13 2008", "22:12:35"
// Creator: Jesse Barnett
// Released into the Public Domain
//////////////////////////////////////////////////////////////////////////////////////////////////////
integer a;
integer chat_chan = 0;
integer chat_chan_handle;
integer clean_chan = 99;
integer clean_chan_handle;
integer delete = 0;
integer list_length;
integer menu_chan = -2769531;
integer menu_chan_handle;
integer rez_chan = -5479567;
key owner_key;
list categories =["Back", "Friends", "Fun", "Home", "Nice", "Sandboxes", "Shopping", "Temp"];
list destinations =[];
list menu;
list menu2;
list menu3;
list menu4;
list options =["Add", "Remove", "Local", "World", "List", "Reload"];
list sims =[];
string category;
string dump;
string dump2;
string dump3;
string dump4;
string msg2;
string region;
vector rez_offset = <0.0, 0.0, 1.5 >;
string sim;
vector slurl_vector;
local_list()
{
sim = "~" + llGetRegionName();
list_length = llGetListLength(destinations);
a = llListFindList(destinations,[sim]);
if (a == -1) {
llOwnerSay("No local entries");
llDialog(owner_key, "Choose Option", options, menu_chan);
jump end;
}
else {
menu =[];
menu2 =[];
menu3 =[];
menu4 =[];
while (a < list_length) {
if (llList2String(destinations, a) == sim) {
a++;
menu = (menu =[]) + menu + llList2List(destinations, a, a);
}
else
a++;
a += 3;
}
}
menu =["Back"] + llListSort(menu, 1, 1);
shared();
@end;
}
world_list()
{
a = llListFindList(destinations,[msg2]);
list_length = llGetListLength(destinations);
if (a == -1) {
llOwnerSay("No Entries");
llDialog(owner_key, "Choose Category", categories, menu_chan);
jump end;
}
else {
menu =[];
menu2 =[];
menu3 =[];
menu4 =[];
while (a < list_length) {
if (llList2String(destinations, a) == msg2) {
a += 2;
menu = (menu =[]) + menu + llList2List(destinations, a, a);
}
else
a += 2;
a += 2;
}
}
menu =["Back"] + llListSort(menu, 1, 1);
shared();
@end;
}
shared()
{
if (llGetListLength(menu) > 12) {
menu2 =["Back"] + llList2List(menu, 11, -1);
menu = (menu =[]) +["More"] + llDeleteSubList(menu, 11, -1);
}
if (llGetListLength(menu2) > 12) {
menu3 =["Back"] + llList2List(menu2, 11, -1);
menu2 = llDeleteSubList(menu2, 11, -1);
menu2 = (menu2 =[]) +["More+", "Back"] + llDeleteSubList(menu2, 0, 0);
}
if (llGetListLength(menu3) > 12) {
menu4 =["Back"] + llList2List(menu3, 11, -1);
menu3 = llDeleteSubList(menu3, 11, -1);
menu3 = (menu3 =[]) +["More++"] + llDeleteSubList(menu3, 0, 0);
}
llDialog(owner_key, "Pick Destination", menu, menu_chan);
}
default {
state_entry() {
owner_key = llGetOwner();
sims = llListSort(sims, 1, 1);
categories = llListSort(categories, 1, 1);
}
touch_start(integer n) {
delete = 0; //safety
menu_chan_handle = llListen(menu_chan, "", owner_key, "");
llDialog(owner_key, "Choose Option", options, menu_chan);
llSetTimerEvent(30.0);
}
listen(integer channel, string name, key id, string msg) {
if (channel == 99)
destinations += llCSV2List(msg);
else if (msg == "Add" || msg == "Back" || msg == "More" || msg == "More+" || msg == "More++") {
if (msg == "Add")
state add_dest;
else if (msg == "Back")
llDialog(owner_key, "Choose Option", options, menu_chan);
else if (msg == "More")
llDialog(owner_key, "Pick Destination", menu2, menu_chan);
else if (msg == "More+")
llDialog(owner_key, "Pick Destination", menu3, menu_chan);
else if (msg == "More++")
llDialog(owner_key, "Pick Destination", menu4, menu_chan);
}
else {
if (msg == "Remove") {
llOwnerSay("Pick destination to remove");
clean_chan_handle = llListen(clean_chan, "", owner_key, "");
llDialog(owner_key, "Choose Category", categories, clean_chan);
delete = 1;
}
else if (msg == "Reload") {
llSetTimerEvent(90.0);
llOwnerSay("enter data on channel 99 & Click Done when finished");
llDialog(owner_key, "Click Done when finished",["Done"], menu_chan);
llListen(99, "", owner_key, "");
}
else if (msg == "Done") {
llListenRemove(clean_chan_handle);
llSetTimerEvent(0.0);
}
else if (msg == "World")
llDialog(owner_key, "Choose Category", categories, menu_chan);
else if (msg == "Local")
local_list();
else if (llListFindList(categories,[msg]) != -1) {
msg2 = msg;
world_list();
}
else if (llListFindList(destinations,[msg]) != -1) {
a = llListFindList(destinations,[msg]);
if (delete) {
destinations = llDeleteSubList(destinations, a - 2, a + 1);
delete = 0;
llSetTimerEvent(0.0);
}
else {
llSetTimerEvent(30.0);
region = llDeleteSubString(llList2String(destinations, a - 1), 0, 0);
region = llEscapeURL(region);
string temp = llList2String(destinations, a + 1);
slurl_vector = (vector) temp;
string x = (string) slurl_vector.x;
string y = (string) slurl_vector.y;
string z = (string) slurl_vector.z;
llOwnerSay("secondlife:///app/teleport/" + region + "/" + x + "/" + y + "/" + z);
}
}
else if (msg == "List") {
dump = llDumpList2String(destinations, ", ");
if (llStringLength(dump) > 1020) {
dump2 = (dump2 = "") + dump2 + llGetSubString(dump, 1024, -1);
dump = (dump = "") + dump + llDeleteSubString(dump, 1024, -1);
}
llOwnerSay(dump);
dump = "";
if (llStringLength(dump2) > 1024) {
dump3 = (dump3 = "") + dump3 + llGetSubString(dump2, 1024, -1);
dump2 = (dump2 = "") + dump2 + llDeleteSubString(dump2, 1024, -1);
}
if (llStringLength(dump2) > 0)
llOwnerSay(dump2);
dump2 = "";
if (llStringLength(dump3) > 1024) {
dump4 = (dump4 = "") + dump4 + llGetSubString(dump3, 1024, -1);
dump3 = (dump3 = "") + dump3 + llDeleteSubString(dump3, 1024, -1);
}
if (llStringLength(dump3) > 0)
llOwnerSay(dump3);
dump3 = "";
if (llStringLength(dump4) > 0)
llOwnerSay(dump4);
dump4 = "";
llSetTimerEvent(0.0);
}
}
}
state_exit() {
llListenRemove(menu_chan_handle);
}
timer() {
llListenRemove(menu_chan_handle);
llSetTimerEvent(0.0);
}
}
state add_dest {
state_entry() {
llDialog(owner_key, "Pick Category", categories, menu_chan);
chat_chan_handle = llListen(chat_chan, "", owner_key, "");
menu_chan_handle = llListen(menu_chan, "", owner_key, "");
} listen(integer channel, string name, key id, string msg) {
if (channel == menu_chan) {
category = msg;
msg = "";
llOwnerSay("What do you want to name the location?");
}
else if (channel == chat_chan) {
sim = "~" + llGetRegionName();
if (llListFindList(sims,[sim]) == -1) {
sims = (sims =[]) + sims +[sim];
llListSort(sims, 1, 1);
}
destinations = (destinations =[]) + destinations +[category, sim, msg, llGetPos()];
state default;
}
}
state_exit() {
llListenRemove(chat_chan_handle);
llListenRemove(menu_chan_handle);
}
}