You must specify whether you mean A street light or A street light.

6 views
Skip to first unread message

jaxom

unread,
Dec 7, 2010, 2:02:13 PM12/7/10
to jacl-discuss
Hi!

A little question out of my construction site:

I have two street light objects defined as follows:

------
...
location main_street: main street
...
object street_light_1: street light lamp on a post
short name "A street light"
mass scenery
...
location alley: alley
...
object street_light_2: street light lamp on a post
short name "A street light"
mass scenery
...
------

And in my debug.library I have the following "dump" command:

------
grammar dump >dumpobjects

{+dumpobjects
write "DUMP OBJECTS ******************************************^"
loop dl_currobj
proxy "inspect " dl_currobj{names}
write "******************************************^"
endloop
}
------

This command gives me this error:

"You must specify whether you mean A street light or A street light."

I did some experimenting and the error disappears if I put the objects
definitions this way:

------
object street_light_1: street light lamp on a post 1
...
object street_light_2: street light lamp on a post 2
------

Now my question: Does the object definition after the ":" always has
to contain something like a numbering if using several similar objects
like several "stone"s, "coin"s, "troll"s, ...?

Have a nice time!
Thomas

Stuart Allen

unread,
Dec 7, 2010, 10:16:08 PM12/7/10
to jacl-d...@googlegroups.com
Hi Thomas

When two objects have the exact same names you will get the "Did you
mean?" message when they are both in scope. Commands like 'inspect'
allow objects to *anywhere, so they will always be in scope.

I would try to have names that indicate something meaningful about the
objects, such as where they are, "the lamp in the alley" and "the lamp
in the main street". There are other commands that allow objects to be
anywhere, such as 'ask x about y'.

This would be more natural for the player:
> ask fred about light
Did you mean the light in the alley or the light in the main street?

> ask fred about alley light
"Oh, that hasn't been working for years..."

So the end result is that I would avoid two objects ever having the
exact same names or the exact same short description.

Hope that helps!

Stuart

jaxom

unread,
Jan 20, 2011, 7:45:11 AM1/20/11
to jacl-discuss
Hi Stuart,

just another question in the scope of "identical objects".

Let me intend I would like to use for example torches for having light
in the dark.

I think it should be possible to create a number of identical "torch"
objects - also with same names and descriptions. Because they may be
found anywhere in the world.
Now the player finds "A torch" in some location and takes it. Now he
has "A torch" in his inventory.
The player moves to another location and there he finds another "A
torch" lying on the floor.
Now he has "A torch" in his inventory and "A torch" lying on the floor
in the current location.

How would you handle this? The same problem with several "A rat" or "A
stone" or something like this, you understand? ;-)

Have fun!
Thomas

On Dec 8 2010, 4:16 am, Stuart Allen <stuartallen1...@gmail.com>
wrote:
> Hi Thomas
>
> When two objects have the exact same names you will get the "Did you
> mean?" message when they are both in scope. Commands like 'inspect'
> allow objects to *anywhere, so they will always be in scope.
>
> I would try to have names that indicate something meaningful about the
> objects, such as where they are, "the lamp in the alley" and "the lamp
> in the main street". There are other commands that allow objects to be
> anywhere, such as 'ask x about y'.
>
> This would be more natural for the player:> ask fred about light
>
> Did you mean the light in the alley or the light in the main street?
>
> > ask fred about alley light
>
> "Oh, that hasn't been working for years..."
>
> So the end result is that I would avoid two objects ever having the
> exact same names or the exact same short description.
>
> Hope that helps!
>
> Stuart
>

Stuart Allen

unread,
Jan 20, 2011, 11:10:55 PM1/20/11
to jacl-d...@googlegroups.com
Hi Thomas

I would handle this by making each torch slighly different. An old
torch, an ivory torch, a timber torch etc. Unfortunately JACL doesn't
have any support for identical objects at all so there isn't any great
way to make identical object work other than making sure that they
never appear in the same place at the same time and the game doesn't
support any verbs that allow you to refer to objects that aren't in
the current location (such as 'ask about').

Sorry that doesn't really help you very much!

Stuart

Thomas Schwarz

unread,
Jan 21, 2011, 1:28:41 AM1/21/11
to jacl-d...@googlegroups.com
Hi Stuart,

thank you for the info!

What I think should be implementable is a possibility for commands like
"take first torch" or "take 1.torch"
"take second torch" or "take 2.torch"
as it is done usually in mud systems.

