Using objects with similar names

Hi there,

This may be a very stupid question, but I can't seem to see any way around it. I am using the online tool. I have no experience of programming.

I have is a bookcase. When you examine the bookcase you see an interesting looking book. This is what happens:

examine bookcase
Most of the books are missing or damaged but one catches your eye. It is a red book that sticks out further than any other book on the shelf.

examine book
Please choose which 'book' you mean:
1: bookcase
2: red book

I want it to just examine the book not give me a choice of everything with the word book in it. Is there a way to do this?

Another example of this problem would be when I have objects in a room with similar names to group them together and find them easily in the object list.. For example:

Shed
Shed key
Shed door

If I say open shed it will present me with a choice to open all of these, including the shed key, which I would obviously not want to open. Is there anyway to exclude this object from the command? In this example I could of course give them different names, but it is useful to have similar names so that items in the same room are grouped together, and with the book and the bookcase there really isn't another name I could give them.

Thanks a lot in advance.


If I say open shed it will present me with a choice to open all of these

It shouldn't. If the player enters "open she" then it would list all of those, because they all start with the characters entered. But if they type "open shed" it should just pick the shed. If the word the player typed is the full name of an object, it's supposed to use that object rather than presenting a menu.

If this isn't working correctly, could you show a copy of the game so I can try to work out why?

examine book

This is a more common complaint. In this case, my suggest would be to use the alt attribute (shown as "Other names" on the 'Object' tab in the editor), and give it the name book. Then, when the player types "examine book", it finds an object with the exact name "book", and chooses that without presenting a menu.

Is there anyway to exclude this object from the command?

In the example you gave, it should already be excluded.

However, you can make a command only list certain objects in its disambiguation menus by giving it a scope or changecommandscope attribute.
You could edit the "open" command and change its scope to container so that when the player tries to open something, it will only ask them to choose containers. However, this could be a problem with doors, as they aren't usually containers.

In this case, you would want to give the command a script attribute named changecommandscope. I'm not sure if the desktop editor displays an Attributes tab for commands (I know the web editor doesn't), so I'd do this by adding this to the game's start script:

open.changecommandscope => {
  items_to_ignore = NewObjectList()
  foreach (item, items) {
    if (not ListContains (object.displayverbs, "Open") or item.isopen) {
      list add (items_to_ignore, item)
    }
  }
  foreach (item, items_to_ignore) {
    list remove (items, item)
  }
}

This means that when the player types "open she" it will only list matching objects that have 'Open' in their displayverbs and are currently closed. (unless there are none of those objects around, in which case it will consider other objects)


Change your bookshelf to "shelf "or "chiffonier" or google other alternative words for a bookshelf.

Shed on its own is fine, change shed door to something like "wood door" or "pine door" etc. If there is a door and you are outside a shed, there is no need to say it is a shed door.

For shed key, you could have brass key, copper key, tiny key, large key and when players type "look at key" simply have a text telling them ; "The key has the letters "SHED" scraped into it."


Log in to post a reply.

Support

Forums