02-18-2013, 02:27 AM
What it does... (In a nutshell)
Lets you send linden from one account to anyone via email, without having to log in world..
How to set it up...
You copy this script into a prim at a permanent location. Before you save the script, note the top of the script where it has a passphrase (The line string passphrase = "KingGoon ROCKS!";) Be sure to change the passphrase and remember it. This is your ATM 'PIN' number. Note: It is NOT case sensitive, so KingGooN = KINGGOON = kinggoon... Save the script. When this script starts, first thing it does is ask for debit permissions, this is so it can send the linden from the owners account.. Second, it gives you the prims email address.. Record this and put it in your address book.. The setup is complete.
How to use it...
You send an email to the prim using the email address it gives you.. The format of the message is
To: <primaddress>@lsl.secondlife.com
Subject: <passphrase>
Message: KingGoon Muthafucka : 500
and it will transfer 500 linden to KingGoon Muthfucka
How it works..
The format <name> : <amount> is parsed by the email handler.. It then submits the name to the name2key function to get the key.. If the key is not valid or fails, the transfer aborts and you *should* get an email response that it failed. (I seem to have a little trouble with spam filters blocking responses).. If the key is validated, then the scripts sends the linden to the given person.
You can rez as many as you need, with as many avatars as you'd like (Note: you want to make sure each one is owned by the avatar you want to take money from) .. Each one will be given a unique email address..
Lets you send linden from one account to anyone via email, without having to log in world..
How to set it up...
You copy this script into a prim at a permanent location. Before you save the script, note the top of the script where it has a passphrase (The line string passphrase = "KingGoon ROCKS!";) Be sure to change the passphrase and remember it. This is your ATM 'PIN' number. Note: It is NOT case sensitive, so KingGooN = KINGGOON = kinggoon... Save the script. When this script starts, first thing it does is ask for debit permissions, this is so it can send the linden from the owners account.. Second, it gives you the prims email address.. Record this and put it in your address book.. The setup is complete.
How to use it...
You send an email to the prim using the email address it gives you.. The format of the message is
To: <primaddress>@lsl.secondlife.com
Subject: <passphrase>
Message: KingGoon Muthafucka : 500
and it will transfer 500 linden to KingGoon Muthfucka
How it works..
The format <name> : <amount> is parsed by the email handler.. It then submits the name to the name2key function to get the key.. If the key is not valid or fails, the transfer aborts and you *should* get an email response that it failed. (I seem to have a little trouble with spam filters blocking responses).. If the key is validated, then the scripts sends the linden to the given person.
You can rez as many as you need, with as many avatars as you'd like (Note: you want to make sure each one is owned by the avatar you want to take money from) .. Each one will be given a unique email address..
PHP Code:
// You need to change the passphrase prior to using!!!
//---------------------------------------------------
string passphrase = "KingGoon ROCKS!";
//---------------------------------------------------
string GiveTo;
key GiveToKey;
integer Amount;
integer cmdName2Key = 19790;
integer cmdName2KeyResponse = 19791;
list gRequests;
string LastAddress;
string LastSubject;
key requestName2Key(string inName)
{
list lNameParts = llParseString2List(inName, [" "], []);
string lFirstName = llList2String(lNameParts, 0);
string lLastName = llList2String(lNameParts, 1);
return llHTTPRequest("http://name2key.appspot.com/?name=" + lFirstName + "%20" + lLastName, [], "");
}
default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT );
llSetText("Waiting for debit permissions from " + llKey2Name(llGetOwner()),<1.0,1.0,1.0>,1.0);
}
run_time_permissions (integer perm)
{
if(perm & PERMISSION_DEBIT)
{
llSetText("ATM is online and active",<1.0,1.0,1.0>,1.0);
state Ready;
}
else
{
llSetText("I need debit permissions to run! Touch me to reset me and try again",<1.0,1.0,1.0>,1.0);
}
}
touch_start(integer num_detected)
{
llResetScript();
}
}
state Ready
{
state_entry()
{
llOwnerSay("ATM has started");
llOwnerSay("My E-Mail Address is: " + (string)llGetKey() + "@lsl.secondlife.com");
llSetTimerEvent(10.0);
}
timer()
{
llGetNextEmail("","");
}
email( string time, string address, string subject, string message, integer num_left )
{
if (llStringTrim(llToLower(subject),STRING_TRIM) == llToLower(passphrase))
{
list templist = llParseString2List(message,[":"],[]);
GiveTo = llStringTrim(llList2String(templist,0),STRING_TRIM);
Amount = llList2Integer(templist,1);
llMessageLinked(LINK_SET, cmdName2Key, llToLower(GiveTo), NULL_KEY);
}
else
{
LastAddress = address;
LastSubject = subject;
llEmail(address,"RE: " + subject, "Passphrase Denied");
}
if(num_left)
llGetNextEmail("", "");
}
link_message(integer inFromPrim, integer inCommand, string inKeyData, key inReturnedKey)
{
if (inCommand == cmdName2Key)
gRequests += [requestName2Key(inKeyData), inReturnedKey];
else if(inCommand == cmdName2KeyResponse)
{
list lParts = llParseString2List(inKeyData, [":"], []);
string lName = llList2String(lParts, 0);
key lKey = (key)llList2String(lParts, 1);
if (llSubStringIndex(lName,"<pre>") == -1)
{
GiveToKey = lKey;
llGiveMoney(lKey,Amount);
llOwnerSay("Given " + (string)Amount + "L to " + lName);
llEmail(LastAddress,"RE: " + LastSubject, (string)Amount + "L transfer initiated to: " + GiveTo);
}
else
{
llOwnerSay("Invalid Name/Key.. Transfer aborted..");
llEmail(LastAddress,"RE: " + LastSubject, "Invalid name or key not found for: " + GiveTo);
}
}
}
http_response(key inKey, integer inStatus, list inMetaData, string inBody)
{
integer lPosition = llListFindList(gRequests, [inKey]);
if (lPosition != -1)
{
llMessageLinked(LINK_THIS, cmdName2KeyResponse, inBody, llList2Key(gRequests, lPosition+1));
gRequests = llDeleteSubList( gRequests, lPosition, lPosition + 1);
}
}
on_rez(integer start_param)
{
llResetScript();
}
}