View Single Post
01-14-13, 11:56 AM   #13
Sieben11
A Deviate Faerie Dragon
Join Date: Jan 2009
Posts: 10
Originally Posted by Phanx View Post
1) If you're going to post code, post the entire code. Your snippets are obviously incomplete, as they refer to variables -- such as self and buffs -- that are not defined in anything you posted, and appear to be responding to events that are not registered. Especially when you're trying to help someone who says they've never written Lua before, posting only random snippets is more confusing than helpful.

2) You shouldn't use UNIT_AURA to detect shapeshift forms on the player. There is a dedicated event for that -- UPDATE_SHAPESHIFT_FORM.

3) Things like "ex" are not good choices for variable names. Addons are not macros; you don't need to condense everything to save space. Use a descriptive variable name like "expirationTime" that clearly describes its contents without needing to read the whole function to figure it out.

4) You should never call RunScript in an addon. Just write the code you want to run.

5) You should never specify a specific language with SendChatMessage -- like "Common" -- unless you have a specific purpose for doing so (such as in a role-playing addon) and you are checking the player's faction to pass the appropriate language. Your code, for example, will fail for Horde players, since they cannot speak Common. Instead, you should pass nil, which will cause the message to be sent in the player's default language.
1) Sorry for that, did think I was being helpful. =/

2) UNIT_AURA is a constant thing my add-on looks for, so figured why not use it there. Maybe one the less understood changes. Though it'll be examining many different druid related types. It just picks out form types from buffs. And compares it against the stored. If they are not the same, to updating it with the new seen form. Maybe a bit backwards. Then if humanoid checks are the only thing passed into UPDATE_SHAPESHIFT_FORM.

3) I usually use simple names mainly for myself. I have used myriads of shorthand, used to in the military and college. Its my own shorthand that I understand. Though if I want others to understand maybe should write it out.

4) Saw that error, thanks.

5) Thanks for the information on Common. It is a RP add-on. Will use nil as suggested.

Last edited by Sieben11 : 01-14-13 at 12:04 PM.
  Reply With Quote