classes for verbs?

13 views
Skip to first unread message

Jan Thorsby

unread,
Feb 16, 2007, 10:50:38 AM2/16/07
to
Are there any programming languages that have classes for verbs, and if not
do you think it would be a good idea?

Like you could make a class "longerange" for verbs that you can do to an
object even if you are not close to the object such as "look at" and "shoot".
And then you can write a code that forbids you interact with objects outside
a chair when you are sitting in the chair, unless you use verbs of the
longerange class.

Or you could have a class "rude" for verbs that it would be rude to do to a
person, like push and pull. And then when you code a person you could write
that if anybody tries a rude command they are told "NO! That would be rude!"


Khelwood

unread,
Feb 16, 2007, 11:13:59 AM2/16/07
to

TADS has a class hierarchy for actions, though it does not use it in
quite this way. TADS 3 preconditions do this sort of thing though.

In I7 you can achieve effects like this using something like:
Pushing someone is being rude. Pulling someone is being rude.
Instead of being rude: say "That would be rude.".

Nikos Chantziaras

unread,
Feb 16, 2007, 12:45:31 PM2/16/07
to
Jan Thorsby wrote:
> Are there any programming languages that have classes for verbs, and if not
> do you think it would be a good idea?

Classes yes (Tads, not sure about the others), but from an object
oriented point of view and not how you describe it below.


> Like you could make a class "longerange" for verbs that you can do to an
> object even if you are not close to the object such as "look at" and "shoot".
> And then you can write a code that forbids you interact with objects outside
> a chair when you are sitting in the chair, unless you use verbs of the
> longerange class.

I don't see any benefit over the current system as used in Tads 3, which
utilizes so-called "sense paths"; if a sense can reach a specific
object, then all verbs that depend on that sense (EXAMINE depends on the
'sight' sense, for example, TAKE on 'touch', etc.) can successfully
apply to the object in question.

Furthermore, your suggestion has a drawback when compared to sense
pathing; LOOK and LISTEN are both "longerange", right? Well, imagine a
target that resides inside a container made of glass, and the glass is
shielded in a way that no sound can make it through. LISTEN will list
no sounds at all with the current Tads 3 model if we block the 'sound'
sense, but LOOK will list the contents since we don't block the sight sense.

I believe the current model in Tads 3 is the most simple solution to
these problems. Well, not "simple" from an algorithmic point of view
since there are some rather expensive calculations involved, but rather
"simple" from the user's (programmer's) point of view; the calculations
are done by the library.


> Or you could have a class "rude" for verbs that it would be rude to do to a
> person, like push and pull. And then when you code a person you could write
> that if anybody tries a rude command they are told "NO! That would be rude!"

I think what you're searching for is a way to group a number of verbs
and put some kind of label on them while being able to check for that
label in a "generic" action/verb handler. A nice idea, actually. Even
if it won't help much with your first example where senses are involved,
since the current system is better, but might help in other areas. It
is actually possible to declare a new class for verbs, but it's not a
very straightforward task.

I can imagine a game with RPG-like combat. If we have a class of verbs
called "DamageAction", then whenever the PC does damage to an NPC, you
only have to provide a handler for the DamageAction verb where you
calculate the damage taken. Add HealAction and ManaAction to that.

How exactly this has to be done in Tads 3... Dunno. Must try it myself
first :)

Emily Short

unread,
Feb 16, 2007, 8:42:00 PM2/16/07
to
On Feb 16, 9:45 am, Nikos Chantziaras <rea...@arcor.de> wrote:

> Jan Thorsby wrote:
> > Or you could have a class "rude" for verbs that it would be rude to do to a
> > person, like push and pull. And then when you code a person you could write
> > that if anybody tries a rude command they are told "NO! That would be rude!"
>
> I think what you're searching for is a way to group a number of verbs
> and put some kind of label on them while being able to check for that
> label in a "generic" action/verb handler. A nice idea, actually.

