[UPDATE: yay cross-post with Juhana. Added value in this post is that you need “continue the action” in these After rules, and maybe you need to make sure that they don’t get preempted by other After rules?]
Bad news: The scoring action doesn’t seem to be working correctly, as you can see by trying “x gadget.” You’ll only get one point, which suggests to me that after the run-time erroryour code is just picking the first row of the table.
The problem seems to be a type mismatch between what you’re looking for and what you’re checking. I was able to work around this by forcing both of them to be indexed text:
[code]“Scoring Test” by RPR
This Place is a room.
Scoring for is an action applying to one topic.
Carry out scoring for:
let accomplishment be indexed text;
let accomplishment be the topic understood;
Choose the row with an achievement of accomplishment in the table of score awards;
If earned entry is false:
Now the score is score + points entry;
Now earned entry is true.
There is a gizmo in This Place. There is a gadget in This Place.
After taking the gizmo:
Try scoring for “getting the gizmo”;
continue the action.
After examining the gadget:
Try scoring for “examining the gadget”.
Table of Score Awards
Achievement (indexed text) Points Earned
“getting the gizmo” 1 false
“examining the gadget” 2 false[/code]
But that’s a very kludgy solution, and indexed text is probably best avoided if you don’t need it. (Also, I fear it might goof up other actions involving topics.) I think you really want a “to” phrase rather than an action, since “to” phrases can take text arguments (and don’t involve the rest of the action machinery):
[code]“Scoring Test” by RPR
This Place is a room.
Scoring for is an action applying to one topic.
To score for (accomplishment - text):
Choose the row with an achievement of accomplishment in the table of score awards;
If earned entry is false:
Now the score is score + points entry;
Now earned entry is true.
There is a gizmo in This Place. There is a gadget in This Place.
After taking the gizmo:
score for “getting the gizmo”;
continue the action.
After examining the gadget:
score for “examining the gadget”.
Table of Score Awards
Achievement Points Earned
“getting the gizmo” 1 false
“examining the gadget” 2 false[/code]
By the way, you want to continue the action in your after rules – otherwise they’ll cut off the report stage. (I lazily only did that for taking; the text for examining the gadget gets printed in a Carry Out rule so it happens before the After stage ends the action.)