Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Avatar Age Age_Check  

Age_Check

Age Check.lsl

Category: Avatar Age
By : Anonymous
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Age_Check
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Age_Check_1.lsl
1
2 // This is a simple method to verify the age of a person.
3 // It does not use all the fancy leap year detection and whatever stuff.
4 // It compensates for leap years by adding a quarter day to each full year.
5 // For everyday use the accuracy of +/- 1 to 2 days should be sufficient.
6
7 // Free Script. Do not remove this header or the comments if you plan to pass it on to others.
8 // This script may NOT be sold for monetary profit unless it is integrated in some other script
9 // you want or need an age check for.
10
11 // Enjoy.
12
13 key Query;
14
15 default
16 {
17
19
21 {
22 llSetText("Verifying your age...",<0,1,0>,1);
24 }
25
26 dataserver(key QID,string Data)
27 {
28 if(QID == Query)
29 {
30 // The following variables are set to account for leap years and assume
31 // the days evenly distributed amongst the 12 months of a year.
32 float YrDays = 365.25;
33 float MnDays = YrDays / 12;
34 float DyInc = 1 / MnDays;
35 // This is the user's birthdate.
36 integer uYr = (integer)llGetSubString(Data,0,3);
37 integer uMn = (integer)llGetSubString(Data,5,6);
38 integer uDy = (integer)llGetSubString(Data,8,9);
39 float uXVal = uYr * YrDays + (uMn - 1) * MnDays + uDy * DyInc;
40 // This is today's date
41 Data = llGetDate();
42 integer Yr = (integer)llGetSubString(Data,0,3);
43 integer Mn = (integer)llGetSubString(Data,5,6);
44 integer Dy = (integer)llGetSubString(Data,8,9);
45 float XVal = Yr * YrDays + (Mn - 1) * MnDays + Dy * DyInc;
46 // We calculate the difference between those two dates to get the number of days.
47 integer DDiff = (integer)(XVal - uXVal);
48 // Here we check if the calculated age fits our requirements.
49 if(DDiff < 180) {
50 llSetText("Age Check Failed!\nYou are younger than 180 days!",<1,1,1>,1);
51 } else {
52 llSetText("Age Check Passed!",<1,1,1>,1);
53 }
54 }
55 }
56 }
57 // END //

Back to the Best Free Tools in Second Life and OpenSim.