Also, when I type /sk to open my config window, I notice that it opens to its own dialog and not the wow interface options window with the addons tab. This was accidental (other addons seem to open to that addons tab with their addon selected) but now that I've seen it, I prefer it. However, I want to get rid of the status bar at the bottom or at least put something of use into it. How can I do that?
I've given it a try, and gotten it to work somewhat. Are there any formatting wildcards or attributes you can set so that the texture is horizontally centered in the frame?
Allow me to rephrase the question. I knew about that code when I asked my original question...what I meant to ask was where does this code belong in the addon? In the OnInitialize?
Thanks Xinhuan for the detailed reply. It looks as if your code examples essentially replace AceTimer. Is this correct? Also, why should a developer chose to use this vs AceTimer or vice versa? I know Torhal said AceTimer is "smartly throttled", so wouldn't that be the better choice?
Question for example 1: How does it know the unit of measure is seconds? It appears that it would increment self.elapsed to 5 through just 5 OnUpdate() runs. If I understand correctly, OnUpdate is run as fast as the user's framerate. This means the user would have to have 5 fps in order to get 5 seconds...I'm probably wrong in here somewhere though...
Finally, how would I use this code to show a count down to 0 from whatever the max time is (in this case, 5 seconds.)?
I've played around with it and tried some form of delay and was only quasi successful using AceTimer. I was in a bit of a rush to get to work so I didn't have time to really troubleshoot why the delay wasn't working. I can say that I have determined the issue was indeed that my code was firing before I got into trade.
How would you go about implementing the delay?
Another similar question: My code needs to be fired when the user joins trade (in the case of when they leave trade and join it again manually) and when they login, but not both (that is, not fired twice). It seems that if I use CHAT_MSG_CHANNEL_NOTICE, the code isn't fired on login, but it is fired when I leave the city and come back.
Edit: I currently have this code (and about a thousand others lines of code) set to run as soon as I enter a capital city via having registered it for the ZONE_CHANGED_NEW_AREA event. This is the last function in that 1000 lines of code that is being run as a result of the zone change event.
Could it be possible that all 1000 lines of code are being fired and finished before WoW has managed to get my client joined into the Trade channel? If so, how could I implement a pause?
function SK:SendMesssage(CHANNEL, TEXT)
D("Begin SendMessage")
if SK.db.profile.Messager.DEBUG_MODE then
D("Successfully sending message. Message would have been:")
D(TEXT.." Sent to channel "..CHANNEL)
else
D("Debug mode off. Sending message: "..TEXT)
SendChatMessage("This is just a test. Please ignore.",'CHANNEL',nil,CHANNEL)
end
D("End SendMessage. YAY! It was a success.")
end
Same results.
function SK:SendMesssage(CHANNEL, TEXT)
D("Begin SendMessage")
if SK.db.profile.Messager.DEBUG_MODE then
D("Successfully sending message. Message would have been:")
D(TEXT.." Sent to channel "..CHANNEL)
else
D("Debug mode off. Sending message: "..TEXT)
SendChatMessage("This is just a test. Please ignore.",'CHANNEL',nil,2)end
D("End SendMessage. YAY! It was a success.")
end
function SK:SendMesssage(CHANNEL, TEXT)
D("Begin SendMessage")
if SK.db.profile.Messager.DEBUG_MODE then
D("Successfully sending message. Message would have been:")
D(TEXT.." Sent to channel "..CHANNEL)
else
D("Debug mode off. Sending message: "..TEXT)
SendChatMessage(TEXT,'CHANNEL',nil,CHANNEL)
end
D("End SendMessage. YAY! It was a success.")
end
The code finishes all the way to completion without throwing an error. However, it's not working properly.
If the channel I pass in is the ChannelID for trade, then it will only send the message the first time this function is called. All subsequent calls finish but nothing is ever sent to trade.
If the channel I pass in is the ChannelID for general, then it will send the message every time this function is called.
Any ideas why? If you need more code than this, I will post it; just ask. I cannot for the life of me figure out why messages to trade are being ignored after the first message.
P.S. Hard-coding the channel numbers into it also yields the same effect...
I've created an icon for my addon. I noticed another addon I have attempting to use an icon as well (flight hud). However, neither my addon nor FlightHud actually show an icon in the options screen...where does this icon end up being displayed?
local CONFIG_TABLE = {
type='group',
name = "SK",
desc = "Description",
icon = [[Interface\Addons\SK\graphics\icon]],
args = {
Well, truth be told, I've read every line of documentation on Ace in the Pages section of the project. However, reading it when you're learning it doesn't necessarily equate to remembering everything you read, especially when you don't fully comprehend everything.
But, as you suggest, I have and continue to reread. Each time, I begin to understand and remember bit by bit. (Pun intended...) And actually, re-reading it is usually the cause of my questions. I like to understand things as fully as I can, so questions are inevitable.
local start_time = GetTime()
function Whatever()
return GetTime() - start_time
end
It seems like it should be obvious how this relates to the countdown feature I'm wanting to implement, but it just isn't clicking. No lightbulbs are going off over my thick head...:confused:
Well, I looked up GetTime() in the WowWiki API page. As it states, it gets time in seconds since boot. Not sure how I would use GetTime() to implement what I need...Is your hint indicating I should A.) not use AceTimer and use GetTime() instead for both the repeating code and countdown., B) suggesting I use GetTime() for the countdown feature implemented in some way using OnUpdate() and still use AceTimer for repeating code, or C) none of the above?
Didn't think you'd be taking a test today, did you? ;-P
Okay. You're saying that by default, AceDB will create a character "profile" for me as I'd like, but then allow the user to select/setup a profile. This means AceDB by default, does what I was looking for. Correct?
So, I should use profile when getting and setting values. But what about the AceDB default options table? If I am understanding correctly, I need to set default values for both .char and .profile?
0
0
Edit:
I've given it a try, and gotten it to work somewhat. Are there any formatting wildcards or attributes you can set so that the texture is horizontally centered in the frame?
0
0
Question for example 1: How does it know the unit of measure is seconds? It appears that it would increment self.elapsed to 5 through just 5 OnUpdate() runs. If I understand correctly, OnUpdate is run as fast as the user's framerate. This means the user would have to have 5 fps in order to get 5 seconds...I'm probably wrong in here somewhere though...
Finally, how would I use this code to show a count down to 0 from whatever the max time is (in this case, 5 seconds.)?
0
I've played around with it and tried some form of delay and was only quasi successful using AceTimer. I was in a bit of a rush to get to work so I didn't have time to really troubleshoot why the delay wasn't working. I can say that I have determined the issue was indeed that my code was firing before I got into trade.
How would you go about implementing the delay?
Another similar question: My code needs to be fired when the user joins trade (in the case of when they leave trade and join it again manually) and when they login, but not both (that is, not fired twice). It seems that if I use CHAT_MSG_CHANNEL_NOTICE, the code isn't fired on login, but it is fired when I leave the city and come back.
0
0
0
Could it be possible that all 1000 lines of code are being fired and finished before WoW has managed to get my client joined into the Trade channel? If so, how could I implement a pause?
0
Same results.
Same results.
Works in the chat frame as it always has...
0
The code finishes all the way to completion without throwing an error. However, it's not working properly.
If the channel I pass in is the ChannelID for trade, then it will only send the message the first time this function is called. All subsequent calls finish but nothing is ever sent to trade.
If the channel I pass in is the ChannelID for general, then it will send the message every time this function is called.
Any ideas why? If you need more code than this, I will post it; just ask. I cannot for the life of me figure out why messages to trade are being ignored after the first message.
P.S. Hard-coding the channel numbers into it also yields the same effect...
0
The icon is named icon.tga.
0
But, as you suggest, I have and continue to reread. Each time, I begin to understand and remember bit by bit. (Pun intended...) And actually, re-reading it is usually the cause of my questions. I like to understand things as fully as I can, so questions are inevitable.
0
It seems like it should be obvious how this relates to the countdown feature I'm wanting to implement, but it just isn't clicking. No lightbulbs are going off over my thick head...:confused:
0
Didn't think you'd be taking a test today, did you? ;-P
0
So, I should use profile when getting and setting values. But what about the AceDB default options table? If I am understanding correctly, I need to set default values for both .char and .profile?
Like that?