This target list table that I created
This is the trigger that tries to match the values in the target list table with the line but is unsuccessful:
I'm relatively new for such things. I've worked on this a lot, but it hasn't worked. Is there something I missed or a mistake I've made?
<triggers>
<trigger
enabled="y"
ignore_case="y"
match="^\(Party\): You say, "Target Order: (.*)"$"
regexp="y"
send_to="12"
sequence="100"
>
<send>-- Declare target_list globally
target_list = {}
-- Debugging output to check the captured line
local line = GetLineInfo(GetLinesInBufferCount(), 1)
Note("Captured line: " .. line)
-- Match and clean up the target order
local targets_line = string.match(line, 'Target Order:%s*(.+)')
if targets_line then
Note("Matched targets line: " .. targets_line)
-- Process each target in the line
for target in string.gmatch(targets_line, "([^,]+)") do
target = target:gsub("^%s+", ""):gsub("%s+$", ""):gsub("[^%w%s]", "") -- Trim and clean target
Note("Found target: " .. target)
table.insert(target_list, target)
end
-- Check if the target list was populated
if #target_list > 0 then
for i, target in ipairs(target_list) do
Note("Target " .. i .. ": " .. target)
end
else
Note("Target list is empty.")
end
else
Note("No match found for target order.")
end</send>
</trigger>
</triggers>This is the trigger that tries to match the values in the target list table with the line but is unsuccessful:
<triggers>
<trigger
enabled="y"
group="Multi Line"
ignore_case="y"
lines_to_match="2"
match="^You see the following people here:\n(.+)$"
multi_line="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>
-- Capture the line listing people in the room
local line = GetLineInfo(GetLinesInBufferCount(), 1)
Note("Captured line: " .. line)
-- Match and extract the people in the room
local names_line = string.match(line, "You see the following people here:%s*(.*)")
if names_line then
Note("Matched names line: " .. names_line)
-- Iterate through the target_list and check if any target is in names_line
for _, target in ipairs(target_list) do
-- Use pattern matching to check if the target name exists in the names_line
if string.find(names_line, "%f[%a]" .. target .. "%f[%A]") then
Send("PT Target: " .. target)
Note("Target found and command sent: " .. target)
break -- Stop after the first match
end
end
else
Note("No names found in the line.")
end</send>
</trigger>
</triggers>I'm relatively new for such things. I've worked on this a lot, but it hasn't worked. Is there something I missed or a mistake I've made?