Extended Timers

version 3 by Gavin Lambert

  • Home page
  • Beginning
  • Previous
  • Next



  • Section 1 - Inform 6
    Include (-
    [ GetI7TimerTurns R i t;
        for (i=1: i<=(TimedEventsTable-->0): i++) {
            if (R == TimedEventsTable-->i) {
                t = TimedEventsTable-->i;
    #ifdef TURN_REPORTING_ONE_BASED;
                if (t < 0) { return -t; }
                return (t - the_time + 1);
    #ifnot;
                if (t < 0) { return (-t - 1); }
                return (t - the_time);
    #endif;
            }
        }
        return -1;
    ];
    [ GetI7TimerTime R i t;
        for (i=1: i<=(TimedEventsTable-->0): i++) {
            if (R == TimedEventsTable-->i) {
                t = TimedEventTimesTable-->i;
                if (t < 0) { return (the_time - t - 1); }
                return t;
            }
        }
        return -1;
    ];
    [ GetI7TimerInterval R t;
        t = GetI7TimerTime(R);
        if (t < 0) { return -1; }
    #ifdef TURN_REPORTING_ONE_BASED;
        return (t - the_time + 1);
    #ifnot;
        return (t - the_time);
    #endif;
    ];
    [ PrintTimeIntervalEnglish t h m;
        if (t < 0) { print "<no time>"; return; }
        h = t / 60; m = t % 60;
        if (h > 0) {
            print (number) h, " hour"; if (h ~= 1) { print "s"; }
            if (m > 0) { print " and ", (number) m, " minute"; if (m ~= 1) { print "s"; } }
        } else {
            print (number) m, " minute"; if (m ~= 1) { print "s"; }
        }
    ];
    -).