Method code for $robot.reactions_cmd()

[Turn off line numbering]
  1: arg cmdstr, cmd, this;
  2: var id, m, tmpl, type, chance, times, method, args, max, min, out, t, a;
  3: 
  4: // [id, [match, template, type, chance, times, [method, args], max, min]]
  5: out = [];
  6: for id in (dict_keys(reactions || #[])) {
  7:     [m, tmpl, type, chance, times, [method, args], min, max] = reactions[id];
  8:     t = $robot.match_type(m);
  9:     a = dict_contains(active_ids || #[], id);
 10:     out += [strfmt("%l%3r %3r %4r %6l %8c %22l %l %l", a ? "*" : " ", id, chance, times == -1 ? "inf" : times, type, min == max ? min : min + "~" + max, method, t[2], tmpl ? "\"" + tmpl + "\"" : "anything")];
 11: }
 12: if (out)
 13:     return ["-- Defined Reactions:", "  ID %CH    # TYPE    DELAY   HOOK                   MT  TEMPLATE"] + out + ["--"];
 14: return "-- No Reactions Defined --";
 15: 
 16: // $#Edited: 18 Aug 97 22:11 $brandon

["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark