SLURL HUD
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
When touched, this HUD script sends a SLURL to yourself through IM for logging, sends it to a preconfigured email adress from a notecard, and displays it over the prim.
Drop this script in a prim, add a notecard called "emailaddress" with the email address in a single line, and reset the script to load the notecard. Wear it as a HUD. Just touch to get the SLURL.
<lsl>
// CODIE'S SLURL HUD SCRIPT - By CodeBastard Redrave // // Loosely inspired of: // http://forums-archive.secondlife.com/15/c2/152021/1.html // // USAGE: This script can be worn as a HUD and can be touched to spew a SLURL of your current location through various methods including IM log, Chat, and Email. // For email to work, you only need to set the email adress through the embedded notecard. // This script is FREE SOFTWARE. // DO NOT: Sell this script or remove the credits and comments. // DO: Give away, copy and distribute freely.
string gName = "emailcard"; // name of a notecard in the object's inventory integer gLine = 0; // current line number key gQueryID; // id used to identify dataserver queries string emailaddress = ""; integer emailactivated = TRUE; // set to FALSE to deactivate email
//function that spews the actual SLURL to a bunch of places
spewslurl(string emailaddress) {
string regionname = llDumpList2String(llParseString2List(llGetRegionName(),[" "],[]),"%20"); vector pos = llGetPos(); integer x = (integer)pos.x; integer y = (integer)pos.y; integer z = (integer)pos.z; string slurl = "http://slurl.com/secondlife/"+regionname+"/"+(string)x+"/"+(string)y+"/"+(string)z+"/";
//spews the stuff everythere! llOwnerSay(slurl); llInstantMessage(llGetOwner(),slurl); llSetText(slurl,<1.0,1.0,1.0>,1.0); if (emailactivated) { //tell the owner where this mail is going to be sent llOwnerSay("Email set to:" + emailaddress + "\n"); llEmail(emailaddress, slurl, slurl); //tell the owner when this mail has been sent llOwnerSay("Email sent to:" + emailaddress + "\n"); }
}
default {
state_entry() { gQueryID = llGetNotecardLine(gName, gLine); // request first line }
dataserver(key query_id, string data) { if (query_id == gQueryID) { if (data != EOF) { // not at the end of the notecard //llSay(0, (string)gLine+": "+data); // output the line for debugging purposes emailaddress = data; ++gLine; // increase line count gQueryID = llGetNotecardLine(gName, gLine); // request next line } } } touch_start(integer t) { llSay(0, "OPC SLURL HUD" ); llSay(0, "By CodeBastard Redgrave\n" ); spewslurl(emailaddress); }
}
</lsl>