Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

SLURL maker within Huddles! Solved and Enjoy

Atriel Starbrook
Registered User
Join date: 4 Jan 2007
Posts: 15
01-05-2007 20:28
Ok well I finally got my script error free :)

For those not familar, an SLURL is a Second Life link within the game... you click what appears to be a web page and it will open up your map and allow you to teleport there.

They often look like: http://slurl.com/secondlife/Orkney/78/23/22/
You can manually type one by typing "http://slurl.com/secondlife/<Insert Region Name>/<X>/<Y>/<Z>"

Replacing the items within the brackets (<>;). But that's a pain!

There are many attachments that will make SLURLs for you, but now you can ditch that old attachment, freeing up the Attachment slot and using your Huddles to create one!.

Here's how!!!!!!

First, Copy the below code to a new script, and name it Whatever you like (I use "Say a SLURL - 125";).

CODE

//SLURL maker for channel 125
//To Activate type /125 SLURL
//By Atriel Starbrook

key owner;
integer SLURLChannel;
string VersionNumber = "1.0";
integer ChannelNumber = 125;


string escape(string msg)
{
return llDumpList2String(llParseString2List(msg, [" "], []), "%20");
}

default
{
state_entry()
{
//Set the owner variable to the current owner ID
owner = llGetOwner();
llListenRemove( SLURLChannel ); //Removes any previous listeners on this channel
SLURLChannel = llListen(ChannelNumber,"",owner,"");
llInstantMessage(owner,"SLURL: Version " + VersionNumber + " Ready");
}


attach(key attached)
{
//Resetting Script each time it's attached to make sure that owners are all purged
if (attached != NULL_KEY)
{
llInstantMessage(owner,"Resetting SLURL scripts for new Owner. This may Take a moment.");
llResetScript();
}
}

//This will allow the script to listen to link messages with the word SLURL to trigger
link_message(integer sender_num, integer num, string str, key id)
{
if (str == "SLURL")
{
vector pos = llGetPos();
//llInstantMessage(owner,"------------------ Here is your SLURL -------------------" );
llInstantMessage(owner,"SLURL==>> http://slurl.com/secondlife/" + escape(llGetRegionName()) + "/" + (string)llRound(pos.x) + "/" + (string)llRound(pos.y) + "/" + (string)llRound(pos.z) + "/");
//llInstantMessage(owner,"----------Copy/Paste above to send to other chats -------" );
}
}

//Listen for actual chat info from the owner on the current channel.
//Listens for the command SLURL, ex: /125 SLURL
listen(integer c, string name, key id, string msg)
{
if ( llGetOwnerKey(id) == owner ) //Ensures we only listen to the owner
{
if (msg == "SLURL")
{
vector pos = llGetPos();
//llInstantMessage(owner,"------------------ Here is your SLURL -------------------" );
llInstantMessage(owner,"SLURL==>> http://slurl.com/secondlife/" + escape(llGetRegionName()) + "/" + (string)llRound(pos.x) + "/" + (string)llRound(pos.y) + "/" + (string)llRound(pos.z) + "/");
//llInstantMessage(owner,"----------Copy/Paste above to send to other chats -------" );

} // Close if (msg == "SLURL")
} // Close if ( llGetOwnerKey(id) == owner )
} //Close Listen Event
}


Then make a notecard with the line:
[NAME]SLURL Maker|[LINK]SLURL

Drop both into your Huddles , load up the new notecard and enjoy!

If that's a bit too complicated, I have step by step instructions with Script and Notecard all ready within SL, just send me an IM requesting it and I'll send it to you :)

Enjoy! And keep Huddling!
Keiki Lemieux
I make HUDDLES
Join date: 8 Jul 2005
Posts: 1,490
01-05-2007 20:50
It works! Very nice. I added it to my HUDDLE.
_____________________
imakehuddles.com/wordpress/