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
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
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
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
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
Were there problems with this function so that you disabled them?
Thomas
On Sat, Jan 22, 2011 at 10:18 AM, Thomas Schwarz
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
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
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
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
Glad that worked for you. I'm starting to think you know more about
JACL than I do now. ;)
Stuart