Game text: "A room with a grinning revenant, a fragile-looking revenant, two large revenants and a dried-out revenant."
I'd like to be able to get a count of the number of revenants and have it replace that long sentence with one simple text "5 revenants".
The game can have one, two, three, up to 6 of a mob with different descriptions.
I've been reading the boards and it seems Lua gmatch is the way to go, but I can't work it out with my very basic understanding of triggers.
I guess I would set a trigger to capture the text 'A room with', but not sure what else needs to be done.
Thanks!
Edit: okay I have this so far. Triggers on "^A room with (.+)"
I just need to figure out how to add to the count when it has the text 2 revenants or 3 revenants.
Adding this:
doesn't seem to work. It seems capturing 'revenant' in 'revenants' counts as 1
Changed it to this and it works now:
I'd like to be able to get a count of the number of revenants and have it replace that long sentence with one simple text "5 revenants".
The game can have one, two, three, up to 6 of a mob with different descriptions.
I've been reading the boards and it seems Lua gmatch is the way to go, but I can't work it out with my very basic understanding of triggers.
I guess I would set a trigger to capture the text 'A room with', but not sure what else needs to be done.
Thanks!
Edit: okay I have this so far. Triggers on "^A room with (.+)"
Revsroom = "%1"
local count = 0
for word in string.gmatch (Revsroom, "revenant") do
count = count +1
end
Note (count.." revenants") I just need to figure out how to add to the count when it has the text 2 revenants or 3 revenants.
Adding this:
for word in string.gmatch (Revsroom, "two revenants") do
count = count +2
end Changed it to this and it works now:
for word in string.gmatch (Revsroom, "two") do
count = count +1
end