Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TADS 3 Travel triggering actions

31 views
Skip to first unread message

Steven Odhner

unread,
May 26, 2011, 3:57:25 PM5/26/11
to
Hello,

I'm still learning and am designing some environments as a sort of
self-teaching excercise.

In one area, I want to make it so that leaving the room through
different exists has different effects. So, for example if you go
North it would check a setting elsewhere and potentially change where
"north" leads and then update that setting.

I tried to include the actions after the direction name in the room,
but I seem to have done it wrong. I know I can do it in a really
stupid way by modifying the underlying behavior that traveling uses
throughout the game, but I'm guessing I'm just using the wrong kind of
brackets or leaving out a word. This feels like something that should
be simple, but I can't quite get it.

Thanks!

Jim Aikin

unread,
May 26, 2011, 6:13:17 PM5/26/11
to
You may want to read up on TravelConnectors (in Learning T3, for
instance). I'm sure there's a way to adapt this class to do what you want.

--JA

Steven Odhner

unread,
May 27, 2011, 12:03:23 AM5/27/11
to
I don't think that's going to work. Essentially I want to be
generating the rooms as I go (which I have all working but currently
triggered by pushing buttons rather than going in a direction) so
adding a connector won't help me. I was hoping to be able to slap the
code in where the room name would normally be but can't get it to
work.

Jim Aikin

unread,
May 27, 2011, 12:39:27 AM5/27/11
to

If you read up on TravelConnectors, you'll find that whenever the player
uses a travel command, a TravelConnector is invoked. Rooms themselves
are TravelConnectors, so a line like

south = livingRoom

invokes a TravelConnector. The getDestination() method of a
TravelConnector returns the destination of travel via that connector. In
a Room object, this method has the code

return self;

(You can learn all this by exploring the Library Reference Manual.) So
you could easily create your own class, derived from TravelConnector,
which would substitute a line like

return myCurrentDestination;

in that method. You could then swap in, at any time, whatever value you
like for myCurrentDestination.

Does that help?

--JA

Steven Odhner

unread,
May 27, 2011, 12:50:06 AM5/27/11
to
Sorry, I was thinking of RoomConnector and picturing yet another
object. Thanks for the tip, I'll look into that and try to get it to
work.

Steven Odhner

unread,
Jun 8, 2011, 2:17:08 PM6/8/11
to
FYI, I got this working. I ended up using roomBeforeAction to
generate the next room and set the current room to point to it just
prior to the movement executing. Worked like a charm. Now I have an
infinite landscape with rooms generating as you walk! Of course, I
have not yet tackled the issue of how to track them in a way that
makes them logically lead into a previously existing room other than
the one you just came out of. (So, for example, you can go N, S no
problem but if you went N, E, S, W you wouldn't be back where you
started.)

We'll see if I can figure it out!

0 new messages