Simple freebie giver that discriminates against old people. Use to allow only newer residents to grab your freebies.
- https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); color: rgb(0, 0, 0); font-family: verdana, helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
- The measure of age isn't perfect but, the worst it will be off by is a day or so.
Load the prim up with stuff (of any type (set free scripts to "Not Running")) and the script will automatically read the contents and be ready to hand them out.
// V1 // integer noobage = 30; // Age in days upto which an agent is considered eligible. string folder_name = "Folder"; // name of folder as it appears in the agents inventory. /////////////////////////////////////////////////////////////////////////////////////// list inv = []; integer Inv = 0; integer busy = 0; list waiting = []; key iq = NULL_KEY; key Agent = NULL_KEY; integer ThankYouForTheDays(string d) { return llRound((((float)llGetSubString(d, 0, 3)) * 365.25) + (((float)llGetSubString(d, 5, 6)) * 30.4375) + ((float)llGetSubString(d, 8, 9))); } integer Noob(string dob, string date) { if((ThankYouForTheDays(date) - ThankYouForTheDays(dob)) <= noobage) return 1; return 0; } default { on_rez(integer param) { llResetScript(); } changed(integer change) { if(change & (CHANGED_OWNER | CHANGED_INVENTORY)) llResetScript(); } state_entry() { integer noi = llGetInventoryNumber(INVENTORY_ALL); string name; while(noi) { if((name = llGetInventoryName(INVENTORY_ALL, (--noi))) != llGetScriptName()) inv += [name]; } Inv = llGetListLength(inv); } touch_start(integer nd) { while(nd && Inv) { key agent = llDetectedKey(--nd); if(!busy) { busy = TRUE; iq = llRequestAgentData((Agent = agent), DATA_BORN); } else { if(llListFindList(waiting, [agent]) == -1) waiting += [agent]; } } } dataserver(key q, string data) { if(q == iq) { if(Noob(data, llGetDate())) llGiveInventoryList(Agent, folder_name, inv); if(llGetListLength(waiting)) { iq = llRequestAgentData((Agent = llList2Key(waiting, 0)), DATA_BORN); waiting = llDeleteSubList(waiting, 0, 0); } else busy = FALSE; } } }