ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   EVENT_CHAT_MESSAGE_CHANNEL issues since yesterday? (https://www.esoui.com/forums/showthread.php?t=7751)

motorheadabega 04/29/18 08:03 AM

EVENT_CHAT_MESSAGE_CHANNEL issues since yesterday?
 
Hello , this is my first post to this forum.

I have been dabbling in lua addon scripting for ESO for a couple of weeks now and everything was coming along well. I really enjoy it. Everything was working (or at least failing with expected error messages) yesterday afternoon. At some point last night I noticed that I was not getting any output from my EVENT_CHAT_MESSAGE_CHANNEL handler.

I was tired and did not want to take apart my (rather medium sized) script, so I disabled it and wrote a new test stub as follows:

Code:

chatlog = {}
chatlog.name = "chatlog"

function chatlog:OnAddOnLoaded(event, name)
    if name == "chatlog" then chatlog:Initialize() end
end

function chatlog:Initialize()
    EVENT_MANAGER:RegisterForEvent(self.name, EVENT_CHAT_MESSAGE_CHANNEL, self.OnChatMessage)
end

function chatlog:OnChatMessage(event, channel, from, message)
  d(self.name .. ": OnChatMessage was tripped")
end

EVENT_MANAGER:RegisterForEvent(chatlog.name, EVENT_ADD_ON_LOADED, chatlog.OnAddOnLoaded)

with barebones manifest as follows:

Code:

## Title: chatlog
## Description: chat log analyzer
## APIVersion: 100022

chatlog.lua

Which did not produce any output either, so I gave up and went to bed. Now in the light of day it still does not provide output. This minimal code still looks fine to me, however, and I could swear I was successfully handling this event as recently as yesterday afternoon.

Does anyone know if there has been a change to how this event is handled? or if I'm doing it wrong? Is it working for you?

Any advice appreciated.

Thanks.

votan 04/29/18 08:13 AM

Quote:

Originally Posted by motorheadabega (Post 34554)
Hello , this is my first post to this forum.

I have been dabbling in lua addon scripting for ESO for a couple of weeks now and everything was coming along well. I really enjoy it. Everything was working (or at least failing with expected error messages) yesterday afternoon. At some point last night I noticed that I was not getting any output from my EVENT_CHAT_MESSAGE_CHANNEL handler.

I was tired and did not want to take apart my (rather medium sized) script, so I disabled it and wrote a new test stub as follows:

*snip*

Which did not produce any output either, so I gave up and went to bed. Now in the light of day this minimal code still looks fine to me, and I could swear I was successfully handling this event as recently as yesterday afternoon.

Does anyone know if there has been a change to how this event is handled? or if I'm doing it wrong? Is it working for you?

Any advice appreciated.

Thanks.

Hi.

your OnAddOnLoaded is not correct that way:
chatlog:OnAddOnLoaded(event, name) => chatlog.OnAddOnLoaded(event, name)

Otherwise this has three parameters (the implicit self)

motorheadabega 04/29/18 09:07 AM

ThankYouThankYouThankYouThankYouThankYouThankYou
 
ThankYouThankYou

Your comment not only set me straight, but explained how I got so turned around late last night.

I am still struggling with the dot vs colon thing.

Many thanks again.

Cheers,

Rhyono 04/29/18 10:20 AM

votan already explained it, but I'll give an example:

lua Code:
  1. str = "HELLO"
  2.  
  3. string.lower(str) -- uses lower's parent class string and applies the function to our argument str. GOOD
  4. str:lower() -- passes str to lower and lower assumes str is a string. GOOD
  5. str.lower() -- str does not have any functions and this will fail. BAD


All times are GMT -6. The time now is 04:43 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI