intfiction.org

The Interactive Fiction Community Forum
It is currently Tue May 21, 2013 7:55 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Thu Feb 02, 2012 6:38 pm 
Offline

Joined: Sun Nov 06, 2011 12:17 pm
Posts: 156
Location: Toledo, Ohio, USA
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.


Top
 Profile Send private message  
 
PostPosted: Thu Feb 02, 2012 6:49 pm 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 687
Move the Pow code somewhere else so it will be also built in non-debug builds.


Top
 Profile Send private message  
 
PostPosted: Sat Feb 04, 2012 1:01 pm 
Offline

Joined: Sun Nov 06, 2011 12:17 pm
Posts: 156
Location: Toledo, Ohio, USA
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:

#idef__debug
#define dbgNoun(x) vocabWords_=x
#else
#define dbgNoun(x)
#endif

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.

RonG


Top
 Profile Send private message  
 
PostPosted: Sat Feb 04, 2012 4:19 pm 
Offline

Joined: Sun Mar 01, 2009 8:02 pm
Posts: 902
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:

Code:
vocabWords = 'temple'

Having done that, you can now write your own teleportation action, like this:
Code:
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.


Top
 Profile Send private message  
 
PostPosted: Sat Feb 04, 2012 4:35 pm 
Offline

Joined: Sun Nov 06, 2011 12:17 pm
Posts: 156
Location: Toledo, Ohio, USA
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.

RonG


Top
 Profile Send private message  
 
PostPosted: Sun Feb 05, 2012 1:15 pm 
Offline

Joined: Sun Nov 06, 2011 12:17 pm
Posts: 156
Location: Toledo, Ohio, USA
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 "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(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 -----


Top
 Profile Send private message  
 
PostPosted: Sun Feb 05, 2012 1:30 pm 
Offline

Joined: Sun Nov 06, 2011 12:17 pm
Posts: 156
Location: Toledo, Ohio, USA
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?

RonG


Top
 Profile Send private message  
 
PostPosted: Sun Feb 05, 2012 1:47 pm 
Offline

Joined: Tue Apr 27, 2010 1:02 pm
Posts: 797
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.


Top
 Profile Send private message  
 
PostPosted: Sun Feb 05, 2012 2:11 pm 
Offline

Joined: Sun Nov 06, 2011 12:17 pm
Posts: 156
Location: Toledo, Ohio, USA
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?


Top
 Profile Send private message  
 
PostPosted: Sun Feb 05, 2012 8:02 pm 
Offline

Joined: Sun Mar 01, 2009 8:02 pm
Posts: 902
RonG wrote:
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.


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group