Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Santa Server v1.0

Jora Welesa
Dark Lady of the Sith
Join date: 11 Jul 2005
Posts: 153
12-19-2005 21:52
As a business person, I've lately had a lot of people come to me asking if they can give me the money and send an item to a loved one on SL. However, I'm not here all the time, so this can be quite a problem at times. Due to the nature of my business most of my items are copyable/no-transfer. I've sure there are other vendors that have run into this trouble. :)

So I've come up with a possible solution and in the spirit of Christmas, I want to share it with SL at large as a gift.

What I've created is a client/server model for handling gifts. You set up another vendor with a scripted gift card that is designed to be buyable for the price of the object the person wants to give. They take the gift card, give it to their loved one, and then the new owner simply types "/redeem" and they get the gift.

Vendor gets his or her money and person gets their gift. It all works out. :)

Please note: I'm at RL work at the moment and cannot test this script. I can't garantee it will compile yet, but one of you script savy individuals can probably make it work. :) When I get home I'll check it over and re-post it if need be. :) So in the next two posts, I'll put up direction on how to set this little thing up.
_____________________
Jora Welesa
Dark Lady of the Sith
Join date: 11 Jul 2005
Posts: 153
12-19-2005 22:14
This is the Client side script.

CODE
 
//Santa_server.lsl v0.1a
//by Jora Welesa.
//This script is free to copy, transfer, or modify, but in no way, shape, or form may it be sold without
//the express concent of the creator.
//This is the server side script used to handle taking requests from the various
//gift cards that end up in SL for the vendor's items.
//GLOBAL VARIABLES -- Edit these to suit.
string Password = ""; //This is a password to verify integrity of the gift card and
//make sure no one's emulating it.
string email = ""; //E-mail address to send reports to if someone tries to emmulate the gift card.
//Change nothing below this line!!

integer giftCounter; //Counter for how many gifts have been given out.
list fData; //List to hold Formated data for request handling.
key giftGetter; //Key of the person getting the dift.
string request; //Type of incoming request.
string passMatch; //String to hold the password match.
string gift;
default
{
state_entry()
{
llOwnerSay(llGetObjectName() + " Ready."); //Let the owner know we're good to go.
llSetTimerEvent(2.5);
}
on_rez(integer param)
{
llResetScript();
}
timer()
{
llGetNextEmail("",""); //Check the queue for incoming e-mails to the server.
}
touch_start(integer num)
{
llOwnerSay("Server key is: " + (string)llGetKey());
}

email(string time, string address, string subj, string message, integer num_left)
{
//Convert the subject line into a list of commands.
fData = llParseStringKeepNulls(subj,["*_*"],[]);
request = llList2String(fData,0); //Get our request from the client card.
passMatch = llList2String(fData,1);
giftGetter = (key)llList2String(fData,2);
gift = llList2String(fData,3);
if(request == "CHECK")
{
llInstantMessage(giftGetter,llGetObjectName() + " is taking requests.");
return;
}
if(request == "GIFT")
{
//The client wants their gift.
//First thing is verify the password.
if(passMatch == Password)
{
//Password good. Let's go.
llInstantMessage(giftGetter,"Verified. Please Stand by....");
llGiveInventory(giftGetter,gift);
llInstantMessage(giftGetter,"Merry Christmas! :)");
giftCounter++;
llSetText(llGetObjectName() + " has served \n " + (string)giftCounter + " gifts!",<1,1,1>,1);
}
else
{
//Password not good! :(
llInstantMessage(giftGetter,"The gift card you are using is not verified. Contacting creator.");
llEmail(email,"Failed Gift Report.",llKey2Name(giftGetter) + " attempted to get " + gift + ". However the password was invalid.");
}
//Cleanup.
fData = []; //Clear the data list to conserve memory.
return;
}
}
}


To set this up, Create an object and name it accordingly, then copy this script into it.

Edit the value for the variable Password to an alphanumeric password. Something easy for you to remember, but would be difficult to guess.

