Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Chat-URL-Tracker

Cockerel Mommsen
Registered User
Join date: 28 Feb 2006
Posts: 3
06-08-2006 18:55
The following code makes it easier to open URLs beginning with "http://" said on channel 0 by anyone (no more need to open History and then ctrl-c, ctrl-v)

No big thing but as i think quite handy.

Just put it into a prim and attach it to your hud.
If you touch the (invisible) prim (it's below the text saying "Last URL";) the text will appear/disappear for taking screenshots.

CODE

list glMessageParts;
string gsHoverText = "Last URL:";
integer giTextShow = TRUE;
default
{
state_entry()
{
llListen(0,"",NULL_KEY,"");
llSetAlpha(0,ALL_SIDES);
llSetText(gsHoverText,<1,1,1>,1);
}

touch_start(integer num) // switch hovertext on and off
{
if (giTextShow)
{
giTextShow = FALSE;
llSetText("",<1,1,1>,1);
} else {
giTextShow = TRUE;
llSetText(gsHoverText,<1,1,1>,1);
}

}

listen(integer channel, string name, key id, string message)
{
glMessageParts = llParseString2List(message, [" "], []);
integer i;
for(i=0; i<llGetListLength(glMessageParts); i++)
{
if (llGetSubString(llList2String(glMessageParts, i), 0,6) == "http://") //check for valid URL
{
gsHoverText = "Last URL:\n" + llList2String(glMessageParts, i);
llSetText(gsHoverText, <1,1,1>, 1);
llLoadURL(llGetOwner(), llGetSubString(llList2String(glMessageParts, i), 7,-1), llList2String(glMessageParts, i));

}
}
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
06-08-2006 21:06
/54/b7/112700/1.html
_____________________
i've got nothing. ;)