Yes, I know I'm a mess.

Post Reply
Aydein
Posts: 27
Joined: Wed Sep 13, 2017 8:45 pm

Yes, I know I'm a mess.

Post by Aydein »

Sorry for asking for help again so soon and I'm vaguely aware that it's something dumb I did along the way.

I've been tinkering with gmcp chat and looking at the sources I could find for it. Now.. I found one and it seems like it's at least trying to work after I put it into my gui, but unfortunately when I did and the edits I made (they were not suited to my tabs so they had to happen) it appears I did something wrong. I know that the trigger line that is being called into question in is line 14 of my parser. (at the bottom)
---This is the lua error.
[ LUA ] - object: <Chat Parser> function:<Trigger188>
<[string "Trigger: Chat Parser"]:14: attempt to call method 'appendBuffer' (a nil
value)>


This is something I added to a login trigger: sendGMCP([[Core.Supports.Add ["Comm.Channel 1"] ]])

---This is my EMCO chat tabs

Code: Select all

local EMCO = require("MDK.emco")
chat_con = Geyser.Container:new({
  x = "20",
  y = "10",
  height = "96%",
  width = "96%",
},GUI.Box7)

local stylesheet = [[background-color: rgb(0,0,0,255); border-width: 3px; border-style: solid; border-color: rgb(0,78,156); border-radius: 10px;]]
local istylesheet = [[background-color: rgb(0,0,0,255); border-width: 0px; border-style: solid; border-color: rgb(0,0,0,0); border-radius: 10px;]]
chatcon = EMCO:new({
  x = "6",
  y = "5",
  width = "99%",
  height = "97%",
  scrollbars = true,
  inactiveTabFGColor = "dodger_blue",
  activeTabFGColor = "white",
  tabFontSize = "6",
  tabHeight = "32",
  tabWidth = "3",
  allTab = true,
  allTabName = "All",
  gap = 2,
  consoleColor = "black",
  consoles = {
    "All",
    "Says", 
    "Tells",
    "Orgs",
    "Misc",
  },
  activeTabCSS = stylesheet,
  inactiveTabCSS = istylesheet,
}, chat_con)
---This is the code inside my trigger (if you need the regex of the trigger itself I can post that but I don't think that's the issue

Code: Select all

local ignore = {"halfling" ,"cyclops","gnoll", "mingruk", "tsol'aa ", "Talus, the caveman", "e glubber", "arcadian", "Adalgar"}
local ignoret = false

for i,v in pairs(ignore) do
	if matches[2]:find(v) or matches[2]:find(v:title()) then
		ignoret = true
	end
end

if not ignoret then
  selectString(line,1)
  copy()
  chat_channels.last:appendBuffer()
  chatcon:appendBuffer()
end
--I have in addition to these a few other triggers, but they seem to be working and I'm not getting errors back off of these.
-Trigger Group "Chat Processor" with my "Chat Parser" and "Disable Processor". Disable Processor raises the event chat prompt processed which is

Code: Select all

function chat_processed()
  disableTrigger("Chat Processor")
end
--Aside from these, the only remaining piece is chat_capture with registered event gmcp.Comm.Channel.Start

Code: Select all

function chat_capture()
  local ch = gmcp.Comm.Channel.Start
  if not chat_channels then check_channels() end
    chat_channels.last = "Misc"
    for c, t in pairs(chat_channels.types) do
      if ch:find(c) then
        chat_channels.last = t
        break
      end
    end
       enableTrigger("Chat Processor")
  end

    function check_channels()
       chat_channels = chat_channels or {}
       chat_channels.last = chat_channels.last or ""
       chat_channels.types = {
          ["newbie"] = "Misc",
          ["market"] = "Misc",
          ["ct"] = "Orgs",
          ["ht"] = "Orgs", 
          ["hts"] = "Orgs",
          ["hnt"] = "Orgs",
          ["clt"] = "Tells",
          ["Party"] = "Tells",
          ["tell"] = "Tells",
          ["says"] = "Says",
          ["ot"] = "Misc"
       }
    end




User avatar
demonnic
Posts: 883
Joined: Sat Dec 05, 2009 3:19 pm

Re: Yes, I know I'm a mess.

Post by demonnic »

You're setting chat_channel.last to a string, which looks like the name of a tab in the emco. So then you would want to do chatcon:append(chat_channel.last) rather than chat_channel.last:appendBuffer()

Aydein
Posts: 27
Joined: Wed Sep 13, 2017 8:45 pm

Re: Yes, I know I'm a mess.

Post by Aydein »

Doesn't look like that is working quite right either, which incidently looks like I named something wrong. I'm pretty far out of my depth on this one.

This time it's something to do with the EMCO console being labeled incorrectly, isn't it?

[ LUA ] - object: <Chat Parser> function:<Trigger188>
<[string "Trigger: Chat Parser"]:14: attempt to index global 'chat_channel' (a nil
value)>

User avatar
demonnic
Posts: 883
Joined: Sat Dec 05, 2009 3:19 pm

Re: Yes, I know I'm a mess.

Post by demonnic »

That looks like maybe you typoed chat_channels by leaving the s off?

Aydein
Posts: 27
Joined: Wed Sep 13, 2017 8:45 pm

Re: Yes, I know I'm a mess.

Post by Aydein »

I feel like an idiot for not catching that. I did that and it seems to be working, but..

Sadly, I'm still getting this error every time my trigger fires and I'm wondering if this is going to cause issues. Is there something wrong with the section below? I numbered the lines so you could see what I'm seeing. Should I even have the chatcon:appendBuffer() on line 14?

[ LUA ] - object: <Chat Parser> function:<Trigger188>
<[string "Trigger: Chat Parser"]:15: attempt to call method 'appendBuffer' (a nil
value)>

Code: Select all

10 if not ignoret then
11  selectString(line,1)
12  copy()
13   chatcon:append(chat_channels.last)
14  chatcon:appendBuffer()
15 end

User avatar
demonnic
Posts: 883
Joined: Sat Dec 05, 2009 3:19 pm

Re: Yes, I know I'm a mess.

Post by demonnic »

Just remove the chatcon:appendBuffer() , that's what is causing the error.

Aydein
Posts: 27
Joined: Wed Sep 13, 2017 8:45 pm

Re: Yes, I know I'm a mess.

Post by Aydein »

Thank you for all your help. It's all working great now!

Post Reply