It is than more or less random which one of the torches will be the
first and the second one.

Well, perhaps I will have a look at this sometime.

Regards
Thomas

Stuart Allen

unread,
Jan 22, 2011, 3:28:30 AM1/22/11
to jacl-d...@googlegroups.com
Hi Thomas

Now I think about it, there might be a way to fake this using the
'plural' property. When an object is referred to via one of its plural
names the interpreter doesn't worry that the reference was ambiguous.
For example, if two objects have the names 'red book' and 'blue book'
but both have the plural 'books' then the command 'take books' will
take them both. You could make 'torch' a plural name so they'd both
get picked up it 'get torch' is used, but also given them
distinguishing names so if you really only want one of them you can
type 'take old torch' or something.

Anyway, have a play, that feature might be able to help you,
Stuart

Thomas Schwarz

unread,
Jan 22, 2011, 4:18:57 AM1/22/11
to jacl-d...@googlegroups.com
Hi Stuart,

thank you very much for the hint!
What I in the meanwhile found is the "disambiguate" function. I think
this one also could be what I need. What do you think? I still must
have a closer look to this in the JACL guide...

Have a nice weekend! And keep the music playing ;-)
Thomas

Thomas Schwarz

unread,
Jan 22, 2011, 5:01:09 PM1/22/11
to jacl-d...@googlegroups.com
Oh, what I currently saw in parser.c is that the call to the
disambiguate function is commented out!?

Were there problems with this function so that you disabled them?

Thomas

On Sat, Jan 22, 2011 at 10:18 AM, Thomas Schwarz

Stuart Allen

unread,
Jan 22, 2011, 5:38:15 PM1/22/11
to jacl-d...@googlegroups.com
Hi Thomas

No I don't think there was a problem with it, it just didn't seem to
be very useful functionality in the end and given it gets called
frequently I thought it might be best to turn it off for performance
reasons. Have a go an commenting in your multiplayer version and see
if it is useful for your purposes, it may well be.

Stuart

Thomas Schwarz

unread,
Jan 23, 2011, 2:04:28 PM1/23/11
to jacl-d...@googlegroups.com
Hi Stuart,

just another question concerning disambiguation now:

From JACL Guide:

object red_book : red book

{disambiguate
if arg = 0
ifstring command = "read"
return true
endif
ifstringall command[0] = "look" : command[1] = "in"
return true
endif
endif
return false
}

If I want to test if the player has used the verb "take" or "get" or
another synonym for "take" which has been defined in a grammar
statement, do I have to test for all the synonyms here in the
disambiguate function?
ifstring command[0] = "get" : command[0] = "take" : command[0] = ...
Or is there a possibility to test the "central" verb, also? So that
would be the verb function where the command is being evaluated...

Have a nice weekstart!
Thomas

On Sat, Jan 22, 2011 at 11:38 PM, Stuart Allen

Stuart Allen

unread,
Jan 23, 2011, 5:54:25 PM1/23/11
to jacl-d...@googlegroups.com
Hi Thomas

You are starting to refresh my memory now with your investigations!
Unfortunately, you can't refer to just the one 'action' that all the
possible verbs map to. This is one of the limitations of the
disambiguate functionality that made me less enthusiastic about it.
The trouble is that the disambiguate function gets called for each
object as the command is being processed, and the ultimate action the
command maps to isn't known until the very last word of the command is
processed. Without the ability to see into the future (ie, a massive
rewrite of how commands are processed), it's limited to just
inspecting the actual words that have come so far.

Stuart

Thomas Schwarz

unread,
Jan 24, 2011, 1:34:16 AM1/24/11
to jacl-d...@googlegroups.com
Good morning Stuart,

thanks for the info! As it seems the disambiguate function is exactly
the thing for my needs.
I let this function simply "return true" for something like the
torches etc. so that simply one of the many is being addressed. Fully
sufficient. JACL is great!

Have a nice day!
Thomas

On Sun, Jan 23, 2011 at 11:54 PM, Stuart Allen

Stuart Allen

unread,
Jan 24, 2011, 9:41:30 PM1/24/11
to jacl-d...@googlegroups.com
Hi Thomas

Glad that worked for you. I'm starting to think you know more about
JACL than I do now. ;)

Stuart

Reply all
Reply to author
Forward
0 new messages