Target Condition

Post Reply
Entchen
Posts: 5
Joined: Fri Oct 16, 2015 9:43 am

Target Condition

Post by Entchen »

Hello,

i have created a miniconsole named "target",
now i want to send the condition of my current target to this miniconsole.

For that
i triggered the current Target and set a variable
regex trigger: You are now targetting (.*).
target = matches[2]

i highlited it successfully:
if id then killTrigger(id) end
if dea then killTrigger(dea) end
id = tempTrigger(id, [[selectString("]] .. target .. [[", 1) fg("gold") resetFormat()]])
dea = target:title()
dea = tempTrigger(dea, [[selectString("]] .. target .. [[ is DEAD, R.I.P." , 1) fg("gold") resetFormat()]])


Now i like to trigger the Condition of the Target,
for example i targetting Hobbit
and in the game there is
Hobbit is in very bad shape (70%).
Mera is in good shape (90%).
Dog is nearly dead (5%).


How can i trigger only the condition of my current target?
(.*)( is )(.*)( \([0-9][0-9]%\)\.)
would match all enemies but i would need
(target)( is )(.*)( \([0-9][0-9]%\)\.)

How i can trigger this AND send this to the Miniconsole?
And how can i enabled this Trigger after my Target is dead?

Would be very gratefully about hints/solutions! :)

Xavious
Posts: 7
Joined: Sat Nov 21, 2015 9:48 pm

Re: Target Condition

Post by Xavious »

I'm kind of new here, but I'm no stranger to setting up these sorts of triggers, so I'll try my best to help.

I used the following string:

Hobbit is in very bad shape (70%).

To come up with this regular expression, which matches at least the 3 examples presented. I don't know what all you are trying to capture, but I know at least the name needed to be compared is captured.

^(.*) is .* \(\d+%\).$

So when this trigger fires you simply run the following code:
Code: [show] | [select all] lua
if matches[2] == target then
     selectCurrentLine()
     copy()
     appendBuffer("<reference of your mini concole>")
end
Next time you are posting code, please use tags man. It makes it a lot easier to read :D. All you have to to is highlight the text that is code and click the "Lua" button at the top of the editor.

Post Reply