VerifyResult class | verify.t[55]

Verification result class. Verification routines return a verification result describing whether or not an action is allowed, and how much sense the command seems to make. When a verification fails, it must include a message describing why the command isn't allowed.

It is important to understand that the purpose of verification results is to guess what's in the player's mind, not to reflect the full internal state of the game. We use verification results to figure out what a player means with a command, so if we were to rely on information the player doesn't have, we would not correctly guess the player's intentions. So, in choosing a verification result, only information that ought to be obvious to the player should be consdidered.

For example, suppose we have a closed door; suppose further that the door happens to be locked, but that there's no way for the player to see that just by looking at the door. Now, if the player types "close door," we should return "currently illogical" - common sense tells the player that the door is something that can be opened and closed, so we wouldn't return "always illogical," but the player can plainly see that the door is already closed and thus would know that it makes no sense to close it again. In other words, the player would conclude looking at the door that closing it is currently illogical, so that's the result we should generate.

What if the player types "open door," though? In this case, should we return "currently illogical" as well, because the door is locked? The answer is no. We know that the command won't succeed because we know from looking at the internal game state that the door is locked, but that doesn't matter - it's what the *player* knows that's important, not what the internal game state tells us. So, what should we return here? It might seem strange, but the correct result is "logical" - as far as the player is concerned, the door is something that can be opened and closed, and it is currently closed, so it makes perfect sense to open it.

`class VerifyResult : MessageResult`

Superclass Tree (in declaration order)

`VerifyResult`
`MessageResult`
`object`

Subclass Tree

`VerifyResult`
`DangerousVerifyResult`
`IllogicalNowVerifyResult`
`IllogicalAlreadyVerifyResult`
`IllogicalVerifyResult`
`IllogicalSelfVerifyResult`
`InaccessibleVerifyResult`
`LogicalVerifyResult`
`NonObviousVerifyResult`

Global Objects

(none)

Summary of Properties

`allowAction excludePluralMatches resultRank`

Inherited from `MessageResult` :
`messageProp_ messageText_`

Summary of Methods

`compareTo identicalTo isWorseThan shouldInsertBefore`

Inherited from `MessageResult` :
`construct resolveMessageText setMessage showMessage`

Properties

`allowAction` | `verify.t[60]`

Is the action allowed? This returns true if the command can be allowed to proceed on the basis of the verification, nil if not.

`excludePluralMatches` | `verify.t[152]`

Should we exclude plurals from being matched, when this type of result is present? By default, we don't; some illogical types might want to exclude plurals because the result types indicate such obvious illogicalities.

`resultRank` | `verify.t[144]`

Our result ranking relative to other results. Each result class defines a ranking level so that we can determine whether one result is better (more approving) or worse (more disapproving) than another.

To allow easy insertion of new library extension result types or game-specific result types, we assign widely spaced rankings to the pre-defined results. This is arbitrary; the only thing that matters in comparing two results is the order of the rank values.

Methods

`compareTo (other)` | `verify.t[96]`

compare to another: negative if I'm worse than the other, zero if we're the same, positive if I'm better

`identicalTo (other)` | `verify.t[127]`

Determine if I'm identical to another result. Note that it's possible for two items to compare the same but not be identical - compareTo() is concerned only with logicalness ranking, but identicalTo() determines if the two items are exactly the same. Some subclasses (such as LogicalVerifyResult) distinguish among items that compare the same but have different reasons for their rankings.

`isWorseThan (other)` | `verify.t[86]`

Am I worse than another result? Returns true if this result is more disapproving than the other.

`shouldInsertBefore (other)` | `verify.t[108]`

Determine if I should appear in a result list before the given result object. By default, this is true if I'm worse than the given result, but some types of results use special sorting orders.

TADS 3 Library Manual
Generated on 8/21/2012 from TADS version 3.1.2