So I'm Still getting errors with boss frames,
So I was wondering would this be the correct way to adjust the scale of a boss frame? Code:
local BossFrame = CreateFrame("Frame"); Thanks Coke |
Boss frames, like all unit frames, are secure. You cannot change their scale, size, position, visibility, or many other properties while in combat. Since your code does not check whether you're in combat when you try to change the scale, you will get "action blocked" errors every time the boss list changes in combat.
However, I'm not really sure why you're even listening for that event... I haven't looked at the Blizzard code, but I'd wager actual money that they never call SetScale on the boss frames, or any other unit frames, so you don't need to keep re-setting the scale over and over. Just do it once when your addon loads. |
Quote:
|
Quote:
Quote:
1st) Am I doing the coding correctly? 2nd) Should I look for a different event or should the code be in a hooksecure? And thanks for the quick replies. Also I'm working on rewiting the unitframes.lua of my addon and so far this is what I have... http://pastebin.com/Z6BuyStU Coke |
OnLoad functions are called at the same time the frame is created, so the end result is the same -- the scale of the frames is never changed after the frames are created, and the frames are already created before the game starts loading any addons, so just change the scale immediately when your addon is read. You don't need to listen for any special events at all.
However, since you do need to wait for your saved variables to load, you should make sure you're not logging in in combat before attempting to do anything secure. To avoid having to split up your code or add a bunch of extra checks, and since you're just tweaking, not creating new frames or anything else critical, I'd suggest just delaying the whole thing in that case, eg. Code:
function MyAddon:OnEnable() http://pastebin.com/f1DKpNeG |
Quote:
For some reason im getting a error with the "for" in the arena part of the Module.UnitFunctions could this be because the arena frams are not loaded at the start of the game? If I --[[ ]] the arena code all is good. Here is the error: Code:
1x BasicUI-5.4.7\Modules\Unitframes.lua:174: "for" limit must be a number |
Nothing related to the arena frames is available until Blizzard_ArenaUI is loaded. I can confirm that it does not become loaded upon normal log-in circumstances.
You need to execute the relevant code once Blizzard_ArenaUI has been loaded; listening to ADDON_LOADED can provide you with that information. Phanx has much more time invested into your code, I'd rather let her deal with refactoring it to allow for the circumstance. Edit: The reasoning behind the error is that your for limit, MAX_ARENA_ENEMIES, is a nil value. |
http://pastebin.com/Lxh5k5RX
This should handle the arena issue, as well as any future issues if you decided to add support for, say, compact raid frames in here. |
Quote:
Tonight ill try a boss encounter and a arena event to make sure. Now beings everything is in the OnEnable function, how would I use that for my options just point to the OnEnable as the function for set? So that the user doesnt have to do a reloadui. Or is that just opening another bag of worms? Again thanks for all the help, I wish there was something I could do to return all the help you have given me, and all the future help im sure i will need... ;-) Coke |
http://pastebin.com/YD7jiW51
Call the ApplySettings method from your options, eg. Code:
local Core = LibStub("AceAddon-3.0"):GetAddon("BasicUI") |
Quote:
Coke |
One last question on unitframes...
With the new way of calling the party and boss frames in a function and beings they are load on demand (I think) frames would I now be able to add a SetPoint() to them in there current state without getting a sucure frame error? Reason I ask (I did notice in one of your other threads you suggested a option to hide the quest tracker) beings have adjusted the scale of the party and boss frames they are now overlapping other frames and it looks tacky. On any toon that has a "powerbar" and a pet for example a Warnock the first party members name is under the pet frame. So as I stated I would like to ad a SetPoint() but last time I tried this it completely hid the raid frames. I'm guessing the reason for this is the pop out window for the raid frames it is attached to the party frames or visa versa. I know a lot of explaining but i would rather let you know the why not just a question. Coke |
Quote:
For party frames, it doesn't look like the default UI moves them after loading, so just adding this should be fine: Code:
PartyMemberFrame1:ClearAllPoints() Code:
local movingBossFrame Both of these should go in the OnEnable function, not in the individual unit frame functions -- those should only contain the code that applies the user's settings, and definitely shouldn't include any hook creation, since you can't remove or replace a secure hook, only add a new one. |
Quote:
Thanks Coke |
Func is just short for function, at least in reference to hooksecurefunc.
K and V typically refer to key and value, for use in iterating over a table with pairs or ipairs. In reality, those variables can be named anything. |
Quote:
Obviously, a variable name like "func" would probably be pointing to a function value, but "name" could be a lot of things (a player name, a frame name, an item name, a guild name, an NPC name, a spell name, etc.). "k" and "v" are normally used in pairs loops to represent the keys and values, respectively: Code:
-- Given this table: Similarly, "i" is commonly used in loops to represent the iteration count: Code:
for i = 1, 10 do Code:
local k, v, i, name, func = GetFriendInfo(1) |
Ok now im starting to see it, as you stated "k" is normal short for "key" and "v" is short for "value" just like I see "f" for "frame".
Now is this normally the standard or do different people use different letters, also would it be beneficial to use different letters not to accidently interact with other peoples functions? In this example: Lua Code:
name = the name of the plugin. constructor = ?? Where did the constructor() function come from? And why is it I see a lot of people do somename = {} I understand the the {} is the start and finish of a table but wouldn't if just be a blank table. Also does the [] around a "name" make it so that it could be any "name" in that table, so instead fo using db.datapanel.dps and db.datapanel.hps, db.datapanel[name] would be able to find both of those name in a shorter text. It was stated before that this is a file not a macro so we should not shorten names because there is no need to save space. If that is the case why do I see a lot of other using short cuts and abbreviated name? Thanks for answering these questions and helping me and maybe others trying to learn this wonderful thing called lua. Coke |
As stated above, k and v are just regular old variables. You could use anything else in their place. This is what has been done with your example. Instead of doing
Lua Code:
Lua Code:
Lua Code:
Lua Code:
|
Forgot to address these:
Quote:
Quote:
Quote:
|
Quote:
Quote:
Coke |
All times are GMT -6. The time now is 08:03 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI