15.1 Introduction
At this point, all necessary information should be checked and processed. All the direct and indirect objects and the action number to use those objects have been found. Many combinations of objects and actions can be handled by the specific action routine. The designer of Infocom games understood that many actions on objects could be handled with a generic verb action routine. Any special circumstances usually depend on the objects used. Therefore, these circumstances could be checked when accessing those objects and not clutter up a generic verb action routine.
15.2 Checks and Order
Since action routines can call PERFORM separately from PARSER to perform functions that mimic a command, PERFORM does not use the global PRSA, PRSO, and PRSI but will be passed a separate action, direct object, and indirect object arguments. It then temporarily saves the current PRSA, PRSO, and PRSI.
- PERFORM will check for the IT object in the direct or indirect object. If so, it will be replaced with the previously referenced object for IT.
- It will copy all the given arguments (action, direct object, and indirect object values) into the appropriate global variables (PRSA, PRSO, PRSI).
- If the given action is not GO, PERFORM will then update the IT object to the just given direct object argument and update the location of the winner to the current location.
- If the given action is not AGAIN, PERFORM will update the global variables for the last action number, direct object, and indirect object. These are used by the AGAIN command.
After updating the necessary variables, PERFORM will call various routines to handle the action on the objects. A non-handled action (by returning M-NOT-HANDLE) will be passed to the next possible routine to handle it. The order of handler preference is below:
- WINNER’s action routine
- WINNER’s location’s action routine with M-BEG argument
- Verb (PRSA) pre-action routine
- Indirect object (PRSI) action routine
- Direct object (PRSO) action routine (skipping if the action is GO)
- Verb (PRSA) action routine
ACTION routines for objects and rooms can be passed standard RARG values for a specific type of function to perform. Any needed objects can be found in PRSO and PRSI. The routine will then return an action return value. If the routine can successfully complete a function, then M-HANDLED is return. PERFORM will skip over all other subsequent handlers. If the routine cannot handle a function, M-NOT-HANDLED is returned. PERFORM will then try other handlers to handle the function. The verb action routine is considered the default handle routine and can always handle an action. It usually displays a generic message. Once a function has been handled, the current room’s ACTION routine is sent M-END to handle any remaining functions before the turn is completed. If M-FATAL is ever returned by an action, then PERFORM will exit immediately and return M-FATAL. Also, the current room’s ACTION routine is not called with M-END. Before PERFORM returns, the previous values of PRSA, PRSO, and PRSI are restored.
Room Arguments (RARG)
|
Action Return Values
|
|
|
Objects trying to handle actions may need to double check which object is the direct and indirect object. In an example from Infocom:
TAKE SWORD FROM THE STONE
would have the STONE object process the TAKE action first. In that case, the STONE could interpret the user trying to take the STONE. To prevent this, STONE object could see if it is the PRSI before handling the action.
Later ZIP 3 games also included checking an object’s CONTFCN (container function) before having the direct object try to handle the action. This was only called in those rare situations (such as in Starcross) where the direct object’s container would try to handle an action.
15.3 THIS-IS-IT
Starting with Sorcerer, PERFORM calls THIS-IS-IT after acting upon the PRSO and PRSI to update the IT-OBJECT. The PRSO value is stored as the IT-OBJECT value. Planetfall would introduce saving the location of the IT-OBJECT as well in a separate global variable. Wishbringer added other pronouns objects (HIM-OBJECT, HER-OBJECT, and THEM-OBJECT) along with their associated global variables which would be updated if needed based upon the attributes of the PRSO (such as gender or being plural). The routine is also called from other parts of the game like ITAKE-CHECK and specific action routines. It was only used in LGOP, Moonmist, Hollywood Hijinx, Stationfall, and Plundered Hearts.
No comments:
Post a Comment