Getting Run Time Error on subtime.t on TADS13

I am looking for someone who has used ‘subtime.t’ on TADS13. I included it in my code as “subtime.t” It compiles with no error. But, when I test the compile, I get the following error at the code location: vec[1], eventReached();

The runtime error I get is: index out of range.

This is probably because I haven’t yet learned how and where to attach the first time vector.

I plan to have my player wear a watch which he will use to tell the time but I’m not sure how to do that yet.

The watch will be wearable and he will not be able to take it off.

Sure could use some help on this :unamused:

RonG

TADS13? Probably you should check out the source code of MJR’s game “Return to Ditch Day” which employs subtime.t: http://www.tads.org/games/ditch3/index.htm

Sorry. I meant TADS3, not TADS13.

RonG :blush:

When you say you included it, do you mean like this?

#include "extensions/subtime.t"

Because that is incorrect; you have to add it as another source file in your Makefile.t3m.

-lib system
-lib adv3/adv3
-source extensions/subtime
-source foo

I inclduded the following:

#include “subtime.t”

OK, that’s the problem. Put it in your Makefile as an additional source file and it should compile without a runtime error.

Files that can be #included, always use *.h as file suffix, not *.t.

Boy, am I confused?

The Ditch Day source does not include a subtime.h file.

Where do the lines of code in the previous post belong?

The subtime code states that a t least one clockevent must be used at the start of game and shows ClockEvent eventTime=[1,10,35];

Where and how does all this fit?

RonG

There is no subtime.h file. Most extensions don’t have headers.

It sounds like you are building your project with Workbench rather than with an external editor. Workbench builds a Makefile for you based on the files you add to your project.

In that case, you can right-click “Source Files”, choose “Add file”, and navigate to subtime.t.

It is probably in C:\Program Files\TADS 3\lib\extensions. (On a 64-bit system, it will be in C:\Program Files (x86)\TADS 3\lib\extensions.)

subtime.t is shown in the following location:

C:/program files/tads3/extensions

When I open my game source with workbench it indeed does show subtime.t as one of the source files. The runtime error I get is in the ‘subtime’ section when I test run my game with workbench. All that looks about correct to me.

I’m going to add a Clock Event to the beginning of my game and see what happens. It will be right after my include statements.

Will send the results.

RonG

I’m making a blind guess here, but Workbench DOES care what order the included files are listed in. You might try dragging subtime.t down lower or up higher in your list of files.

–JA

I included subtime.t and also placed the following line directly beneath the include section of my code:

ClockEvent eventTime=[1,10,35];

Now the game compiles and runs in test mode with no run time errors.

The next problem is how to make use of the ClockEvent. Perhaps I need a clock or watch to check? Any more ideas?

RonG

That’s the plot event describing the time at the start of the game. Now whenever player reaches some goal with fixed known time, declare new event and call eventReached() of that particular event.

adminLobby: Room 'Lobby' 'the lobby'
    "On past visits to the administration center, this large, open lobby
    was quite austere and utilitarian, but it's been transformed... "
    /*
     *   reaching this room is a time-based plot point, so set a marker
     *   here
     */
    afterTravel(traveler, conn)
    {
        inherited(traveler, conn);
        plotMarker.eventReached();
    }
    
    /* arrive here at about noon */
    plotMarker: ClockEvent { eventTime = [1, 12, 8] }
;

And wristwatch should be easy to implement:

+ AlwaysWorn 'wrist wristwatch/watch' 'wristwatch'
    "It's nothing fancy; just a cheap analog model.  It
    currently reads <<clockManager.checkTimeFmt('[am][pm]h:mm a')>>. "
;

Actually I’m only showing relevant parts of RTDD game, not tested it myself. Ask again if that doesn’t work.

Thanks again for everyone’s help. This forum has been a wealth of information since I started posting to it. Will try this all out at my first opportunity.

RonG