My goal is to see if I can cut certain text off of what is otherwise a valid command and still have the command execute.
To have some context for what I’m doing here, consider that I have this test:
Test describe_001 with “* check summary of unvisited broad walk / look / north / * check summary of visited broad walk / south / * check summary of flower walk / east / * check empty description of palace gate / west / * check full description of palace gate / impressions” in Palace Gate.
The goal here is to be able to annotate tests with what to actually look for. So a command with an asterisk says what to check in the next command’s output.
The commands with “*” are currently handled like this:
After reading a command (this is the ignore test outcome rule):
if the player's command matches the regular expression "^\*":
reject the player's command.
However, what I’m curious about is if I can do something a little different. Specifically, let’s say a command is given like this:
> look * check that the description shows the visited text
So not two commands now. Just one, with the test annotation tacked on at the end.
So here I want the look
command to work as normal but obviously for that to happen the * check that the description shows the visited text
would have to go.
I’m not sure if there is a good way to do this. I started off with this:
After reading a command (this is the ignore test outcome rule):
if the player's command matches the regular expression "\b\*":
cut the matched text.
That doesn’t work at all but I wasn’t so much expecting it to. At the moment I just wanted to check: am I on the right path here?