Sign in to follow this  

Event Logger

2 posts in this topic

Event Logger

View File

A simple addon to log events to chat or to the log file to help with development and API exploration. The parameters passed to the event can be printed as well.

The addon is configured using chat commands (see below for details). In the script file ( " EventLogger.lua") you can add events which should always be ignored (to prevent spamming). By default a few events are ignored, which I consider unimportant (check the file for yourself).

Chat commands:

[BOOLEAN] has to be either "on"/"true" to turn on, "off"/"false" to turn off,
          or nothing to toggle
"/el [BOOLEAN]" -- Enable/Disable this addon
"/elfilter [STRING]" -- Set/Reset filter string
"/elparams [BOOLEAN]" -- Enable/Disable logging of parameters
"/elchat [BOOLEAN]" -- Enable/Disable logging to chat
"/ellog [BOOLEAN]" -- Enable/Disable logging to log

Filter string:

By typing "/ elfilter YOUR_FILTER_STRING "  in chat, you can filter which events will be logged. You can use the ' | 'character (bar character) as an OR operator and lua pattern syntax  for more precise filtering. Letter case (capitalization) is ignored (So "unit", "UNIT", "Unit", "uNiT" are all the same).

"/ elfilter unit" - only list events containing the word "unit".
"/ elfilter avatar | object" - only list events which either contain the word "avatar" or the event "object".


The events listened for are taken from  the official API documentation .

If anybody want to add some UI or anything else, feel free to do so and upload it.


Share this post

Link to post
Share on other sites

Привет. Не могу написать это на английском, но у меня есть идея для этого аддона.

Почему бы дополнительно не логировать параметры события?


Я давно использую примерно такой код, когда надо посмотреть когда и с какими параметрами приходит событие:


В этом мне помогает неплохая функция advtostring и мой самодельный скрипт для отправки текста в чат.

Если не хочется использовать мой скрипт, то я тут набросал код для чата:

    local time = common.GetLocalDateTime()
    local valuedText = common.CreateValuedText()
    common.SetTextValues(valuedText, {
      format = userMods.ToWString('<html color="0xffccc5b7" fontsize="14"><r name="time"/> [<r name="addon"/>]: <r name="event"/> <r name="params"/></html>'),
      time = {
        format = userMods.ToWString('<html><r name="h"/>:<r name="m"/>:<r name="s"/>.<r name="ms"/></html>'),
        h = common.FormatNumber(time.h, '2'),
        m = common.FormatNumber(time.min, '2'),
        s = common.FormatNumber(time.s, '2'),
        ms = common.FormatNumber(, '3')
      addon = userMods.ToWString('EventLogger'),
      event = userMods.ToWString('EVENT_OBJECT_BUFFS_ELEMENT_CHANGED'),
      params = userMods.ToWString(string.format('<html>%s</html>', string.gsub(advtostring(params, false), '%c', {['\t'] = '  ', ['\n'] = '<br/>'})))

Надеюсь, ты сможешь это перевести, либо поймешь идею по картинке и коду 😉

Share this post

Link to post
Share on other sites
  • Для диагностики ошибки требуется информация из \Personal\Logs\mods.txt. Для этого в \Personal\global.cfg найдите параметр user_mods_log_enable и выставьте ему значение 1. Затем запустите аддон в игре.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this