Sunday, April 21, 2019

Chapter 12. Getting Objects with SNARF-OBJECTS (part 2)

12.6 Bug: Randomly Picking Objects

When only one object is requested like in:
GET ONE CARD
in a room with multiple cards (blue card, red card, etc), GET-OBJECT will randomly choosing one object. However, the routine places this chose object in the first position of the object table. If there is an object already in the first position, it will be overwritten. For example:
GET FLASHLIGHT AND ONE CARD
SNARFEM will call GET-OBJECT on FLASHLIGHT and put that object number in the first position of the object table. SNARFEM will then call GET-OBJECT on ONE CARD. Since there are multiple cards in that room, GET-OBJECT will randomly pick one and store it in place of FLASHLIGHT.
Another bug is that the randomly picked item could also picked outside of the group of matching objects. For example:
GET FLASHLIGHT AND LETTER AND ONE CARD
in a room with three cards, GET-OBJECT will try to randomly pick one of the three cards. If the random number is 1, GET-OBJECT will pick the object in the first position which is FLASHLIGHT.

12.7 Update: New versions of SNARF-OBJECTS

Zork 1-R88 added an P-AND flag to help with displaying lists of objects properly and to have a hierarchy of adjectives when referring to objects. Only the first adjective is used. All subsequent adjectives are ignored before calling GET-OBJECT.
Sorceror-R18 processed the indirect clause first and then the direct object clause. However processing the exception objects is saved until the end with it trying to apply it to the direct object clause first. If nothing happens then it will try to apply the exception objects to the indirect objects. If there are no direct objects then any exception clause will be applied to the indirect object. Most of the games since the Sorcerer-R18 had SNARFEM check if P-GETFLAGS was in ALL mode before starting. If so, it would set GETFLAGS back to ALL mode after completing its SNARFEM.
LGOP set a global variable, CurrentNounClause, which is used by SNARFEM and SaveNAMAdj, when objects cannot be found. This allows ambiguous nouns or adjectives for the direct and indirect clauses to be stored separately. The game also added several more checks in the routine. If an ALL, BOTH, or EVERYTHING token is found, the routine will call MANY-CHECK to see if the syntax allows for multiple objects to be processed. It also checks if the token is profane and provides an error message. Finally, there is a check for certain adjectives.
Bureaucracy added a check on the number of indirect objects if an exception was to be applied. If there is only 1 indirect object, it would assume the exception objects would refer to the direct objects. Trying to apply the exception objects on a single indirect object could remove it.
Sherlock call SNARFEM and EXCEPTION on different clauses depending on how many object clauses are in the syntax entry which needs to be specially extracted with the compact format.???

12.8 Update: New versions of SNARFEM

Sorcerer-R6 allowed special spell related word when referring to objects. Seastalker similarly allowed numbers and also had SNARFEM ignore any additional adjectives given when referring to an object. Only the first adjective is used.
HGTG checks if the GETFLAGS was in ALL mode. If so, the GETFLAGS is cleared (changed to default mode) and will restore the GETFLAGS back to the ALL mode once SNARFEM is complete.
LGOP will check if a syntax entry will allow multiple objects if “all” or “both” is given with an object. It will be rechecked again toward the end of the PARSER routine.
Hollywood Hijinx does allow for two adjectives to be given for some objects and has a separate routine to check for valid combinations when a second adjective is found.
Other games will have checks for profanity which is not allowed when referring to objects.

12.9 Update: New BUT-MERGE

The only major change was with AMFV and other version 4 and 5 games was the use of SCAN_TABLE operator instead of the ZMEMQ routine. Though various parameters had to be calculated, the new operator could quickly look for a found objects in the exception table.

12.10 Update: New ways to GET-OBJECT

Every game seems to have used their own special version of GET-OBJECT. Those modifications included special checks for certain actions or with certain objects and displaying special errors for certain situations. However, improvements were made over successive games.
Zork1-R88 added a check if the WINNER is also the PLAYER if there is an orphaned command. If so, then error that it can’t be orphaned.
Zork 2-R23 added a new WHICH-PRINT routine which also lists the possible objects for the user to choose from when the noun is ambiguous. It also ensured that the PLAYER can also be checked for objects if the WINNER needing objects is not the PLAYER.
Zork 3 added an early check if the adjective could also be a direction. If so, then it is saved in the DIR variable and ensures the “direction” object is the only entry in the object table. More detailed error messages were added for various situations.
Suspended had a unique GET-OBJECT as the player did not interact directly with the environment. So the GET-OBJECT was more liberal when searching for objects. It would ensure the SLOCBIT was #FFFF for all “get” commands.
The Witness introduced the GENERIC property which contains a routine address used to clarify a requested object. If multiple objects match a given NAM instead of just one, the routine address in the GENERIC property will be called. This routine will then try to determine which specific object was requested based upon various variable values and return that object number. There is no check to see if the GENERIC property is set. If it is blank, it will just return FALSE. GET-OBJECT will then default to providing an error message and display the possible objects to choose from. Also, the NOT-HERE-OBJECT was introduced. For any unmatching identifiers, the NOT-HERE-OBJECT would be returned for counting purposes. The unmatched NAM and ADJ are then saved into XNAM and XADJ.
Planetfall did all for searching the WINNER if in ALL mode only if the WINNER was not the player.
Sorcerer-R15 did limit the created of NOT-HERE-OBJECT and XNAM/XADJ only if the room was lit or for specific actions.
AMFV introduced having a separate NAM and ADJ for direct and indirect object clauses. They are stored in separate two word tables with the first element in each is for the direct clause. It was used by certain actions to check the current noun or adjective in use. It use was later expanded in LGOP.
LGOP did save the identifiers for the direct and indirect objects in different locations when an object is matched. It also fixed the situation where the requested object is a vehicle that the WINNER is inside of.
Spellbreaker also including the searching a vehicle for the requested object if its open. In the few situations, that multiple objects are matched, a separate routine is called to see if all the objects have the same GENERIC routine. If so, the GENERIC routine will be called to clarify which object was requested.
Some games will have extra checks for non-matched objects to see if they are part of a special case. This is primarily for spell names.
Bureaucracy does add a creative error message if OCLAUSE or IClause has more than 10 tokens in it.
The Lurking Horror saves the first 4 adjective identifiers and their corresponding tokens for any object. If multiple adjectives are given, it will see if the last one can also be a noun. If that is the case, it will assign that token to NAM and decrease the number of adjectives.

No comments:

Post a Comment