View Single Post
06-13-10, 12:22 PM   #5
Ingensu
A Fallenroot Satyr
 
Ingensu's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 22
Originally Posted by Torhal View Post
Unless you're posting your complete code, any advice you receive here will generally be useless - since the gist I garnered is that this is the case, I didn't bother really looking at the logic of your code. I did glance over it, though, and have some general suggestions:

You're using global variables and functions which is not only inefficient but could clash with other AddOns which are similarly coded or even with parts of the default UI.

You are repeatedly asking for the value of the player's GUID, which never changes. Ever. Get this value at the beginning of the file's code block.

You are using GetTime() repeatedly within loops, which are executing so quickly that each call will produce roughly identical values - asking for that data once per function call (when the event occurs) is sufficient.

Thanks for your input. ^^ I've been out of the modding scene for about a year and a half, so I'm a little rusty.


Originally Posted by v6o View Post
Also, your suspicion is correct, you should be delaying the playerguid = UnitGUID("player") part until you're ingame.

To make it more clear

Startup/No event = nil
ADDON_LOADED = nil
VARIABLES_LOADED = nil
PLAYER_LOGIN = 0x060000000331C874
PLAYER_ENTERING_WORLD = 0x060000000331C874
Alright, I thought so. ^^

Thanks so much, guys! I should be able to polish this puppy up and maybe upload it if anyone has any interest in it. :3 As I said, I haven't modded in a long time, so I'm really thankful for your help.
__________________
Devī - Level 85 Beast Mastery hunter.
Devikins - Level 85 Feral (Bear) druid.
Aetheriel - Level 85 Restoration shaman.
US - Stormrage
Goal: Level and gear one of every class. (2.5/10)
  Reply With Quote