Collecting free text

i think i have a challenge.

i need to give the player the ability to write on an object. they should be able to write whatever they want and it should be bound to the object so it can be examined, compared, read-back later (if they write something specific then something else happens).

i have mucked around with this for a while but it is beyond my dialog parser capabilities.

i’ve played with this predicate along with a custom grammar token.

(interface (asking for free_text in $<Action))
(asking for free_text in $Action)
	(now) (implicit action is $Action)
	(now) (implicit action wants free_text)

have also thrown in variants of:

(understand [write | $Words] as [write $Words on $Object])
    *(split $Words by [on] into $Left and $Right)
    *(understand $Left as free_text $Free)
    *(understand $Right as non-all object $Object)

but no luck. the dialog parser eludes me in many ways (so, so many ways…) so i’m cutting my losses and asking for help.

1 Like

Try something like this?

(understand [write | $Words] as [write $Left on $Object])
    *(split $Words by [on] into $Left and $Right)
    *(understand $Right as non-all object $Object)

Now you’ll end up with an action like [write [a b c] on #cube]. Lists of dictionary words generally don’t end up in actions, currently, so you may need to tweak the (describe action $) predicate to make sure they’re handled properly, but it shouldn’t be hard to then do something like:

(perform [write $Words on #cube])
    You write (print words $Words) on the featureless cube. It is now the "(print words $Words)" cube.
    (now) (cube label $Words)

(dict #cube)
    (cube label $Words)
    (print words $Words)
2 Likes

yeah, this is one of the things i tried. but i can’t get the output right.

if you type, for instance “write aaa bbb ccc on the cube”

the output is:

The:
You write on the cube.

The:
You write on the cube.

The:
You write on the cube.

it seems like it’s treating the contents of the $Words list as separate objects instead of something i can print?

Ahh, okay, I think I see what’s going on here. (try-complex $) has special handling if it finds a list inside an action, and that’s going haywire here. Hmm. I’ll have to experiment with that.