My situation is as follows:
I have multiple nearly identical lines, with different colors. I want to grab the first instance of a particular text color (white). For example:
inventory:
a small chest (text color = black)
a big chest (text color = white)
a chest (text color = black)
a chest (text color = white)
I would like to automatically generate the output "open 2.chest" based on these lines.
I have written a trigger that matches on chest, and calls the Lua Script, which tells me the color of the text. Unfortunately, I don't know how to expand this logic to generate the relative position so this might not be the right strategy. I would also prefer not to use multi-line triggers either if possible because I found that they interfere with other triggers sometimes.
Thanks!
function GetFirstColoredItem(name, line, wildcards, styles)
local firstStyle = styles[1]
local textColor = firstStyle.textcolour
end
I have multiple nearly identical lines, with different colors. I want to grab the first instance of a particular text color (white). For example:
inventory:
a small chest (text color = black)
a big chest (text color = white)
a chest (text color = black)
a chest (text color = white)
I would like to automatically generate the output "open 2.chest" based on these lines.
I have written a trigger that matches on chest, and calls the Lua Script, which tells me the color of the text. Unfortunately, I don't know how to expand this logic to generate the relative position so this might not be the right strategy. I would also prefer not to use multi-line triggers either if possible because I found that they interfere with other triggers sometimes.
Thanks!
function GetFirstColoredItem(name, line, wildcards, styles)
local firstStyle = styles[1]
local textColor = firstStyle.textcolour
end