Telling the time - TADS3.1

I have attached some code that was posted to me earlier. I’m having compile problems with it. This brings up some questions. Can you tell me where in my program I should place this? Is it causing problems because I still haven’t included my time-telling watch into the program? I’ve checked this code with the original that was posted to me and can’t see any copy mistakes

DefineIAction(LookAtTime)
     execAction()
     {
      "The time is <<clockManager.checkTimeFmt('hh:mma')>>\n";
     } 
     // This action should consume no time.
     actionTime = 0;
; 
     VerbRule(LookAtTime}
       'time'
       | 'read'(|'the')'time'
       | 'look''at'(|'the')'time'
       | 'l''time'
        :LookAtTimeAction
        verbPhrase = 'look/looking at the time';

Thanks for any help you can provide.

RonG

You have a stray semicolon after the actionTime property in your DefineIAction(LookAtTime) block.

(This trips me up all the time, especially for properties that I add just after writing the method that uses them.)

The code can go anywhere but you will need the clockManager object defined somewhere before it will compile.

Thanks much for the help. I think it’s time to get the new reading glasses that I need!

RonG

Still having trouble with this:


+watch: AlwaysWorn 'wrist wristwatch/watch' 'wristwatch'
 "It is an expensive, rugged and accurate digital watch that you have had for
  years. It currently reads <<clockManager.checkTimeFmt('[am][pm]h:mm a')>>. "
 dobjFor(Open) { verify() { illogical( 'Only a jeweler could open that
  watch ');}}    “Error is on this line”  <-                              
 dobjFor(LookIn) asDobjFor(Open)
 cannotDoffMsg = "Don't do that! It's crucial that you have your watch at this
                 time."
;   

Tip: you can go to the source location of a compile error
by double-clicking on the error message in this window

----- begin build: Sat Jan 14 11:53:59 2012 -----
>t3make -Fy "C:\Documents and Settings\Frenchy\Desktop\The Magic Forest\obj" -Fo "C:\Documents and Settings\Frenchy\Desktop\The Magic Forest\obj" -o "debug\The Magic Forest.t3" -a -D "LANGUAGE=en_us" -D "MESSAGESTYLE=neu" -v -d -statprefix <@> -statpct "system.tl" "adv3\adv3.tl" "The Magic Forest.t" -res "GameInfo.txt"
TADS Compiler 3.1.0  Copyright 1999, 2010 Michael J. Roberts
The Magic Forest.t(567): error: 
Missing right parenthesis ')' in argument list in invocation of macro
"VerbRule".


Errors:   1
Warnings: 0

t3make: error code 1

Build failed.
----- end build: Sat Jan 14 11:54:02 2012 -----

If I disable each section of the two sections of code, then everything seems better. Now that I have the watch section enabled, I got a compile error in the watch section at the line I have marked.
If I disable the very first code post then the watch code works great. Go figure!

In your code from the first post, you have “VerbRule(LookAtTime}” - the right character is a curly brace instead of a paren.

I just figured that out also. Go figure! Now I will certainly get new glasses. Now I’m ready to move on to my player and my rooms.

This is far and away the worst design decision in C-derived languages. Distinguishing between those characters visually is really difficult.

A related gripe (and again, there’s no help for it!) is that most of the useful keys are positioned under the little finger of the right hand on a QWERTY keyboard. I don’t know where they are on Dvorak, but I have no intention of learning Dvorak, so it doesn’t matter. I’m constantly groping with that finger and hitting a semicolon when I want a single-quote, a backslash when I want a right-bracket, an equals sign when I want a hyphen – aargh!