In my game, I’ve been adding some testing commands so I can put the game in a certain state when testing it out. This has largely worked, but my latest one is acting strange:
[ SolveThing;
PlayerTo(MyLoc);
<Examine Gizmo>; <-- says "nothing special" instead of its before:Examine
give Gizmo ~open; ! <-- workaround: directly open the gizmo
PlayerTo(OtherLoc);
<Push RedButton>; ! <-- says "that's fixed in place" instead of before rtn
];
Most things work, but trying to examine the gizmo (which has a custom description) returns a generic one, and pushing the red button fails to run the custom before:Push method on the button.
However, when this test command finishes running and I just type “PUSH RED BUTTON” into the game, it works fine.
When I use “actions on” it shows the right command “[ Action Push with noun 184 (red button)]” for both the run-by-test fail and the typed-by-human success.
Does anyone have any sense of what may be the problem? I’m using PunyInform (latest version), but this problem may be in the Inform6 layer, rather than a Puny problem.
If it helps: the red button is marked static, so the fixed-in-place would be the default response for it, but I catch that in my before:Push and always say something different.
Interesting. I can’t see any problem with the code you’ve supplied.
Can you extract the objects involved to a new example game, and cut out parts that seem irrelevant, to produce a minimal example that still has the problem?
Note: The standard way of customizing the description of an object is by giving it the description property.
I haven’t thought about that, but yeah, the meta flag is normally only changed while parsing. When invoking an action in code, there is no parsing, so the flag just keeps its value.
One could certainly argue that the flag should be set or cleared every time a new action starts, even if it’s happening through code. With the old system, where meta is set on the verb level, that’s not really doable. However, nowadays we also have the option of setting certain actions as meta, and if this is used, we could set or clear the meta flag even on actions invoked in code.
Is this true? As I remember it, the meta flag on actions was implemented by sorting the actions and defining a constant that indicates where the cut-off between meta/non-meta is. This would prevent meta on actions to be changed during run-time, wouldn’t it?