Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: 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
Original Thread
12-19-2005 22:29
/15/5f/78451/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.

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. :)

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-20-2005 00:02
Neat idea!

The toucher for to get the server key is clickable by anyone, but only viewable by the owner. It would be nice to limite the clicking to the owner or toggle the key graber on and off. Maybe an on rez and then stop. You would need to rerez it to grab the key again?

Also I think you need to change your variable "email" in the server script as it is also called later in the script. I used "rwemail" real world email.

:0)

Happy Holidays!

Sydney
Jora Welesa
Dark Lady of the Sith
Join date: 11 Jul 2005
Posts: 153
12-20-2005 00:12
Good idea. :) I put those changes in.
_____________________
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
12-20-2005 01:13
I very much like this idea...and think all stores could benefit from it. Thanks for makin' the script!
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Alex Edo
Insert Brain Here...
Join date: 27 Feb 2005
Posts: 108
12-20-2005 02:27
Ok. Somthing I justed noticed.

llEmail(rwEmail,"Failed Gift Report.",llKey2Name(giftGetter) + " attempted to get " + gift + ". However the password was invalid.";);

llKey2Name Wont work UNLESS they are in the sim the server is in.
Jora Welesa
Dark Lady of the Sith
Join date: 11 Jul 2005
Posts: 153
12-20-2005 17:39
From: Alex Edo
Ok. Somthing I justed noticed.

llEmail(rwEmail,"Failed Gift Report.",llKey2Name(giftGetter) + " attempted to get " + gift + ". However the password was invalid.";);

llKey2Name Wont work UNLESS they are in the sim the server is in.


Hrm. I didn't know that. Guess you learn something new every day. :) Thanks for the heads up. I've adjusted the script to manage it properly.
_____________________
Introvert Petunia
over 2 billion posts
Join date: 11 Sep 2004
Posts: 2,065
12-20-2005 18:24
Not to diminish Jora's contribution and very generous script give-away, but I wanted to note that www.slboutique.com has allowed "gift" purchases from their merchants for at least a year which is very helpful for no-xfer items.

The reason I mention this is that SLBoutique system is extremely well tested and runs on its own server and is not as subject to the recent faults in LSL as this may be. I have no connection with Jora or SLBoutique.
Alex Edo
Insert Brain Here...
Join date: 27 Feb 2005
Posts: 108
12-21-2005 01:37
It also takes time to set up a SLB account. Also SLE do the same. BUt there is one problem with this. You would have to be on SLB or SLE on Christmas to make this work. And an Inworld gift token is very cool. They could be given in raffels and are alot easyer to use. It is much easyer if ALL businesses gave out nocopy/Transfer tokens for Copy/Tranfer stuff.

Jora Welesa. I will contact you in game. I've been working on a little modification. *wink* This could turn into a very very good idea!