Edit the value for the variable email to your RW e-mail address. Someplace you can easily get to in order to recieve reports.

Once the script is compiled and running, touch the server to get it to report its key to you. Save this key as you will need it in a moment.

Now, stuff the server with all the inventory that you wish to put up to be purchased as gifts.
_____________________
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
12-19-2005 22:29
/54/cc/78461/1.html
_____________________
i've got nothing. ;)
Jora Welesa
Dark Lady of the Sith
Join date: 11 Jul 2005
Posts: 153
12-19-2005 22:37
This is the server side script.

CODE
 
//Santa_server.lsl v0.2a
//by Jora Welesa.
//This script is free to copy, transfer, or modify, but in no way, shape, or form may it be sold without
//the express concent of the creator.
//This is the server side script used to handle taking requests from the various
//gift cards that end up in SL for the vendor's items.

//GLOBAL VARIABLES -- Edit these to suit.
string Password = ""; //This is a password to verify integrity of the gift card and
//make sure no one's emulating it.
string rwEmail = ""; //E-mail address to send reports to if someone tries to emmulate the gift card.

//Change nothing below this line!!

integer giftCounter; //Counter for how many gifts have been given out.
list fData; //List to hold Formated data for request handling.
key giftGetter; //Key of the person getting the dift.
string request; //Type of incoming request.
string passMatch; //String to hold the password match.
string gift;

default
{
state_entry()
{
llOwnerSay(llGetObjectName() + " Ready."); //Let the owner know we're good to go.
llSetTimerEvent(2.5);
}
on_rez(integer param)
{
llResetScript();
}
timer()
{
llGetNextEmail("",""); //Check the queue for incoming e-mails to the server.
}
touch_start(integer num)
{
if(llDetectedKey(0) == llGetOwner())
{
llOwnerSay("Server key is: " + (string)llGetKey());
}
}

email(string time, string address, string subj, string message, integer num_left)
{
//Convert the subject line into a list of commands.
fData = llParseStringKeepNulls(subj,["*_*"],[]);
request = llList2String(fData,0); //Get our request from the client card.
passMatch = llList2String(fData,1);
giftGetter = (key)llList2String(fData,2);
gift = llList2String(fData,3);

if(request == "CHECK")
{
llInstantMessage(giftGetter,llGetObjectName() + " is taking requests.");
return;
}
if(request == "GIFT")
{
//The client wants their gift.
//First thing is verify the password.
if(passMatch == Password)
{
//Password good. Let's go.
llInstantMessage(giftGetter,"Verified. Please Stand by....");
llGiveInventory(giftGetter,gift);
llInstantMessage(giftGetter,"Merry Christmas! ");
giftCounter++;
llSetText(llGetObjectName() + " has served \n " + (string)giftCounter + " gifts!",<1,1,1>,1);
}
else
{
//Password not good!
llInstantMessage(giftGetter,"The gift card you are using is not verified. Contacting creator.");
llRequestAgentData(giftGetter,DATA_NAME);
}
//Cleanup.
fData = []; //Clear the data list to conserve memory.
return;
}
}
dataserver(key queryID,string data)
{
llEmail(rwEmail,"Failed Gift Report.",data + " attempted to get " + gift + ". However the password was invalid.");

}
}


To set this up, Create an object and name it accordingly, then copy this script into it.

Edit the value for the variable Password to an alphanumeric password. Something easy for you to remember, but would be difficult to guess.

Edit the value for the variable email to your RW e-mail address. Someplace you can easily get to in order to recieve reports.

Once the script is compiled and running, touch the server to get it to report its key to you. Save this key as you will need it in a moment.

Now, stuff the server with all the inventory that you wish to put up to be purchased as gifts.

Here is the code for the gift cards. Client side script. :)

CODE

//Gift_card.lsl v0.1a
//by Jora Welesa.
//This script is free to copy, transfer, or modify, but in no way, shape, or form may it be sold without
//the express concent of the creator.
//This is the client side of the Santa_server set.
//When rezzed in world, the owner only need type "/redeem" to recieve their gift.
//It comes with layered security to help prevent theft and ensure
//validity of the gift requests.

