ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Give Object to Character bug

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

Give Object to Character bug

Postby DazaKiwi » Sat Feb 23, 2019 11:01 pm

This may have been mentioned in the past. It drove me a little batty at first lol until i worked out what was going on.

eg.
two characters; red monster and bob and an object green apple;

give green apple to red monster (works)
give red monster green apple (does not work) [it says- I did not understand the word "red". Debugger shows 'No matches found...']

As for bob (only one word used for his name):
give green apple to red monster (works)
give bob green apple (works)

So what i found was if your character has two words either both words together (eg Red Monster) in the Descriptor/Noun box or one word in Prefix and one word in Descriptor it wont even look at the task 'give character object' command. A single word for the character will work both variants of the command.

Yet...give object to character (with 2 words) command works.

See demo if you are inclined to...
Attachments
Give_Demo.taf
(15.19 KiB) Downloaded 25 times
User avatar
DazaKiwi
 
Posts: 649
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 21

Re: Give Object to Character bug

Postby saabie » Sun Feb 24, 2019 6:28 am

It looks like the core parser gets confused and can't figure out how to split Adjective-Noun-Adjective-Noun into 2 items unless there is another word separating them.
It decides that "blue monster green apple" is not an item it knows, so it tries to find the word "Blue" in a task and fails.
saabie
 
Posts: 988
Joined: Fri Aug 12, 2011 2:07 am
Location: Adelaide, South Australia
Points: 50

Re: Give Object to Character bug

Postby ralphmerridew » Tue Feb 26, 2019 6:57 pm

It probably works like this:

The task has command line "give %object1% %object2%"
It attempts to pattern match that, but it's ambiguous.
-object1"red" object2"monster green apple"
-object1"red monster" object2"green apple"
-object1"red monster green" object2"apple"

ADRIFT chooses how to break this ambiguity without looking at the game (first choice).

It would probably handle "give monster green apple" but not "give red monster apple".
Bloodhounds can make you laugh and cuss in the same breath. They are endearing, faithful, and can sling drool ten feet in any direction. -- Virginia Lanier
User avatar
ralphmerridew
 
Posts: 2574
Joined: Fri Dec 13, 2002 11:56 pm
Location: Missouri
Points: 10

Re: Give Object to Character bug

Postby DazaKiwi » Wed Feb 27, 2019 12:52 am

ralphmerridew wrote:It probably works like this:

The task has command line "give %object1% %object2%"
It attempts to pattern match that, but it's ambiguous.
-object1"red" object2"monster green apple"
-object1"red monster" object2"green apple"
-object1"red monster green" object2"apple"

ADRIFT chooses how to break this ambiguity without looking at the game (first choice).

It would probably handle "give monster green apple" but not "give red monster apple".


Are you referring to the fact it is using %objects%?

Parent task;
[give/offer] %objects% to %character%
[give/offer] %character% %objects%

I did create a custom (non-specific) task [feed] %character% %object% (note singular) and that failed the same way as the other one did as in didn't even match, and again it worked with Bob.
User avatar
DazaKiwi
 
Posts: 649
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand
Points: 21

Re: Give Object to Character bug

Postby ralphmerridew » Thu Feb 28, 2019 1:39 am

I was sending from my phone, so I couldn't check what variables it actually used.

And it's not important which variable exactly is used; what's important is the fact that ADRIFT's parser decides how to split the string into vars without looking at the world model.
Bloodhounds can make you laugh and cuss in the same breath. They are endearing, faithful, and can sling drool ten feet in any direction. -- Virginia Lanier
User avatar
ralphmerridew
 
Posts: 2574
Joined: Fri Dec 13, 2002 11:56 pm
Location: Missouri
Points: 10

Re: Give Object to Character bug

Postby Campbell » Thu Oct 03, 2019 2:34 pm

Correct. The ADRIFT parser uses regular expressions to determine the references, then quantifies each match against the items. When two references are back-to-back, in some instances it can have difficulty distinguishing how these should be separated. Firstly it does a left-to-right check and sees if it can uniquely pair each match against the relevant references (e.g. it checks "red" against all objects, and thus fails). If it finds no matches for all references it starts again but does a right-to-left check. So here it will successfully match "apple" against the object reference, and then try to match "red monster green" against the character reference, and obviously fail.

So basically, it can handle back-to-back references as long as one of those references is a single word. If both references contain multiple words, neither left-to-right nor right-to-left matching lazy matching will uniquely identify both references.

I.e. "give red monster green apple" matches against a regex like so:

^(give|offer) (?<character1>.+?) (?<objects>.+?)$

This could match as:
[give] [red] [monster green apple] <- left to right matching
[give] [red monster] [green apple] <- not currently possible
[give] [red monster green] [apple] <- right to left matching

I'll need to try to think of a way to do this.
ADRIFT Developer developer.
User avatar
Campbell
Site Admin
 
Posts: 4656
Joined: Sun Jun 23, 2002 11:05 am
Location: Edinburgh, Scotland


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 5 guests

cron