[Turn on line numbering]
arg id;
var ra, key, e, inserted, chance, times;
// Make sure the sender is a writer, added by Sean 20 Feb 1998
(> .perms(sender()) <);
if (!reactions || !dict_contains(reactions, id))
throw(~noreaction, "No reaction with id '" + id + "'.");
if (!active)
active = #[];
[key, chance, times] = sublist(reactions[id], 3, 3);
if (dict_contains(active, key)) {
ra = active[key];
if (ra.contains(id))
return .update_active(key, id, [chance, times]);
active = dict_del(active, key);
ra = map e in (ra) to (e);
} else {
ra = [];
}
for e in [1 .. listlen(ra)] {
if (ra[e][2][1] < chance) {
ra = insert(ra, e, [id, [chance, times]]);
inserted++;
}
}
if (!inserted)
ra += [[id, [chance, times]]];
active = dict_add(active, key, hash e in (ra) to (e));
active_ids = dict_add(active_ids || #[], id, key);
// Hook into 'social; .hook_into_events() will not add twice, so we're safe
// Added by Sean 20 Feb 1998
// Only hook if the type is not 'tell
if (key != 'tell)
.hook_into_event('social);
// $#Edited: 21 Feb 98 00:30 $user_sean
// $#Edited: 22 Feb 98 14:07 $user_sean
["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]