Under the current Combat2 testing version, COMBAT_CHANNEL can get very spammy, especially when there are multiple sources of damage over time present in a busy combat sim. An excess of messages can cause scripts to drop events off the end of the queue. Most residents/scripts will most likely be interested in only a few events:
  • Damage my objects (or my specific object) caused that were modified by the recipient
  • Damage my objects caused that resulted in a death
  • What damage source resulted in my death
Therefore I propose a dedicated "combat_log" event that functions similar to listen using whitelist filters. The three types of events I have observed are "MODIFY", "DEATH", and "DAMAGE", typically occurring in that order as applicable, but there seems to be at least one more event, where scripts can send a message on COMBAT_CHANNEL to be added to the log (we could still listen on COMBAT_CHANNEL to pick up that). The fields the first three have in common are "event", "owner", "rezzer", "source", "target", and "type". The event signature could look something like one of these:
  • combat_log ( integer handle, string data_json );
  • combat_log ( string event, key owner, key rezzer, key source, key target, integer type, list params );
Params could vary with the event type, but for any and all of the other fields, there should be a way to set filters to avoid firing the event too often and slowing/blocking other events. The option to enable multiple filters would be ideal with a signature looking something like this, where the function returns an integer containing the filter's handle (like llListen):
  • integer llCombatLogListen ( list rules );
  • llCombatLogListenRemove ( integer handle );
Some examples of rules that could be used to filter for desired events (from the top of this post):
  • [ COMBATLOG_EVENT, "MODIFY", COMBATLOG_OWNER, llGetOwner() ] - damage my objects caused that was modified
  • [ COMBATLOG_EVENT, "MODIFY", COMBATLOG_SOURCE, llGetKey() ] - damage this object caused that was modified
  • [ COMBATLOG_EVENT, "DEATH", COMBATLOG_OWNER, llGetOwner() ] - my objects resulted in a death
  • [ COMBATLOG_EVENT, "DEATH", COMBATLOG_TARGET, llGetOwner() ] - someone's damage resulted in my death
  • [ COMBATLOG_EVENT, "MODIFY" ] - for region/estate owners to monitor for undesired damage adjustments, i.e. cheating
  • [ ] - accept all
Unlike listen, an empty string or NULL_KEY should not be treated as a wildcard, since parameters can be omitted.