[Turn on line numbering]
arg event, update_on, src;
var value, all;
(> .perms(sender()) <);
if (!events)
events = #[];
// If/when more are added.. also update $help_sys_event_register
if (update_on != 'move && update_on != 'startup)
throw(~type, "Update on must be either 'move or 'startup");
if (type(src) == 'symbol) {
if (src != 'location && src != 'this)
throw(~type, "Source types must be either 'location or 'this.");
} else if (type(src) != 'objnum) {
throw(~type, "Source type must be either a symbol or object.");
} else if (!src.is($event_handler)) {
throw(~type, "Source " + src.namef('ref) + " is not an event handler.");
}
if (events.contains(update_on)) {
all = events[update_on];
if (events[update_on].contains(event)) {
value = replace(all[event], 2, src);
events = events.add(update_on, all.add(event, value));
} else {
events = events.add(update_on, all.add(event, [0, src]));
}
} else {
events = events.add(update_on, #[[event, [0, src]]]);
}
["// Created 16-Dec-1996 as a part of ColdCore, see: @help Credit"]