johanberntsson / PunyInform

A fast and compact library for writing text adventure games for the Z-machine running on 8-bit computers as well as other platforms.
MIT License
176 stars 17 forks source link

Reversed definition of MSG_THROW_ANIMATE and MSG_THROW_DEFAULT constants #98

Closed auraes closed 2 years ago

auraes commented 2 years ago

There is a semantic problem in ThrowAtSub(): if(second hasnt animate) { PrintMsg(MSG_THROW_ANIMATE); rtrue; } If the object does not have the animate attribute, there is no reason to display the message MSG_THROW_ANIMATE.

It seems that this would be more correct:

#Ifndef MSG_THROW_ANIMATE;
Constant MSG_THROW_ANIMATE "You lack the nerve when it comes to the crucial moment.";
#Endif;
#Ifndef MSG_THROW_DEFAULT;
Constant MSG_THROW_DEFAULT  "Futile.";
#Endif;

[ ThrowAtSub;
        ...
    if(second hasnt animate) { PrintMsg(MSG_THROW_DEFAULT); rtrue; }
    if(RunLife(second,##ThrowAt) ~= 0) rfalse;
    PrintMsg(MSG_THROW_ANIMATE);
];
auraes commented 2 years ago

I may be wrong because by default the grammar considers that you throw something to someone. So in this case naming the constant MSG_THROW_DEFAULT seems coherent. It is the naming of MSG_THROW_ANIMATE that is confusing.

johanberntsson commented 2 years ago

Constants have to be kept reasonably short, and I think it is clear from the context that it refers to a situation when you throw something at someone (or something with the animate attribute set). We will keep it as is.