[TADS] goldskull tutorial problem

G

Guest

Guest
Archived from groups: rec.games.int-fiction (More info?)

Hello Everyone,
After playing IF since the early 80's I've decided to try and learn an
authoring system to write my own at last. I decided on TADS.
I've just been following everything given in Chapter one of the TADS
manual and have come across the following problem with the doTake
method for the goldskull(as given in the last part of Chapter 1).
After I've successfully replaced the skull with the rock, I decided to
take the rock from on top the pedestal as well(just greedy I guess!) to
test the system... but nothing happened. Surely the poisonous arrows
should have killed me? So now I have the rock and the skull and an
empty pedestal...but no arrows, so I put the rock back on the
pedestal... and off again...still no arrows. However, as soon as I
tried putting the Skull back on and off... the arrows appear, at last,
and kill me.
There where no typing errors and everything compiled fine. I compiled
the downloaded gold.t example, as well, and the same thing happened
again. Am I missing something?
I know its very trivial(probably) but its really bugging me as I don't
have the experience yet to solve it.
 
Archived from groups: rec.games.int-fiction (More info?)

DeCapa wrote:

> I've just been following everything given in Chapter one of
> the TADS manual and have come across the following problem
> with the doTake method for the goldskull(as given in the
> last part of Chapter 1). After I've successfully replaced
> the skull with the rock, I decided to take the rock from on
> top the pedestal as well(just greedy I guess!) to test the
> system... but nothing happened. Surely the poisonous arrows
> should have killed me? So now I have the rock and the skull
> and an empty pedestal...but no arrows, so I put the rock
> back on the pedestal... and off again...still no arrows.
> However, as soon as I tried putting the Skull back on and
> off... the arrows appear, at last, and kill me. There where
> no typing errors and everything compiled fine. I compiled
> the downloaded gold.t example, as well, and the same thing
> happened again. Am I missing something? I know its very
> trivial(probably) but its really bugging me as I don't have
> the experience yet to solve it.

It turns out it's not completely trivial, but it's a good place
to start acquiring a better understanding of TADS coding. The
behavior you want to happen is very logical given the premise,
and shows the right kind of authorial mindset, in my opinion.
So, you need to start learning how and why things work in TADS
code. Every object inherits the generic behavior of the world
model, and then to do something fancy, you override one of these
behavior methods with your own code.

In this case, the gold skull item in the code has a new moveInto
method that checks to see if the skull is being moved from the
pedestal, launching the arrows if the rock isn't replacing it.
Meanwhile, the pedestal itself is just a surface class item that
has no special behavior. It works like it should, in the most
generic case: you can put things onto it and take them off again
all day long.

It seems to me that a better way to model this set-up and get
the actions you want is for the pedestal itself to have the
booby-trap, both conceptually and in the code. The thing you
might want to use is the verGrab() method. This basically asks
of an object that is holding (or supporting) something else,
"Are you willing to let go of this?"

In this case, the answer would be no. Or rather, the answer
is yes, if there's still something else on the pedestal, and
no if removing this item means there will be nothing else on
the pedestal.

There's a couple of different ways to do this. You could
check for the specific combinations of the smallRock and/or
the goldSkull (ie "if ( goldSkull.location = pedestal &&
smallRock.location <> pedestal )..."), or you could do
something like counting how many items are left on it,
with length( pedestal.contents ). I don't have a compiler
I can test this with right now, so take this as just a
rough suggestion:


| pedestal: surface, fixeditem
| sdesc = "stone pedestal"
| noun = 'pedestal'
| adjective = 'stone'
| location = cave
| verGrab( obj ) = {}
| Grab( obj ) = {
| if ( length(self.contents) = 1 ) {
| "As you lift <<obj.thedesc>>, a volley of
| poisonous arrows bursts out the walls!";
| die();
| }
| }
| ;


You'd still have to modify the goldSkull.moveInto code,
so that it didn't redundantly do its own arrow-shooting
code, and to make sure it still gives you the points when
you first acquire it.

Like I said, there's a lot of different ways to go about
making the pedestal work the way you're hoping it will.
I always figure these things out by reading through adv.t
and really trying to follow the logic of how the library
is set up, because the answers are usually in there if you
hunt for them.

Reading through some of the manuals and tutorials that are
around can also help. And, of course, you can keep asking
the newsgroup folks for help.



--
J. Robinson Wheeler Games: http://raddial.com/if/
JRW Digital Media Movie: http://thekroneexperiment.com
 
Archived from groups: rec.games.int-fiction (More info?)

Thank you for your detailed reply. Its given me a few things to think
about and its great to know that I can get support from this group if
needed. 🙂
 
Archived from groups: rec.games.int-fiction (More info?)

For issues with creating your own game etc, its best to go to:

rec.arts.int-fiction

which deals with the various IF systems such as TADS
Regards
Val

"DeCapa" <DeCapa2005@yahoo.co.uk> wrote in message
news:1106417314.462685.28690@c13g2000cwb.googlegroups.com...
>
>
> Thank you for your detailed reply. Its given me a few things to think
> about and its great to know that I can get support from this group if
> needed. 🙂
>