Thread Tools Display Modes
09-06-08, 08:17 PM   #1
kerrang
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2006
Posts: 109
VARIABLES_LOADED - except they're not

I have some code in my addons which is called when VARIABLES_LOADED fires

It relies on SavedVariables - and it seems that on initial login, they are NOT set when VARIABLES_LOADED fires - tho they tend to be on /console reloadui

This is obviously a bug (or that event has a WAY misleading name!)

Where SHOULD I put such code - I only want it executed once at each login (so PLAYER_ENTERING_WORLD is no use) and SavedVariables must be set before it runs

Any ideas?
  Reply With Quote
09-06-08, 08:28 PM   #2
Tristanian
Andúril
Premium Member
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 279
I don't really understand why VARIABLES_LOADED doesn't work for you, it should ensure that all non-lod addons have finished loading and their savedvars are availaible. The only other option, is PLAYER_LOGIN I guess (if you don't want to use PLAYER_ENTERING_WORLD).
  Reply With Quote
09-06-08, 10:22 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
why is PEW of no use?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-06-08, 11:02 PM   #4
VincentSDSH
Non-Canadian Luzer!
 
VincentSDSH's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 350
Originally Posted by Seerah View Post
why is PEW of no use?
Didn't PEW use to be triggered when you zoned? (I know they mucked about with it a few years ago, can't recall how it's triggered now)

One trick you might explore is to have VAR_LOADED call a delay timer (aka single-execute Metrognome event) or, as I do with mods that have to bootstrap when not in combat, have it check for your vars and, if not found, set up the delay and immediately exit. The function Metrognome could trigger would be the bootstrap for your mod.
  Reply With Quote
09-06-08, 11:26 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Ah yes, it does (had forgotten about that). PLAYER_LOGIN is your other option.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-07-08, 02:14 PM   #6
kerrang
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2006
Posts: 109
I've been playing with this (whilst watching the Warhammer forums and laughing a lot - but that's another story) and it seems that (on live and BETA)

PEW fires on all zoning (instance/continent/expansion)

PL fires on all zoning EXCEPT instances...

VL is 100% unreliable the first time you login to a character - but is 100% reliable from that point forward (e.g. reloadui)

Another thing I've noticed - which is ever weirder - is that a variable declared and assigned at the highest level in my lua has NO value on the first VARIABLES_LOADED either....

e.g.

MYSTRING = ""
MYTABLE = {"A","B","C")

MYVLFUNC() -- called on VARIABLES_LOADED
for val in pairs(MYTABLE) do
MYSTRING = MYSTRING .. val
end
end

With code like that, the first time I login MYSTRING will be blank - a reloadui and it will be "ABC" - logout and back in and it's blank again and so on...

Something is ROYALLY screwed here???
  Reply With Quote
09-07-08, 04:16 PM   #7
slizen
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 15
Originally Posted by VincentSDSH View Post
Didn't PEW use to be triggered when you zoned? (I know they mucked about with it a few years ago, can't recall how it's triggered now)
Why not use it and then just unregister it when it has run once?
  Reply With Quote
09-08-08, 08:41 AM   #8
VincentSDSH
Non-Canadian Luzer!
 
VincentSDSH's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 350
Originally Posted by slizen View Post
Originally Posted by VincentSDSH
Didn't PEW use to be triggered when you zoned? (I know they mucked about with it a few years ago, can't recall how it's triggered now)
Why not use it and then just unregister it when it has run once?
Try asking the author that question; I was only attempting to relay a possibility as to why the author felt that PEW was unusable.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » VARIABLES_LOADED - except they're not


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off