• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Question - Chat channel TLO's?

Joined
Jun 19, 2007
RedCents
254¢
I am looking for a TLO or some other method of telling if I belong to a specific chat channel. Went through all the information I could find on TLO's and not really seeing anything that could help. My goal is to create an event that will trigger if I have joined NewPlayers chat channel and fire off a /leave NewPlayers command but so far everything I have tried does not work. Anyone know of a TLO or other mechanism I could use for this?
 
Solution
I am unfamiliar with the zoned.cfg. I guess I will go do some research on that method.

you create a "zoned.cfg" file in your macroquest folder (special care that you didn't create a zoned.cfg.txt file)
inside that file you put something like

Code:
/leave all

due to the nature of eq, and its chat server sometimes being slow / delayed I would probably have a generous timed value in there

Code:
/timed 200 /leave all
I am looking for a TLO or some other method of telling if I belong to a specific chat channel. Went through all the information I could find on TLO's and not really seeing anything that could help. My goal is to create an event that will trigger if I have joined NewPlayers chat channel and fire off a /leave NewPlayers command but so far everything I have tried does not work. Anyone know of a TLO or other mechanism I could use for this?
Probably have to /channellist and then parse the info
 
NewPlayers chat channel
If its only New Players channel, you only auto join it if under level 20 and if join General chat is checked in Options. If above level 20, you can manually join, but will never autojoin unless you use the /autojoin command. Is it any other channels?
1757717672521.png
 
F2P only get newplayers chat but they can still leave it. But may as well just turn off the chat all together.

I think some of the others go funky, like the planes one, and the class one. I thought I remember trying to take those off auto join and they looked removed but they still popped up when channels fill or just go wonkers.
 
If its only New Players channel, you only auto join it if under level 20 and if join General chat is checked in Options. If above level 20, you can manually join, but will never autojoin unless you use the /autojoin command. Is it any other channels?
View attachment 71842
Unfortunately, several of my accounts are F2P and all max'd at lvl 120 right now. Even with autojoin general chat channels turned off, they get added to the newplayers channel every time I change zones. While I can manually leave the channel, it just happens again when zoning which is why I was looking for a way to do something with possibly mq2events/mq2react if possible. It's not that big of a problem, just annoying enough to make me want to find a way to deal with it.
 
This turned out to be a bigger problem than I envisioned and every time I tried something new, I kept hitting a brick wall. Suffice it to say, I ended up having to resort to old school tailing a logfile to get it working. Not my best work, but it does what I wanted. Of course, this method could cause a slight delay on startup if your eqlog file is not trimmed as it has to parse the last 300 lines of the log in order to work and depending on the size of the file, that can take a minute. I would suggest rotating/deleting your eqlog files on a semi-regular basis.

[CODE lang="Lua" title="LeaveChannel.Lua"]-----------------------------------
-- name: LeaveChannel
-- version: 1.5
-- Tail the EverQuest eqlog file and auto-leave channels when they appear in the log.
-----------------------------------

local mq = require("mq")

-- ===== CONFIG =====
-- Path to your eqlog file. Set this to your actual file.
-- Example windows path (use double backslashes) :
-- eqlogPath = "C:\\Users\\JoeCool\\Documents\\EverQuest\\eqlog_JoeCool_bristle.txt"
local eqlogPath = "" -- <-- PUT YOUR PATH HERE

-- Channels you want to automatically leave when detected in the log
local channelsToLeave = {"NewPlayers"}

local debug = true -- set false to silence debug /echos
local startup_scan_lines = 300 -- how many lines to scan on startup
local tail_sleep_ms = 200 -- how long to wait when at EOF
local leave_debounce_sec = 3 -- do not attempt to leave same channel more than once in this many seconds

-- ===== internal state =====
local lastLeaveTimes = {} -- [channel] = os.time()

-- debug helper
local function debugEcho(fmt, ...)
if not debug then return end
if select('#', ...) > 0 then
mq.cmdf('/echo [LeaveChannelLog] ' .. fmt, ...)
else
mq.cmdf('/echo [LeaveChannelLog] %s', fmt)
end
end

-- check file exists
local function file_exists(path)
local f = io.open(path, "r")
if f then f:close(); return true end
return false
end

-- read last N lines from file (simple circular buffer)
local function read_last_lines(path, maxlines)
local t = {}
local f, err = io.open(path, "r")
if not f then return t end
for line in f:lines() do
t[#t+1] = line
if #t > maxlines then table.remove(t, 1) end
end
f:close()
return t
end

-- open file for tailing and seek to end
local function open_tail(path)
local f, err = io.open(path, "r")
if not f then return nil, err end
-- move to EOF
f:seek("end")
return f
end

local function canLeaveNow(channel)
local now = os.time()
local last = lastLeaveTimes[channel] or 0
if now - last < leave_debounce_sec then
return false
end
lastLeaveTimes[channel] = now
return true
end

local function doLeave(channel)
if not canLeaveNow(channel) then
debugEcho("Debounced leave for %s (recently left)", channel)
return
end
debugEcho("Leaving channel: %s", channel)
mq.cmdf("/leave %s", channel) -- /leave and /chat leave are equivalent for you
mq.cmdf("/echo Left channel: %s", channel)
end

-- process a single log line and look for channel join/listing lines
local function process_line(line)
if not line then return end
local l = string.lower(line)

-- match 'Channels:' lines (example user provided: "Channels: 1=NewPlayers")
if string.find(l, "channels:") then
for _, ch in ipairs(channelsToLeave) do
if string.find(l, string.lower(ch), 1, true) then
debugEcho("Detected channel token in 'Channels:' line: %s", line)
doLeave(ch)
end
end
return
end

-- also match lines like "Channel NewPlayers(195) members:" which you said appears in /list
for _, ch in ipairs(channelsToLeave) do
local pattern = "channel%s+" .. string.lower(ch) -- "channel newplayers"
if string.find(l, pattern) then
debugEcho("Detected channel listing line: %s", line)
doLeave(ch)
return
end
end
end

-- startup scan: read last lines and process them (covers cases where you already joined before script start)
local function startup_scan()
if not file_exists(eqlogPath) then
debugEcho("eqlog file not found at '%s'. Please set eqlogPath in the script.", tostring(eqlogPath))
return
end
debugEcho("Performing startup scan (last %d lines) of %s", startup_scan_lines, eqlogPath)
local lines = read_last_lines(eqlogPath, startup_scan_lines)
for _, line in ipairs(lines) do
process_line(line)
end
end

-- tail loop: continuously read appended lines
local function tail_loop()
local f, err = open_tail(eqlogPath)
if not f then
debugEcho("Failed to open eqlog for tailing: %s", tostring(err))
return
end

debugEcho("Tailing eqlog: %s", eqlogPath)

while true do
local line = f:read("*l")
if line then
process_line(line)
else
-- at EOF: detect truncation/rotation
local ok, curPos = pcall(function() return f:seek() end)
if not ok or not curPos then
-- file handle probably invalid; attempt reopen
debugEcho("File handle invalid; reopening log")
f:close()
mq.delay(500)
f, err = open_tail(eqlogPath)
if not f then
debugEcho("Reopen failed: %s; will retry", tostring(err))
mq.delay(1000)
end
else
-- get end pos
local ok2, endPos = pcall(function() return f:seek("end") end)
if ok2 and endPos and endPos < curPos then
-- truncated/rotated
debugEcho("Log truncated/rotated; reopening")
f:close()
mq.delay(500)
f, err = open_tail(eqlogPath)
if not f then
debugEcho("Reopen failed: %s; will retry", tostring(err))
mq.delay(1000)
end
else
-- restore pointer
pcall(function() f:seek("set", curPos) end)
mq.delay(tail_sleep_ms)
end
end
end
end
end

-- ===== main =====
if not eqlogPath or eqlogPath == "" then
debugEcho("eqlogPath is empty. Edit the script and set eqlogPath to your eqlog_<char>_<server>.txt file.")
return
end

-- startup: scan, then start background tailing loop
startup_scan()

-- run tail_loop in the main loop so MQ yields and you can still stop script
local ok, err = pcall(function() tail_loop() end)
if not ok then
debugEcho("Tail loop exited with error: %s", tostring(err))
end

-- fallback keepalive (should never reach here)
while true do
mq.delay(1000)
end
[/CODE]
 
just curious, what roadblock did you hit trying to use mq events?
So when I tried using mq2events, it would never fire off after zoning and being re-joined to the prison chat channel no matter how I tried (@Sic including /leave all). I tried catching "You have entered" for each time I zoned as well as "Channels: 1=NewPlayers". Then I switched to trying to catch output from /list NewPlayers to either be a positive or negative, i.e. "You are not on" and "Channel NewPlayers". Nothing I tried would actually trigger an event for some reason.

This is an example of the event trigger I was trying.
[CODE title="event snippet"][LeaveNewPlayers]
# When this text shows up, run the command
Text=You have entered
Command=/leave all[/CODE]
 
So when I tried using mq2events, it would never fire off after zoning and being re-joined to the prison chat channel no matter how I tried (@Sic including /leave all). I tried catching "You have entered" for each time I zoned as well as "Channels: 1=NewPlayers". Then I switched to trying to catch output from /list NewPlayers to either be a positive or negative, i.e. "You are not on" and "Channel NewPlayers". Nothing I tried would actually trigger an event for some reason.

This is an example of the event trigger I was trying.
[CODE title="event snippet"][LeaveNewPlayers]
# When this text shows up, run the command
Text=You have entered
Command=/leave all[/CODE]
Not sure if helpful or you have it resolved, two pieces of info there.
https://forums.daybreakgames.com/eq...-i-quit-the-autojoin-default-channels.284548/
 
yes... because you are forced to join it everytime you zone if you are F2P
Ah, sounds like the only way around it is to pay for a subscription. Then you can leave it and never see it. Or filter to a separate chat window and minimize it off to the side. Never noticed that much going on in that channel.

Good luck!
 
I am unfamiliar with the zoned.cfg. I guess I will go do some research on that method.

you create a "zoned.cfg" file in your macroquest folder (special care that you didn't create a zoned.cfg.txt file)
inside that file you put something like

Code:
/leave all

due to the nature of eq, and its chat server sometimes being slow / delayed I would probably have a generous timed value in there

Code:
/timed 200 /leave all
 
Solution
Question - Chat channel TLO's?

Users who are viewing this thread

Back
Top
Cart