I would like to have a book in a bookcase, but the game automagicly wants to reverence the bookcase instead of the book when I do this whilst the book is still in the bookcase:
> Examine book
These bookshelves were probably very useful when they were first constructed.
Unfortunately, the weight of years of unfulfilling and relentless service to their masters, the Readers, has taken its toll, it looks as if the shelves could collapse at any moment, not from just the burden of time but from their own weight. Fortunately they now hold a solitary worn book. To the shelve's relief and embarrassment.
or..
> Open book
The bookshelves can't be opened.
I can take the book, and once I do, all is right with the world.
> Examine book
Ah! the 'Joys of Four Color Printing' by I. C. Dotts
I remember this, wasn't it on the best seller list for.. NEVER!?
hmmm
Steve
Set parserPriority on one or the other.
https://github.com/ThePix/QuestJS/wiki/Attributes-for-items#parserpriority
thanks for the point in the right direction.
It didn't seem to matter what I set it to in "book" ( I at one point, set it as high as 200)
It did work when I set it to -40 in "bookshelves"
You can use the PARSER command during play, and it will give you some indication of what is is considering and the scores for both commands and items. I would be interested to know why the book was not getting picked with a high parserPriority.
Interesting! Cool tool.
for book set to 200:
P> Input string: Examine book
P> ---------------------------------------------------------
P> * Looking at candidate: Examine
P> ..Base score: 10
P> Now matching: book
P> ..Looking for a match for: book (scope 1)
P> -> Trying to match: book
P> -> Considering: Columbus
P> -> Considering: Rudy
P> -> Considering: rumpled_trench_coat
P> -> Considering: old_desk
P> -> Considering: curtains
P> -> Considering: detect_o_matic_3000
P> -> Considering: bookshelves
P> the player has used a string that matches the start of the alias, score length + 15
P> bonus 20 as item has attribute examine
P> bookshelves scores 39
P> -> Considering: office
P> ..Going with: bookshelves
P> ...Adding to the score: 0
P> Result score is: 12
P> Candidate accepted!
P> This is the one:Examine
PARSER RESULT:
Input text: undefined
Matched command: Examine
Matched regex: /^(?:examine|exam|ex|x) (.+)$/
Match score: 12
Objects/texts (1):
Objects:bookshelves
it never drops to scope 2 and never sees 'book'
with bookshelves set to -40:
P> Input string: Examine book
P> ---------------------------------------------------------
P> * Looking at candidate: Examine
P> ..Base score: 10
P> Now matching: book
P> ..Looking for a match for: book (scope 1)
P> -> Trying to match: book
P> -> Considering: Columbus
P> -> Considering: Rudy
P> -> Considering: rumpled_trench_coat
P> -> Considering: old_desk
P> -> Considering: curtains
P> -> Considering: detect_o_matic_3000
P> -> Considering: bookshelves
P> the player has used a string that matches the start of the alias, score length + 15
P> bonus 20 as item has attribute examine
P> item.parserPriority is -40
P> -> Considering: office
P> Found no suitable objects
P> ..Looking for a match for: book (scope 2)
P> -> Trying to match: book
P> -> Considering: Columbus
P> -> Considering: Rudy
P> -> Considering: rumpled_trench_coat
P> -> Considering: old_desk
P> -> Considering: older_drawer
P> -> Considering: curtains
P> -> Considering: detect_o_matic_3000
P> -> Considering: bookshelves
P> the player has used a string that matches the start of the alias, score length + 15
P> bonus 20 as item has attribute examine
P> item.parserPriority is -40
P> -> Considering: book
P> The player has used the exact alias, score 60
P> bonus 20 as item has attribute examine
P> book scores 80
P> -> Considering: office
P> ..Going with: book
P> ...Adding to the score: 0
P> Result score is: 11
P> Candidate accepted!
P> This is the one:Examine
PARSER RESULT:
Input text: undefined
Matched command: Examine
Matched regex: /^(?:examine|exam|ex|x) (.+)$/
Match score: 11
Objects/texts (1):
Objects:book
it proceeds to check scope 2 and finds "book"
The first scope is what is present (scope.isPresent
), which is items that are held or at the location, but does not include items that are inside something that is here.
It may be possible to give the book a custom "isAtLoc" function that returns true for the parser if the location is the room, but otherwise only true if the location in the bookcase (unless the book is moved). Not sure what the other implications might be. But if changing parserPriority for the bookcase works okay, stick with that.