Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue L61027

Wrong execution order in 'Before' stage
Submitted by: Paolo Maroncelli     Appeared in: Library 6/10 or before     Fixed in: Library 6/11
Problem

On page 93 of the DM4, the calling order of routines and properties for the 'Before' stage is defined as follows:

1. GamePreRoutine().
2. orders of the player.
3. react_before of every object in scope.
4. before of the current room.
5. before of the first noun, if specified.

Nevertheless, in library 6/10 the steps 3 and 4 are executed in reverse order (see BeforeRoutines in parserm.h). In my opinion the order specified in the DM4 is more correct, before it gives higher priority to the evaluation of the react_before of objects, allowing the implementation of base behaviours for rooms, but letting objects override them if necessary.

Solution

My simple solution for what I think is a bug in the library is to 'replace' BeforeRoutines in parserm.h with the following:

  [BeforeRoutines;
    if (GamePreRoutine()~=0) rtrue;
    if (RunRoutines(player,orders)~=0) rtrue;
    scope_reason=REACT_BEFORE_REASON; parser_one=0;
    SearchScope(ScopeCeiling(player),player,0);
    scope_reason=PARSING_REASON;
    if (parser_one~=0) rtrue;
    if (location~=0 && RunRoutines(location,before)~=0) rtrue;
    if (inp1>1 && RunRoutines(inp1,before)~=0) rtrue;
    rfalse;
  ];

which calls the before property of the current room after the react_before properties of the objects in scope, as defined in the DM4.


Last updated 17 April 2013. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Roger Firth.