|
Sweet Thirty
Registered User
Join date: 23 May 2005
Posts: 14
|
01-22-2009 12:15
Is there a limit to the number of script help you can ask for????? hope not  Anyway... I looked but couldnt find it... is there a script that will do a scan for the youngest avitar in a room based on their DOB? BUT it has to be able to scan within a date range... like the youngest avatar born Febuary 1 2008 to february 28 2008 or something like that. I also want it to give that avatar a prize... either lindens or an object.... but I dont want it to only scan noobies that are a day old.... cause you know people will cheat... which is why I need to be able to set the age range. anyway does anyone know if there's a script out there that'll help FYI I'm still a script noobie... so any help will be VERY Helpful.
|
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
01-22-2009 12:55
Take a look at http://lslwiki.net/lslwiki/wakka.php?wakka=llRequestAgentData to see how to get an av's rezdate. There's even a short example script there. Incorporating that into a script that scans the room and figures out which av is the youngest will be a bit of a challenge, though. For starters, your scan event will only detect up to 16 people, so dealing with a crowded room won't be easy. It might be better to have contestants touch your object to register in the contest. You could determine their ages at that point, store tham and the av names in a strided list, and then sort them when it's time to award the prize.
|
|
Papalopulus Kobolowski
working mind
Join date: 11 Aug 2006
Posts: 326
|
01-23-2009 09:46
I found this script long time ago and i adapted to a newbie vendor only, check it maybe can be usefull for you //Setup integer age = 31; // Chceks with a GMT timestamp integer price = 1; // Sets the sale price string item_name = "*PS* Susane black"; // must be inside of "" and exactly the same... //as the item name inside the vending prim //End Setup
key user_key; key owner_key; integer paid;
string check_age(string data) { float av_total_days = do_math(data);
data = llGetDate();
float td_total_days = do_math(data);
data = (string)llRound((td_total_days - av_total_days) * 365);
return data; }
float do_math(string data) { float data =( ((float)llGetSubString(data,5,6)/12)+ ((float)llGetSubString(data,8,9)/365)+ ((float)llGetSubString(data,0,3)) ); return data; }
default //Starts things off by asking you for debit permissions // later on this lets the object take money from you incase of mispayment or change { // I use number values 2 is the same as PERMISSION_DEBIT, habbit ... state_entry() { llSetPayPrice(PAY_HIDE,[price,PAY_HIDE,PAY_HIDE,PAY_HIDE]); llRequestPermissions(llGetOwner(),2); }
run_time_permissions(integer perm) { if (perm & 2) state online; else { llOwnerSay("please grant the permission to continue"); llRequestPermissions(llGetOwner(),2); } } }
state online { on_rez(integer r) {llResetScript();}
money(key id, integer amount) { user_key = id; paid = amount; state no_money; } }
state no_money //Blocks out money while info is processed { on_rez(integer r) {llResetScript();} state_entry(){llRequestAgentData(user_key,DATA_BORN);}
dataserver(key kQueryid, string data) { data = check_age(data); if ((integer)data <= age) { if (paid == price) llGiveInventory(user_key,item_name); else if (paid > price) { llGiveMoney(user_key,paid - price); llGiveInventory(user_key,item_name); } else { llGiveMoney(user_key,paid); llInstantMessage(user_key, "you give me "+(string)paid+"L$, but the item cost "+(string)price+"L$"); } } else { llInstantMessage(user_key, "im sorry but you are too old"); llGiveMoney(user_key,paid); } state online; } }
|