Option 'Require Target to use' not functioning
gschoper opened this issue · 11 comments
Under Options/Gameplay Options I have checked 'Require Target to use' yet the macro fires off without a target selected. This happens with all macros.
Also, when trying to prevent the macro from firing with the following code in Keypress:
/stopmacro [@playertarget, noexists]
the /stopmacro
is stripped after a save and /reload and [@playertarget, noexists]
is spammed to chat.
added stopmacro to the list of things that can have conditionals but the Require Target to use command adds that same string to the KeyPress list. It appears Blizzard have changed the implementation of this.
BTW I fixed the having to reload after save.
Installed 207. Require Target to use is still not functioning and when I manually insert the code into KeyPress the whole line gets stripped out. I tested /stopmacro in a standard blizz macro and it functions properly:
/stopmacro [@playertarget, noexists]
/say Hello
works fine.
Somewhere in this, I think the issue is getting occluded.
I haven't dug into the code yet, but somewhere between 1.5.x and the 2.x rewrite the mechanic for either setting the variable for "Require Target to use" in options pane or the (pseudo code, again I haven't actually looked at the LUA)
if RequireTarget && !PlayerTarget then
return
else
<do macro passthrough here>
end;
for checking if the player has a target or not before passing the macro on when that variable is set went a bit wonky.
As it stands as of 2.0.8, the macro will get pushed along regardless of whether that option is enabled or not.
hmm it was in pre and post macro not just post. lookint at that I'll add it to both and see if that makes any difference
Storage.zip
Could you please replace this file into Interface\addons\GSE\API it has the block in both KeyPress and KeyRelease and see how that goes for you?
Will need to extract storage.lua from the zip.
Negative result. Still showing the /stopmacro in the KeyRelease, but not the KeyPress.
Debug Excerpt:
[13:58:42] KeyPress/cast [combat] Avatar
/cast [combat] Battle Cry
[13:58:42] KeyRelease/stopmacro [@playertarget, noexists]
/startattack
/cast Victory Rush
Having a dig into the code now to see if I can track down the culprit for ya.
EDIT: Found the problem in the PrepareKeyPress @ 830
local tab = {}
if GSEOptions.requireTarget then
-- see #20 prevent target hopping
table.insert(tab, "/stopmacro [@playertarget, noexists]")
end
if not GSE.isEmpty(sequence.KeyPress) then
for k,v in pairs(sequence.KeyPress) do
tab[k] = v
end
end
Written this way, if the option for Require Target is set, it gets overwritten by the next loop when you flat set the tab[k] = v
Change to the following corrects the error.
local tab = {}
if GSEOptions.requireTarget then
-- see #20 prevent target hopping
table.insert(tab, "/stopmacro [@playertarget, noexists]")
end
if not GSE.isEmpty(sequence.KeyPress) then
for k,v in pairs(sequence.KeyPress) do
table.insert(tab, v)
end
end