A time stamp is a kind of thing. A time stamp has a number which
varies called second. A time stamp has a number which varies called
minute. A time stamp has a number which varies called hour. A time
stamp has a number which varies called date. A time stamp has a number
which varies called month. A time stamp has a number which varies
called year. The second of a time stamp is usually 0. The minute of a
time stamp is usually 0. The hour of a time stamp is usually 0. The
date of a time stamp is usually 0. The month of a time stamp is
usually 0. The year of a time stamp is usually 0.
Time1 calculator is a time stamp that varies. [This is used to do the
math below.]
Time2 calculator is a number that varies. [This is used to do the math
below.]
Table 1.1 - Months
days in month month name
31 "January"
28 "February"
31 "March"
30 "April"
31 "May"
30 "June"
31 "July"
31 "August"
30 "September"
31 "October"
30 "November"
31 "December"
To decide what number is the TimeCalcToValue (Input - A time stamp):
Let Years in Days be a number;
Change the Years in Days to 0;
Let the count be a number;
Change the count to the year of the Input;
While the count is less than 2000
begin;
Change the Years in Days to the Years in Days minus 365;
If the remainder after dividing the count by 4 is 0, Change the
Years in Days to the Years in Days minus 1;
Change the count to the count plus 1;
end while;
While the count is greater than 2000
begin;
Change the Years in Days to the Years in Days plus 365;
Change the count to the count minus 1;
If the remainder after dividing the count by 4 is 0, Change the
Years in Days to the Years in Days plus 1;
end while;
Let Months in Days be a number;
Change the Months in Days to 0;
Change the count to the month of the Input;
While the count is greater than 0
begin;
Change the Months in Days to the Months in Days plus the days in
month in row count of the table of Months;
If the remainder after dividing the year of the Input by 4 is 0 and
the count is 1, Change the Months in Days to the Months in Days plus
1;
Change count to count minus 1;
end while;
Change the time2 calculator to the second of the Input plus the
minute of the Input multiplied by 60 plus the hour of the Input
multiplied by 3600 plus the date multiplied by 86400 plus the Months
in Days multiplied by 86400 plus the Years in Days multiplied by
86400;
Decide on the time2 calculator.
The Clock is a time stamp. The second of the clock is 3. The minute of
the clock is 39. The hour of the clock is 5. The date of the clock is
28. The month of the clock is 3. The year of the clock is 2009.
The Clock Value is a number that varies.
When play begins:
Change the Clock Value to the TimeCalcToValue(The Clock).
Test Room is a room.
The fault I am getting is...
P32 - Attempt to use a property of nothing
Most problems are detected when Inform translates the source text, but
this is one of the exceptions, a "run-time problem" which emerges only
during play.
The special value nothing is used to mean no object at all, and
sometimes appears where an object might be expected if it was
impossible to find a genuine object, or no genuine object was
specified.
Nothing is not an object in its own right, and so it makes no sense to
look at its properties.
I kind of understand the error, but I just don't see how it applies in
this circumstance.
A time stamp is a kind of thing. A time stamp has a number which
varies called second. A time stamp has a number which varies called
minute. A time stamp has a number which varies called hour. A time
stamp has a number which varies called date. A time stamp has a number
which varies called month. A time stamp has a number which varies
called year. The second of a time stamp is usually 0. The minute of a
time stamp is usually 0. The hour of a time stamp is usually 0. The
date of a time stamp is usually 0. The month of a time stamp is
usually 0. The year of a time stamp is usually 0.
Time1 calculator is a time stamp that varies. [This is used to do the
math below.]
Time2 calculator is a number that varies. [This is used to do the math
below.]
Table 1.0 - Days
day name
"Saturday"
"Sunday"
"Monday"
"Tuesday"
"Wednesday"
"Thursday"
"Friday"
Table 1.1 - Months
days in month month name
31 "January"
28 "February"
31 "March"
30 "April"
31 "May"
30 "June"
31 "July"
31 "August"
30 "September"
31 "October"
30 "November"
31 "December"
To decide what number is the TimeCalcToValue (Input - A time stamp):
Let Years iD be a number;
Change the Years iD to 0;
Let the count be a number;
Change the count to the year of the Input;
if count is less than 2008
begin;
While the count is less than 2008
begin;
Change the Years iD to the Years iD minus 365;
Change the count to the count plus 1;
If the remainder after dividing the count by 4 is 0, Change the
Years iD to the Years iD minus 1;
end while;
end if;
if count is greater than 2008
begin;
While the count is greater than 2008
begin;
Change the Years iD to the Years iD plus 365;
If the remainder after dividing the count by 4 is 0, Change the
Years iD to the Years iD plus 1;
Change the count to the count minus 1;
end while;
end if;
Let Months iD be a number;
Change the Months iD to 0;
Change the count to the month of the Input minus 1;
if count is greater than 0
begin;
While the count is greater than 0
begin;
Change the Months iD to the Months iD plus the days in month in row
count of the table of Months;
If the remainder after dividing the year of the Input by 4 is 0 and
the count is 2, Change the Months iD to the Months iD plus 1;
Change count to count minus 1;
end while;
end if;
Decide on the second of the Input plus the minute of the Input
multiplied by 60 plus the hour of the Input multiplied by 3600 plus
the date of the Input multiplied by 86400 plus the Months iD
multiplied by 86400 plus the Years iD multiplied by 86400.
The Clock is a time stamp. The second of the clock is 3. The minute of
the clock is 39. The hour of the clock is 5. The date of the clock is
28. The month of the clock is 3. The year of the clock is 2009.
The Clock Value is a number that varies.
When play begins:
Change the Clock Value to the TimeCalcToValue(The Clock);
Say "[The Clock Value].";
Test Room is a room.
But I have a new problem now, it throws bogus values :((
I thought with Glux enabled my numbers could sail up to 8 or 9 digits
in length with relative accuracy...
I've double checked my math - its all good, whats happening with this??
Time1 calculator is a timecalc that varies. [This is used to do the
To decide what number is the TimeCalcToDayValue (Input - A timecalc):
Let M be a number;
Change M to the minute of the Input multiplied by 60;
Let H be a number;
Change H to the hour of the Input multiplied by 3600;
Let D be a number;
Change D to the date of the Input plus the Months iD plus the Years
iD multiplied by 86400;
Decide on the second of the Input plus M plus H plus D.
The Clock is a timecalc. The second of the clock is 3. The minute of
the clock is 39. The hour of the clock is 5. The date of the clock is
28. The month of the clock is 3. The year of the clock is 2009.
The Clock Value is a number that varies.
When play begins:
Change the Clock Value to the TimeCalcToDayValue (The Clock);
Say "[The Clock Value].";
Test Room is a room.
K - well never mind - I managed to get this solved, hope you have not
read all this in vain, sorry for any inconvenience....