Notecard that is in the server prim (can be renamed by the owner and set in the server script).
Should have an item per line in the format of "Item:Version", Item must be spelled exactly the same as the item in the server.
Gym Membership:1.0
Spandex Pants:1.0
Underarmor Sweat Tee Shirt:1.05
Client Script
key serverID = "00000000-0000-0000-0000-000000000000"; // Fill this in with the UUID that the server spits out on rez.
key gkOwner;
string version = "1.0"; // Version number of the item
string item = "Spandex Pants"; // Name of the item
string company = "I work here"; // Name of the company
default
{
state_entry()
{
}
attach(key attached)
{
if (attached != NULL_KEY)
{
llOwnerSay("Checking for updates for your " + company + " product."

llEmail(serverID,"Update Request",item + ":" + version + "|" + (string)llGetOwner());
}
Server Script:
// CTD Updater Script
// Server UUID:
// NOTE: This is an area to keep the UUID in the notes for reference.
key serverID;
string cardName = "Updates"; // Name of the Notecard with all of the Item:Version info
string company = "I work here"; // Name of the company
key lineTotalID;
key locateID;
integer lineCurrent = 0; // Line Offset
integer lineTotal; // Line Offset
string noteLine;
string noteFront;
string noteBack;
string item;
string version;
key user;
float watchdog = 10.0;
integer InUse = FALSE;
default
{
state_entry()
{
llWhisper(0,llGetKey());
llSetTimerEvent(5.0);
lineTotalID = llGetNumberOfNotecardLines(cardName);
}
touch_start(integer total_number)
{
llResetScript();
}
timer()
{
llGetNextEmail("",""

}
email(string time, string address, string subject, string body, integer remaining)
{
llWhisper(0,"Received Request..."

if (InUse == FALSE)
{
InUse = TRUE;
llSetText("In Use...",<1,1,1>,1.0);
string message = llDeleteSubString(body, 0, llSubStringIndex(body, "\n\n"

integer itemMark = llSubStringIndex(message,":"

integer verMark = llSubStringIndex(message,"|"

item = llGetSubString(message,0,(itemMark - 1));
version = llGetSubString(message,(itemMark + 1),(verMark - 1));
user = (key)llGetSubString(message,(verMark + 1), -1);
llWhisper(0,"Item: " + item);
llWhisper(0,"Version: " + version);
llWhisper(0,"User: " + llKey2Name(user));
lineCurrent = 0;
locateID = llGetNotecardLine(cardName,0);
}
}
dataserver(key queryID, string data)
{
if (queryID == lineTotalID)
{
lineTotal = (integer)data;
llInstantMessage(llGetOwner(),"Found " + (string)lineTotal + " items on update server."

}
if (locateID == queryID)
{
if (data != EOF)
{
noteLine = data;
integer marker = llSubStringIndex(noteLine,":"

if (marker != -1)
{
lineCurrent += 1;
noteFront = llGetSubString(noteLine,0,( marker - 1 ));
noteBack = llGetSubString(noteLine,( marker + 1 ), -1);
}
if (marker == -1)
{
llInstantMessage(llGetOwner(),"Error with Update Server Inventory line: " + (string)lineCurrent);
}
if (noteFront != item)
locateID = llGetNotecardLine(cardName,lineCurrent);
if (noteFront == item)
{
if ((float)noteBack > (float)version)
{
llGiveInventory(user,item);
llInstantMessage(user,"Sending you the updated version of: " + item);
}
if ((float)noteBack < (float)version)
llInstantMessage(user,"There was an error with the update of your " + item + ", please contact " + llKey2Name(llGetOwner()));
if ((float)noteBack == (float)version)
llInstantMessage(user,"Your " + item + " by " + company + " product is up to date."

InUse = FALSE;
llSetText("",<1,1,1>,0.0);
}
}
}
if (data == EOF)
{
InUse = FALSE;
llSetText("",<1,1,1>,0.0);
llInstantMessage(llGetOwner(),"Update Server Hit EOF on Update List"

}
}
}
I did some last minute changes to make this public. It might have fudged the script a bit. So I am fully expecting this to have some syntax errors.
After you have the client script in the item that you want to sell, the server script in a prim that will ALWAYS be inworld, the most recent version of the sellable item in the server prim, and the notecard with all the items with matching names to the items in the prim with the specified versions. Then you are set.
Things to keep in mind.
There are always some draw backs to update servers.
- If you have your items set as transferable, it is possible that someone can get unlimited copies of your stuff. Keep this in mind. All they would have to do it detach, attach, get the updated item, give to friend.. detach, attach, get the updated item, give to friend, etc.
That is never good for business. Don't say that I never warned you.