Question on "First Use"
Before I start digging around in other mods, I thought I'd toss this out there for anyone that might be bored. Please note, anyone who may respond, that I could -barely- get a chat message to fire <OnLoad>. The notion of saved variables makes me blanch to say the very least. Short version, lua > me. :)
What I would like to do is register DiivSkins such that it will call a function that will call another function from another AddOn (I think?) the first time someone loads my AddOn. (on any character, not character specific) Once that happens, I don't want that function to ever be called again.
I also need the XML call for it to be universal, that is, I just want to paste one <OnLoad> into several frames, and then... use a "( this )" ... I think? I'm not sure.
If anyone out there is at all familiar with DiivsSkins, basically, what this would do is call a MoveAnything! function to default check [Hide] on the "non standard" frames that paste all over the screen on initial start-up. (The ones I use that employ the "UIParent" as a Parent). These frames would then be invisible as "hidden" the first time a player logs into game. After that, I don't want to call that function again, however, or the user would have to go back into the MoveAnything! console before each session and un-check all the "hidden" elements they had previously "un-hid" for their UI set up. No good.
I'll do more homework on this later, I promise. I do know the MoveAnything function I need to call, I just don't know how to properly implement it in DiivSkins to accomplish what I'm after.
I'm headed out the door for work at the moment. I just thought I would toss this out there, as I said, in case anyone is bored enough to patronize the clueless. ;).
Well.. part of the problem that may arise is that many addons need all character data to fire before off and become available before a addon can really use them. So what may work for you is to put a function call in your on update block that looks something like this.
hasran = false;
if(not hasran) then
--I'd recommending checking that MoveAnything is installed, and if it is not
--then hide the frame by another method.
Call function here!
hasran = true;
SavedVariables is really simple. In the .toc, add this line:
## SavedVariables: myvariable
That's all there is to it. The value of myvariable will persist across sessions. How it works is pretty neat:
1. When you log in, each mod's lua gets "run" once.
specifically: from the <Script file="mymod.lua"/> line, WoW runs this file. It doesn't execute functions, but it picks up all version=1.0, stuff=etc that you define outside of functions
2. After the loading chugs a bit, the game "runs" the SavedVariables.lua file.
specifically: open SavedVariables.lua and you'll see a bunch of variable declarations. WoW doesn't "interpret" this file, it just runs it. While logged out, you could edit the file to add your own code and it'd run when you log back in.
3. When the game closes, it deletes SavedVariables.lua, then goes through all addons' .toc files to recreate it.
specifically: It goes through every .toc and if it sees ## SavedVariables (something), then it adds (something) into SavedVariables.lua in a form that can be run the next time a character logs in.
This is why your mod can say:
That's all you need to know, except to remember that SavedVariables.lua is always run just before the VARIABLES_LOADED event. So if you ever want to act on a saved variable at startup, make sure to put it there:
Cleaned all my junk posts out of this thread. ;)
Using the above advice, a future DiivSkins will be much more "friendly" to the first time user. Thank you much for your help folks.
If you are lurking and curious how this all worked out, here's the code.
If you are following along at home, the above is referenced in my XML by this code here:
Gello, Kaelten, Thanks again the help. :)
|All times are GMT -6. The time now is 02:01 PM.|
vBulletin © 2015, Jelsoft Enterprises Ltd
©2012 ZAM Network LLC