I agree, though I suspect it may turn out that a class-based approach
is not a complete solution to this particular issue either. It's
definitely useful to be able to classify player actions in terms of
the kind of social gesture involved, in order to generate appropriate
NPC responses, but often you need more information than just which
verb it is; >KILL SPIDER and >KILL PUPPY might mean quite different
things to a watching little girl. For that matter, social gestures
take on different nuances depending on the particular context in which
they occur.

This is something that the Michael Mateas and Andrew Stern had to work
with quite a bit for Façade (http://www.interactivestory.net) --
clustering player input into types of social action, and then setting
up circumstance-appropriate reactions. I'm not convinced their
solution was completely successful (for that matter, I don't think
they're convinced either), but I think they made an interesting stab
at the problem.

I know I keep mentioning this book, in manner of a kid with a new
crush, but _Second Person_ has a terrific article by Mateas and Stern:
they talk about how they approached the problem of labeling types of
player action, which categories they came up with, and what they did
to keep the combinatorics from getting overwhelming. I'd recommend it
to anyone who is thinking about working in this area. They certainly
took the experiment further than any text-based IF I know of.

Andrew Plotkin

unread,
Feb 17, 2007, 11:59:54 PM2/17/07
to
Here, Nikos Chantziaras <rea...@arcor.de> wrote:
> Jan Thorsby wrote:
>
> > Or you could have a class "rude" for verbs that it would be rude to do to a
> > person, like push and pull. And then when you code a person you could write
> > that if anybody tries a rude command they are told "NO! That would be rude!"
>
> I think what you're searching for is a way to group a number of verbs
> and put some kind of label on them while being able to check for that
> label in a "generic" action/verb handler. A nice idea, actually.

I will note, belatedly, that you've neatly recapitalated the invention
of my rule-based IF idea. You've got a "generic" handler that applies
to all actions when a particular condition (verb in verb-class-X) is
true. Extend this pattern to handle the entire verb library (here's
the handler when the verb is take...) and you've got my idea in its
entirety.

--Z

--
"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."
*
If the Bush administration hasn't thrown you in military prison without trial,
it's for one reason: they don't feel like it. Not because you're an American.

Richard Bos

unread,
Feb 25, 2007, 6:58:07 PM2/25/07
to
Andrew Plotkin <erky...@eblong.com> wrote:

> Here, Nikos Chantziaras <rea...@arcor.de> wrote:
> > Jan Thorsby wrote:
> >
> > > Or you could have a class "rude" for verbs that it would be rude to do to a
> > > person, like push and pull. And then when you code a person you could write
> > > that if anybody tries a rude command they are told "NO! That would be rude!"
> >
> > I think what you're searching for is a way to group a number of verbs
> > and put some kind of label on them while being able to check for that
> > label in a "generic" action/verb handler. A nice idea, actually.
>
> I will note, belatedly, that you've neatly recapitalated the invention
> of my rule-based IF idea. You've got a "generic" handler that applies
> to all actions when a particular condition (verb in verb-class-X) is
> true. Extend this pattern to handle the entire verb library (here's
> the handler when the verb is take...) and you've got my idea in its
> entirety.

Isn't this not very dissimilar to how PAWS handled it? That was a rather
more primitive system than those of today, of course, but the basic idea
of a table of actions, triggered on the use of a verb, noun, or
combination (as well as at fixed points for any input) was there.

Richard

Andrew Plotkin

unread,
Feb 25, 2007, 8:20:27 PM2/25/07
to

I haven't looked at PAWS, but as a general idea that's it. Of course
you can describe I6 (and probably TADS) using the same model: I6 makes
you put bits of code in different properties (room.before,
react_before, etc) depending on what triggers you want.

The hard part is not implementing that -- it's a big table if "if"
statements, in any language. The hard part is allowing the author to
set up and manage the table without going nuts. In the original
example, you're adding an entry whose "if" is a group of verbs. But
where do you add that? Do you have to look down the entire table? What
if you want the new entry to be "early" in some cases but "late" in
others?

--Z

--
"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the borogoves..."
*
If the Bush administration hasn't thrown you in military prison
without trial, it's for one reason: they don't feel like it. Not

because of the Fifth Amendment.

Reply all
Reply to author
Forward
0 new messages