User:Cow Taurog/SMS
READ THIS ALL!
This script will send an SMS from SL to almost any cell phone. It uses the
Resale of this script is not permitted (even for L$1 as a "freebie", you can sell for L$0 just as easy).
<lsl>
//
// This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike
// 3.0 United States License.
// To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/us/
// or send a letter to Creative Commons, 171 Second Street, Suite 300,
// San Francisco, California, 94105, USA.
//
// You may copy, modify, or distribute this work as long as these notices remain,
// and the same license is used.
//
// == Resale of this work is not permitted. ==
// (even for L$1 as a "freebie")
//
// © 2009 (cowtaurog@gmail.com)
integer giDialog; key gkTouch; string gsCarrier; string gsRecepient; string gsSubject; string gsMess; integer DEBUG=0; integer listen0; integer listen1; integer listen2; integer giPrvChan; list glCarrierNames=["AT&T","T-Mobile","Verizon","Sprint","Nextel","Virgin","Boost","Cricket"]; list glCarrierSuffix=["@txt.att.net","@tmomail.net","@vtext.com","@messaging.sprintpcs.com","@messaging.nextel.com","@vmobl.com","@myboostmobile.com","@sms.mycricket.com"]; integer pseudo_random(string text, integer nonce, integer start, integer end){
// this function (c)(cc-by) Strife Onizuka, http://creativecommons.org/licenses/by/3.0/ return(integer)("0x"+llGetSubString(llMD5String(text,nonce),start,end));
}
default{
state_entry(){
integer iLast;
integer iNow=30*((integer)llGetGMTclock()/30);
string sFeed=(string)llRound(llGetGMTclock())+(string)llRound(llGetWallclock())+llSHA1String(llGetRegionName()+llGetSimulatorHostname());
giDialog=pseudo_random(sFeed,(iLast=iNow),2,7);
llSetObjectName("Send SMS");
}
touch_start(integer num){
gkTouch=llDetectedKey(num-1);
state running;
}
} state running{
state_entry(){
listen0=llListen(giDialog,"","","");
llDialog(gkTouch,"Pick the recepient's carrier.",glCarrierNames,giDialog);
}
listen(integer chan,string name,key id,string mess){
gsCarrier=llList2String(glCarrierSuffix,llListFindList(glCarrierNames,[mess]));
state number;
}
} state number{
state_entry(){
listen2=llListen(giDialog+3,"",gkTouch,"");
llInstantMessage(gkTouch,"Say the number of the recepient on /"+(string)(giDialog+3)+". Must be numbers only, no spaces, parenthesis, hyphens, or other formatting.");
}
listen(integer chan,string name,key id,string mess){
gsRecepient=mess;
state subject;
}
} state subject{
state_entry(){
listen2=llListen(giDialog+4,"",gkTouch,"");
llInstantMessage(gkTouch,"Say the subject on /"+(string)(giDialog+4)+".");
}
listen(integer chan,string name,key id,string mess){
gsSubject=mess;
state body;
}
} state body{
state_entry(){
listen2=llListen(giDialog+5,"",gkTouch,"");
llInstantMessage(gkTouch,"Say the body of the message on /"+(string)(giDialog+5)+".");
}
listen(integer chan,string name,key id,string mess){
gsMess=mess;
state send;
}
} state send{
state_entry(){
llEmail(gsRecepient+gsCarrier,gsSubject,gsMess);
llInstantMessage(gkTouch,"SMS sent.");
llResetScript();
}
} </lsl>