Using debug code - TADS3.1

I’m back, hopefully with an easy question. There is some debug code around named ‘Pow’. Can I use this code in conditions other than debugging. In other words, can I modify it to remain in my code in other than the debug mode? This ability will work nicely for my player when and if he becomes a wizard.

Move the Pow code somewhere else so it will be also built in non-debug builds.

The debug code uses the following code to assign locations to each room. I do not want this POW code to be used only in debug. Here’s the code that seems to kick it off:

#define dbgNoun(x) vocabWords_=x
#define dbgNoun(x)

You then assign the noun code such as dbgNoun('kitchen-room) to each room so that you can jump (POW) to each unique dbgNoun description in each room.

Need some help modifying this so that it will not only work in debug mode. I hope I described this correctly.


Okay, here’s a way to do it. Don’t bother trying to adapt the code from ncDebugActions at all.

First, you need to understand that a room has no vocabWords assigned to it, because the player doesn’t usually need to refer to a room by name. So there’s no provision for vocabWords in the Room template. To each room, you need to add one or more vocabWords by hand, as a property of the room:

vocabWords = 'temple'

Having done that, you can now write your own teleportation action, like this:

DefineTAction(Goto) objInScope(obj) { if (obj.ofKind(Room)) return true; return nil; } ; VerbRule(Goto) 'goto' singleDobj : GotoAction verbPhrase = 'go/going to a room' ; modify Room dobjFor(Goto) { action() { me.moveIntoForTravel(self); me.lookAround(true); } } ;
This isn’t 100% perfect, but it will serve as a first approximation.

I’m looking for a book titled ‘TADS For Dummies’. I would probably pay almost any price for it. Thanks for the information. I’ll give it a shot and let you know what happens. Your approach appears to be much simpler to use than what I had.


When I compiled the code I received the following error:

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

----- begin build: Sun Feb 05 13:02:28 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 “” “adv3\” “The Magic Forest.t” -res “GameInfo.txt”
TADS Compiler 3.1.0 Copyright 1999, 2010 Michael J. Roberts
The Magic Forest.t(24): error:
The symbol “objInScope” is already defined, so you cannot use it as the name of
a function here. This symbol is already being used as the name of an object or
property elsewhere in your program. Change the name to a unique symbol.

Errors: 1
Warnings: 0

t3make: error code 1

Build failed.
----- end build: Sun Feb 05 13:02:36 2012 -----

The last error was not an error but just an extra format character. However, I did get an error when I tried to place vocabWords=‘temple’ into a room. Is there a special place in the room code or a special way that this must be entered?


Offhand I would guess that you wrote “vocabWords = ‘temple’;” and the semicolon at the end is ending your object definition prematurely.

But without seeing your source text for the temple room, it’s just a shot in the dark.

I figured it out. I used the following: vocabWords=’(Beach) temple’
If I use ‘goto temple’ it works fine. However, if I use ‘goto Beach’ I get a message saying ‘there is no beach here’. This must be because I’m already at the beach. Is there a modification you can make that tells me I am already at the location I’m trying to goto?

If you put a noun or adjective in parentheses, the parser won’t match it by itself. Remove the parentheses.