Feedback for a newbie?

Hello, I just started working with TADS 3 yesterday, went through a tutorial, and decided to try making a calendar/clock system from scratch. There’s a lot I don’t know, but I’m at a point where I figured I’m better off asking for feedback/advice than continuing.

My main goal is to create a time/date system where actions impact the amount of time that passes. I also wanted to change the number of months in a year to four and have each month be a season (a la “Harvest Moon”), and incorporate days of the week.


[spoiler][code]#charset “us-ascii”
#include <adv3.h>
#include <en_us.h>

versionInfo: GameID
IFID = ‘0fc25b87-15c3-4379-9a6c-593adc1cee1b’
name = ‘Test2’
byline = ‘by Pharien’
htmlByline = ‘by

version = ‘1’
authorEmail = ‘Pharien
desc = ‘Put a brief “blurb” about your game here’
htmlDesc = ‘Put a brief “blurb” about your game here’

gameMain: GameMainDef
initialPlayerChar = me

startRoom: Room ‘Start Room’
"This is the starting room. "

  • me: Actor

+nightstand: Fixed, Surface ‘nightstand’ ‘nightstand’
"Your old nightstand sits in the corner. "

++watch: Wearable, Thing ‘watch’ ‘watch’
"It is <<datetime.timeHour>>:<<datetime.timeMinuteTen>><<datetime.timeMinuteZero>>
<<datetime.amPm>>. "

+calendar: Thing ‘calendar’ ‘calendar’
"Today’s date is <<datetime.season>> <<>> of Year
<<datetime.year>>. It is a <>. "

datetime: Thing ‘datetime’
year = 1
month = 1
season = [spring, summer, fall, winter]
dayOfWeek = 1
weekday = [sunday, monday, tuesday, wednesday, thursday, friday, saturday]
day = 1
timeHour = 6
timeMinuteTen = 0
timeMinuteZero = 0
amPm = “<<morning ? ‘AM’ : ‘PM’>>”
morning = true

modify VerbRule(Wait)
‘wait’ singleIobj
"You wait for a minute. ";
datetime.timeMinuteZero += 1;
if (datetime.timeMinuteZero == 10)
datetime.timeMinuteTen += 1;
datetime.timeMinuteZero = 0;
if (datetime.timeMinuteTen == 6)
datetime.timeHour += 1;
datetime.timeMinuteTen = 0;
if (datetime.timeHour >= 24)
{ +=1;
datetime.dayOfWeek +=1;
datetime.timeHour = 0;
if (datetime.timeHour >= 12)
datetime.morning = nil;
if (datetime.dayOfWeek >= 7)
datetime.dayOfWeek = 1;

modify VerbRule(Sleep)
‘sleep’ singleIobj
mainReport('You sleep until morning. ');
datetime.timeHour = 6;
datetime.timeMinuteTen = 0;
datetime.timeminuteZero = 0; += 1;

So, the cool part is, the time works as a part of the wait action. When timeMinuteZero reaches 10 it resets and timeMinuteTen bumps up one unit, the clock resets at 2400 hours, etc. (Yay for me!) The trouble is it only works as a part of the wait action (duh, that’s where it is). So that if I have another action that takes up time, I’d have to copy a few of the lines of code into it in order for it to work. And I’m not even sure that’d work, because sleep doesn’t affect time at all the way I have it set up. I don’t know why.

Can I move these rules into a different section and call on them as a whole for actions to pass time?

The calendar situation itself is just a mess that I haven’t approached because I don’t know how. My idea was to call a list for days of the week (and for season) and ascribe a position to each item in that list (1, 2, 3…), so that when datetime.dayOfWeek = 1, datetime.weekday = sunday. But I have no idea how to do that, and for all I know I’m completely misunderstanding how lists work and this is impossible the way I’m approaching it.

Am I over-complicating things?

Untested, but looking at the Library Reference Manual, it appears to me that the Action class contains a beforeAction() method, which by default does nothing. If you modify Action by putting your calendar-managing code in that method, then you have only one additional wrinkle, which I’m not going to try to sort out at the moment, as my T3 is extremely rusty: You’ll probably want beforeAction() to test what the specific action is, in order to differentiate SLEEP from WAIT, for example.