User:Lum Pfohl/LSL Goodies/HI-WA Occupancy Counter System/Email Slave 1.02
Jump to navigation
Jump to search
// _ ______ __ _ _ // | | | ___ \/ _| | | | | // | | _ _ _ __ ___ | |_/ / |_ ___ | |__ | | // | | | | | | '_ ` _ \ | __/| _/ _ \| '_ \| | // | |___| |_| | | | | | | | | | || (_) | | | | | // \_____/\__,_|_| |_| |_| \_| |_| \___/|_| |_|_| // // Lum's Email Slave 1.02 // // Written by Lum Pfohl May 16, 2007 // // // This script simply takes a link message and determines if it is for itself, and acts on it // by sending an email if it is. Otherwise, execution falls through. integer __debug=FALSE; integer scriptNumber = -1; default { state_entry( ) { // determine which script copy I am and set my script number as such string scriptName = llGetScriptName(); integer nameLength = llStringLength( scriptName ); scriptNumber = (integer) llGetSubString( scriptName, nameLength - 2, nameLength - 1 ); } link_message(integer source, integer num, string incomingMessage, key id) { if (__debug) { llOwnerSay(llGetScriptName() + ": " + (string)num + " " + incomingMessage); } // dialogbox called for script reset then do so if (num == 1000) { llResetScript(); } // if the called script number (num) matches THIS script number, then take action if (num == scriptNumber) { // test if the message is for THIS script // unmarshall the incoming message into a list list emailComponents = llParseString2List(incomingMessage, ["|"], [""]); string toAddress = llList2String(emailComponents, 0); string subject = llList2String(emailComponents, 1); string messageBody = llList2String(emailComponents, 2); // send the email (and block for 20 seconds) llEmail (toAddress, subject, messageBody); } } }