<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<start type="script">
every_fourth_year_function
character_creation_function
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<inherit name="character_object_type" />
<date_of_birth_integer type="string">"DoB: " + player.month_of_birth_integer + "/" + player.day_of_birth_integer + "/" + player.shortened_year_of_birth_integer</date_of_birth_integer>
<date_of_birth_string type="string">"DoB: " + player.month_of_birth_string + " " + player.day_of_birth_integer + ", " + player.year_of_birth_integer</date_of_birth_string>
</object>
</object>
<object name="global_data_object">
<inherit name="editor_object" />
<month_integer type="int">11</month_integer>
<day_integer type="int">24</day_integer>
<year_integer type="int">2013</year_integer>
<every_fourth_year_integer type="int">2012</every_fourth_year_integer>
<execution_count_integer type="int">0</execution_count_integer>
<every_fourth_year_string_list type="simplestringlist">2012</every_fourth_year_string_list>
<months_of_the_year_string_list type="simplestringlist">january;february;march;april;may;june;july;august;september;october;november;december</months_of_the_year_string_list>
<month_conversion_string_dictionary type="simplestringdictionary">january=1;1=january;february=2;2=february;march=3;3=march;april=4;4=april;may=5;5=may;june=6;6=june;july=7;7=july;august=8;8=august;september=9;9=september;october=10;10=october;november=11;11=november;december=12;12=december</month_conversion_string_dictionary>
<days_of_the_week_string_list type="simplestringlist">sunday;monday;tuesday;wednesday;thursday;friday;saturday</days_of_the_week_string_list>
<day_conversion_string_dictionary type="simplestringdictionary">sunday=1;1=sunday;monday=2;2=monday;tuesday=3;3=tuesday;wednesday=4;4=wednesday;thursday=5;5=thursday;friday=6;6=friday;sunday=7;7=sunday</day_conversion_string_dictionary>
<31_days_in_a_month_string_list type="siimplestringlist">1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30;31</31_days_in_a_month_string_list>
<30_days_in_a_month_string_list type="siimplestringlist">1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30</30_days_in_a_month_string_list>
<29_days_in_a_month_string_list type="siimplestringlist">1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29</29_days_in_a_month_string_list>
<28_days_in_a_month_string_list type="siimplestringlist">1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28</28_days_in_a_month_string_list>
</object>
<function name="character_creation_function"><![CDATA[
firsttime {
msg ("What is your name?")
get input {
player.alias = result
msg ("What is your age?")
get input {
player.age_integer = ToInt (result)
if (player.age_integer < 0) {
player.age_integer = 0
}
if (player.age_integer >= 0 and player.age_integer < 4) {
player.age_string = "baby"
} else if (player.age_integer >= 4 and player.age_integer < 13) {
player.age_string = "child"
} else if (player.age_integer >= 13 and player.age_integer < 20) {
player.age_string = "teen"
} else if (player.age_integer >= 20) {
player.age_string = "adult"
}
msg ("What is your date of birth?")
show menu ("Month of birth?", global_data_object.months_of_the_year_string_list, false) {
player.month_of_birth_string = result
player.month_of_birth_integer = ToInt (StringDictionaryItem (global_data_object.month_conversion_string_dictionary, player.month_of_birth_string))
if (player.month_of_birth_string = "january" or player.month_of_birth_string = "march" or player.month_of_birth_string = "may" or player.month_of_birth_string = "july" or player.month_of_birth_string = "august" or player.month_of_birth_string = "october" or player.month_of_birth_string = "december") {
show menu ("Day of birth?", global_data_object.31_days_in_a_month_string_list, false) {
player.day_of_birth_integer = ToInt (result)
}
} else if (player.month_of_birth_string = "april" or player.month_of_birth_string = "june" or player.month_of_birth_string = "september" or player.month_of_birth_string = "november") {
show menu ("Day of birth?", global_data_object.30_days_in_a_month_string_list, false) {
player.day_of_birth_integer = ToInt (result)
}
} else if (player.month_of_birth_string = "february") {
foreach (item_x, global_data_object.every_fourth_year_string_list) {
item_x_integer = ToInt (item_x)
if (global_data_object.year_integer = item_x_integer) {
show menu ("Day of birth?", global_data_object.29_days_in_a_month_string_list, false) {
player.day_of_birth_integer = ToInt (result)
}
} else if (global_data_object.year_integer <> item_x_integer) {
show menu ("Day of birth?", global_data_object.28_days_in_a_month_string_list, false) {
player.day_of_birth_integer = ToInt (result)
}
}
}
}
on ready {
msg ("Year of birth?")
get input {
player.year_of_birth_integer = result
if (player.year_of_birth_integer >= 2000) {
player.shortened_year_of_birth_integer = player.year_of_birth_integer - 2000
} else if (player.year_of_birth_integer < 2000) {
player.shortened_year_of_birth_integer = player.year_of_birth_integer - 1900
}
}
}
}
}
}
} otherwise {
}
]]></function>
<function name="every_fourth_year_function"><![CDATA[
if (global_data_object.execution_count_integer < 26) {
global_data_object.every_fourth_year_integer = global_data_object.every_fourth_year_integer + 4
list add (global_data_object.every_fourth_year_string_list, global_data_object.every_fourth_year_integer)
global_data_object.execution_count_integer = global_data_object.execution_count_integer + 1
every_fourth_year_function
}
]]></function>
<type name="character_object_type">
<age_integer type="int">0</age_integer>
<age_string type="string"></age_string>
<month_of_birth_string type="string"></month_of_birth_string>
<month_of_birth_integer type="int">0</month_of_birth_integer>
<year_of_birth_integer type="int">0</year_of_birth_integer>
<shortened_year_of_birth_integer type="int">0</shortened_year_of_birth_integer>
<day_of_birth_integer type="int">0</day_of_birth_integer>
<date_of_birth_integer type="string"></date_of_birth_integer>
<date_of_birth_string type="string"></date_of_birth_string>
</type>
</asl>http://uk.answers.yahoo.com/question/index?qid=20080710034216AA8yyPP
MJ user:
There are 365.25 days in a year.
365 in a non leap year and 366 in a leap every (every fourth year there is a 29th day in February)
We say 52 weeks because it's convenient even though it does only account for 364 days. Missing 1 day in a normal year and 2 days in a leap year. If you count up the days in all the months of a non leap year you will see there are 365
Jan 31
Feb 28
Mar 31
Apr 30
May 31
Jun 30
Jul 31
Aug 31
Sep 30
Oct 31
Nov 30
Dec 31
Equals 365
} else if (player.month_of_birth_string = "february") {
foreach (item_x, global_data_object.every_fourth_year_string_list) {
item_x_integer = ToInt (item_x)
if (global_data_object.year_integer = item_x_integer) {
show menu ("Day of birth?", global_data_object.29_days_in_a_month_string_list, false) {
player.day_of_birth_integer = ToInt (result)
}
function getDate() {
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
var date_today = "" + yyyy + ";" + mm + ";" + dd
ASLEvent("AskDOB", date_today);
}<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="getdate">
<gameid>d914cd9d-e46b-49da-88c5-bc637a4a4bca</gameid>
<version>1.1</version>
<firstpublished>2013</firstpublished>
<months_of_the_year_string_list type="stringlist">
<value>january</value>
<value>february</value>
<value>march</value>
<value>april</value>
<value>may</value>
<value>june</value>
<value>july</value>
<value>august</value>
<value>september</value>
<value>october</value>
<value>november</value>
<value>december</value>
</months_of_the_year_string_list>
<start type="script">
request (RunScript, "getDate")
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<function name="AskDOB" parameters="date_today"><![CDATA[
date_list = Split (date_today, ";")
year = ToInt (StringListItem (date_list, 0))
month = ToInt (StringListItem (date_list, 1))
day = ToInt (StringListItem (date_list, 2))
msg ("It is " + year)
msg ("What year were you born?")
get input {
player.year_of_birth = ToInt (result)
msg ("You are " + (year - player.year_of_birth) + " years old (or will be soon).")
show menu ("Month of birth?", game.months_of_the_year_string_list, false) {
player.month_of_birth = ListIndexOf (game.months_of_the_year_string_list, result) + 1
msg ("What was the day of the month you born?")
get input {
player.day_of_birth = ToInt (result)
msg ("Your DOB is " + player.day_of_birth + "/" + player.month_of_birth + "/" + player.year_of_birth + ".")
if (player.month_of_birth = month) {
msg ("Your birthday is this month!")
if (player.day_of_birth = day) {
msg ("It is your birthday today!")
}
else if (player.day_of_birth > day) {
msg ("It is your birthday very soon!")
}
else {
msg ("You've just had your birthday!")
}
}
else if (player.month_of_birth > month) {
msg ("You have already had your birthday.")
}
else {
msg ("You have not had your birthday yet.")
}
}
}
}
]]></function>
<function name="ListIndexOf" parameters="list, thing" type="int">
res = -1
for (i, 0, ListCount (list) - 1) {
if (ListItem(list, i) = thing) {
res = i
}
}
return (res)
</function>
<javascript src="functions.js" />
</asl>