Changing actionbars attribute in secure env
Hi all,
I had and still have a problem that I post some day ago about trying to scale a ActionBar: https://www.wowinterface.com/forums/...ad.php?t=57047 The problem is still there even if Fizzlemizz and Terenna suggest some changes at the code. I have tried to use someting like: Lua Code:
and I have seen that this bar changes a lot of time during gameplay from scale 0.8 to 1 (probably when the function is called in combat or on some state that make UnitAffectingCombat("player") true. For example I had always an error when exit from "BeachHead" quest of Tortollan Seekers but using the : Lua Code:
there isn't error anymore, even if I have the ActionBar scale = 1 instead of 0.8 it was started the quest with. Now I am here to ask if it is possible to have some clues on how generate a secure enviroment to make changes to UI element during combat or other state that can generate a taint. Thanks so much. |
You'll have to make a secure frame:
Lua Code:
then you'll need to hook your script as above. I think you'll need to set a reference frame for the MultiBarRight inside of the secure frame. So something like: Lua Code:
Then you'll need to securely insert the reference frame into a secure table. Lua Code:
Then you'll execute secure code in your MultiBarRight Hookscript: Lua Code:
I think that will work. IDK, I just learned about secure coding yesterday and I'm probably not great at it. You might be able to skip the multiBarRightSecureTable thing altogether and just use self:GetFrameRef('MultiBarRight'):GetScale() and self:GetFrameRef('MultiBarRight'):SetScale(). I'm not sure, like I said I'm fairly new to this, too. |
Hi Terenna,
thanks for your help again ... I have tried your code but I got an error ... do you have some clues :) ? The code: Lua Code:
The error: Lua Code:
Thanks everyone for attention. |
try replacing your CreateFrame with this: CreateFrame('frame', nil, UIParent, 'SecureHandlerAttributeTemplate')
perhaps it needs a handler rather than an actionbutton |
Hi Terenna,
thanks so much for your reply but I couldn't test it before. It doesn't work either. The code: Lua Code:
The error: Lua Code:
Any ideas ? Thank so much |
You can't use the secureFrame in the snippet, since the snippets are processed in a secure environment, you an use self instead the secureFrame since it's the one called the Execute.
And to run the snippet codes during a script event, you also can't Hook or set the script, you can only do it like Lua Code:
Unfortunately, the OnSizeChanged isn't a script type supported by the wrap script, so you can't do the job through the secure snippets. The MultiBarRight's scale will be reset in MultiActionBar_Update, it's called under several conditions. I can't say it's a good choice to disable it, so you may keep scale it out of combat, or just change the uiparent's scale, or just replace it with an action bar mod. |
create a frame with a SecureFrameTemplate, change the scale of this frame, and MultiBarRight:SetParent(this frame), maybe ?
|
Lua Code:
I have been using this since 8.0, never meet a taint issue. |
Hi,
thanks so much for your answer. I have tried your code and it doesn't give any errors when the player enters world ...and the bars are at 0.8 ... Lua Code:
But when I finish the quest BeachHead (which is vehicle exit) I got: Lua Code:
And the MultiBarRight is to 1.0 scale again (I don't use the MultiBarLeft) The FrameXML\MultiActionBars.lua:85 Lua Code:
I really don't understand why is not possible in an easy way to set scale to a value different from 1 :) P.s. The other thing I don't understand is why if I call this code instead: Lua Code:
which basically do the same thing of the code above it fired a lot of errors like: Lua Code:
|
I'm not sure what's going on, but the reason you're last code causes a stack overflow is because you essentially enter an infinite loop.
You hook into the setscale function, and then SetScale within it. So it just constantly hooks into itself and runs and runs and runs. Thus, you need to have an if self:GetScale() > 0.8 then self:SetScale(0.8) end so it doesn't infinitely run; it only runs until the scale is 0.8. |
Quote:
i see 3 solutions : 1 : you inherit the scale from a secure parent 2 : you can maybe wrap an handler of the blizz code (see SecureHeadersGuide-4.0-r1.pdf) 3 : look into SecureStateDriver.lua if an event is triggered in your case |
All times are GMT -6. The time now is 03:44 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI