Hi. Need help with making a trigger which will match to my target.
I eventually managed to make an alias using ..target.. but can't figure out how to match it in a trigger.
For example?
You suddenly perceive the vague outline of an aura of rebounding around target.
Thanks
0
Comments
Perl regex pattern: ^You suddenly perceive the vague outline of an aura of rebounding around (\w+)\.$
Code:
if matches[2] == target:title() then
-- some code
end
Results of disembowel testing | Knight limb counter | GMCP AB files
send ("shoot " ..target.. " sw", true)
if not wieldingbow then
sendAll ("unwield scimitar", "unwield scimitar", "wield bow", true)
send ("shoot " ..target.. " sw", true)
else
send ("shoot " ..target.. " sw", true)
end
and got triggers that are just wieldingbow = true/false when wielded or unwield.
However does not work just tryed wielding either way.
Thanks
PS I am trying to do this first for ages and still can't get it not coded since zmud/cmud and that was alot easier
Results of disembowel testing | Knight limb counter | GMCP AB files
Your right it didn't help the coding but less spammy. Thanks
It depends on the value of target, but probably the difference between it being all lowercase and it being the right case to match the trigger text.
If you have an alias with the pattern "^t (\w+)$" and the code "target = matches[2]", you're probably going to call it by typing in "t antonius" (who bothers with capitalisation when they're targetting people in a raid?). That means the target variable will have the value "antonius". Lua's string matching is case-sensitive, so "Antonius" (from the trigger) isn't equal to "antonius" (from the variable), and wouldn't match. The title() function will force the string to "title-case", which essentially just means it capitalises the first character (it doesn't do anything to the rest).
You're better off changing your targetting alias to do "target = matches[2]:title()", since then the variable always has the correct case, and any code you write that compares it to trigger text will work without needing to call :title() every time.
Results of disembowel testing | Knight limb counter | GMCP AB files
Thanks
Results of disembowel testing | Knight limb counter | GMCP AB files
Results of disembowel testing | Knight limb counter | GMCP AB files
And you won't understand the cause of your grief...
...But you'll always follow the voices beneath.
and a corresponding trigger that replaces "$mt" with the target, pattern is
^(.*) \$mt
I have a few triggers and gui links that set that mt variable as well, but most of the time its just "t pygmy", "drawslash $mt", etc.
enableKey("bla bla")
enableAlias("bla bla")