//GLOBAL VARIABLES--Edit these to suit.
string Password = ""; //Should be the same password as is on the server.
key serverKey = ""; //Key to the server. Get this by touching the server while it's running.

string creatorName = ""; //Your Complete Case Sensitive SL av name.
string floatyMessage = ""; //Message to be shown floating above the gift card when rezzed.


//Change nothing below this line!!
string gift;
vector color;

default
{
on_rez(integer param)
{
llOwnerSay("Starting up.");
//Security check#1. Is the script still within an object made by you?
llRequestAgentData(llGetCreator(),DATA_NAME);
}
dataserver(key queryid, string data)
{
if(data != creatorName)//Script and prim have different creators!
{
llOwnerSay("You have put this into an object it is not intended to be in! ");
llOwnerSay("Santa Says you been bad!");
llRemoveInventory(llGetScriptName());
}
else //Pass security check #1.
{
//Security Check #2. Has it already been used?
color = llGetColor(ALL_SIDES);
if(color != <1,0,0>)
{
//Pass Security Check #2. Not used previously.
gift = llGetObjectDesc(); //Get the gift name to send to the server.

llListen(0,"",llGetOwner(),"");
llSetText(floatyMessage + " \n Type '/Check' to check server status. \n Type '/Redeem' to receive your gift.",<1,1,1>,1);
return;
}
else
{
//Someone's used this card already!
llOwnerSay("This gift card has already been used and must be recycled.");
llDie();
}
}
}
listen(integer channel,string name,key id,string msg)
{
if(llToLower(msg) == "/check")
{
llOwnerSay("Checking server status. Please Stand by...");
llEmail((string)serverKey + "@lsl.secondlife.com",
"CHECK*_*" + Password + "*_*" + (string)llGetOwner() + "*_*" + gift,
"");
llOwnerSay("Polling Complete.");
return;
}
if(llToLower(msg) == "/redeem")
{
llOwnerSay("Contacting Server to get your gift. Please wait.");
llSetColor(<1,0,0>,ALL_SIDES);
//Security Check #3. Server Side Password Verify!
llEmail((string)serverKey + "@lsl.secondlife.com",
"GIFT*_*" + Password + "*_*" + (string)llGetOwner() + "*_*" + gift,
"");
llOwnerSay("Thank you and have a happy holiday! ");
llOwnerSay("Cleaning up.");
llDie();
}
}
}


To set this up, create a single small prim, preferably a box shaped into the form of a card. Set whatever texture you would like on, then set the color. It's important that the color NOT be red as this is a security check.

Set the value for the Variable Password to the same as that for the server.
Set the value for the variable serverkey to the key of the server, which you should've gotten when you set the server up. ;)
Put your complete case sensitive SL avatar name into the variable for creatorName.
Finally change the value of floatyMessage to the text you want displayed above the card when it's rezzed in world.

To define what gift this is for, just put the exact name of the item this is for into the description of the object.

That's it. Now it will communicate with the server and the server will take the item from its inventory and hand it to the person that redeemed the card. :)

You want to make sure that all your gift cards are No-Modify/No-Copy/Transfer.
Same with the script.

EDIT

Ok. Just got home and verified the script. It seems to work as expected, which is a blessing. :) I tried to keep this as secure as possible while still have it open source. So even with an emulator, without the password someone would have a hard time breaking into your server.

I'm in the process of building up and boxing a freebie version in world so that'll be up for grabs shortly. :)
_____________________
Sydney Alexander
Registered User
Join date: 19 Feb 2005
Posts: 69
12-19-2005 23:29
Hi there, what a neat idea!

There seems to be an issue with this variable:

From: someone
string email = ""; //E-mail address to send reports to if someone tries to emmulate the gift card.


It will complie if I make it any other name. rwemail for example.

thanks,

Sydney