I7: How to make it differentiate similar actions.

Hello again,

I’ve found myself in a pickle! I have the following two actions:

2Drawing is an action applying to one topic and one thing.
Understand “draw [text] on [something]” as 2Drawing.
Instead of 2Drawing, end the game saying “Blah blah”.

1Drawing is an action applying to one topic.
Understand “draw [text]” as 1Drawing.
Instead of 1Drawing, end the game saying “Blah blah”.

Problem is, it can’t tell the difference between these. For example, I say “draw pants on cat”, when a cat cannot be seen. It should say “You can see no such thing”, following the rules of the first action. Instead, it interprets it all as text, and I get the 1Drawing end game result. So, the problem is that it lets the player draw on things that do not exist.

Is there a way around this/better way of doing this in general?

I’m not sure if there’s a way around it using only action definitions. I expect someone who knows more than I will immediately come and say there is shortly after this post of mine, but I can have my fun before that happens :wink:

Here’s a system I worked out for differentiating various kinds of drawing.

The main thing it adds to yours to catch out attempts to draw (words) on (something not present) is by checking if the player typed the word ‘on’ somewhere in their command. If they did, we could then use text matching to isolate the useful bit of what they typed (the description of the artwork, presumably) from the non-useful bit (the thing they named that isn’t present.) I haven’t implemented that yet, just the framework to catch it.

Try this demo and say ‘test me’. I gave the player a notepad so they can draw stuff without naming a surface. Also I added a command to try to ‘draw on’ something, but without saying what to draw.

[code]There is a room called Studio.

the cat is an animal in Studio.

player holds a notepad.

the wall is a fixed in place thing in the studio.

Drawing it on is an action applying to one topic and one thing.
Understand “draw [text] on [something]” as Drawing it on.

Carry out Drawing it on:
say “You draw [topic understood] on [the second noun].”

Vague drawing is an action applying to one topic.
Understand “draw [text]” as Vague drawing.

Drawing on something is an action applying to one thing.
Understand “draw on [something]” as drawing on something.

Carry out Drawing on something:
say “You draw on [the noun].”

Carry out Vague drawing:
if player’s command includes “on”:
say “If you read this message, the player tried to draw on something that ain’t here, so now we need to write some code to deal with that.”;
otherwise:
say “You draw [topic understood] in your notepad.”

Test me with “draw a face on cat / draw face on wall / draw face on cupboard / draw a big face / draw on the wall / draw on the cupboard”.[/code]

Edit PS - Also, at this most basic level of checking for the presence of ‘on’, the wrong thing will happen if you type something like ‘draw a man on a skateboard on the wall.’ Technically that should work because the wall is real, but the two 'on’s will trip it. So if you want that kind of thing, you’d have to get into more sophisticated text matching.

You could make the action apply to anything, even if it’s not in the same location.

[code]Drawing room is a room. The pet room is north of drawing room. The cat is in the pet room.

Drawing it on is an action applying to one topic and one visible thing.

Understand “draw [text] on [any thing]” as drawing it on.
Understand “draw [text]” as drawing it on.

[note that you don’t need a separate action for the case where the noun is omitted.]
Rule for supplying a missing second noun while drawing on:
say “You draw [topic understood] in the air.”;
stop the action.

Check drawing on when the player can not see the second noun:
say “[The second noun] is not here.” instead.

Report drawing on:
say “You draw [topic understood] on [the second noun].”

Test me with “draw pants/draw pants on cat/n/draw pants on cat”.[/code]
You’d probably need to tweak this so that the action doesn’t react to things the player hasn’t seen yet. Eric Eve’s Epistemology extension helps with this.

Thanks guys! I went with the first option, it seems to work fine for my purposes.