[Turn off line numbering]
1: arg type, str, sender;
2: var rnum, t, id, chance, times, method, template, m, types;
3:
4: rnum = random(100);
5: if (type == 'tell)
6: types = ['tell, 'any];
7: else
8: types = [type, 'notell, 'any];
9: for t in (types) {
10: if (!dict_contains(active, t))
11: continue;
12: for id in (dict_keys(active[t])) {
13: [chance, times] = active[t][id];
14: if (rnum > chance)
15: break;
16: [method, template] = reactions[id];
17: if (!template || (m = str.(method)(template))) {
18: if (times == 1)
19: .remove_active(t, id);
20: else if (times > 1)
21: .update_active(t, id, [chance, --times]);
22: if (.do_reaction(str, m, id, sender) != 'continue)
23: return;
24: }
25: }
26: }
["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]