Thread Tools Display Modes
01-29-13, 09:57 AM   #1
Nallepuh
A Deviate Faerie Dragon
Join Date: Oct 2010
Posts: 19
Cast timer addon?

Hi, im looking for cast timer that show amount of seconds to cast the spell, im using blizzard standard casting bar and i'm looking for a addon that just add timer to the castingbar! kinda like
http://www.wowinterface.com/download...gBarTimer.html

Thanks!!

Last edited by Nallepuh : 01-29-13 at 10:18 AM.
  Reply With Quote
01-29-13, 10:33 AM   #2
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
http://addon.ziuo.net/

plus

Lua Code:
  1. CastingBarFrame.timer = CastingBarFrame:CreateFontString(nil);
  2. CastingBarFrame.timer:SetFont(STANDARD_TEXT_FONT,12,"OUTLINE");
  3. CastingBarFrame.timer:SetPoint("TOP", CastingBarFrame, "BOTTOM", 0, 0);
  4. CastingBarFrame.update = .1;
  5.  
  6. hooksecurefunc("CastingBarFrame_OnUpdate", function(self, elapsed)
  7.         if not self.timer then return end
  8.         if self.update and self.update < elapsed then
  9.                 if self.casting then
  10.                         self.timer:SetText(format("%2.1f/%1.1f", max(self.maxValue - self.value, 0), self.maxValue))
  11.                 elseif self.channeling then
  12.                         self.timer:SetText(format("%.1f", max(self.value, 0)))
  13.                 else
  14.                         self.timer:SetText("")
  15.                 end
  16.                 self.update = .1
  17.         else
  18.                 self.update = self.update - elapsed
  19.         end
  20. end)

Last edited by Clamsoda : 01-29-13 at 10:35 AM.
  Reply With Quote
01-29-13, 10:35 AM   #3
Nallepuh
A Deviate Faerie Dragon
Join Date: Oct 2010
Posts: 19
Originally Posted by Clamsoda View Post
Lua Code:
  1. CastingBarFrame.timer = CastingBarFrame:CreateFontString(nil);
  2. CastingBarFrame.timer:SetFont(STANDARD_TEXT_FONT,12,"OUTLINE");
  3. CastingBarFrame.timer:SetPoint("TOP", CastingBarFrame, "BOTTOM", 0, 0);
  4. CastingBarFrame.update = .1;
  5.  
  6. hooksecurefunc("CastingBarFrame_OnUpdate", function(self, elapsed)
  7.         if not self.timer then return end
  8.         if self.update and self.update < elapsed then
  9.                 if self.casting then
  10.                         self.timer:SetText(format("%2.1f/%1.1f", max(self.maxValue - self.value, 0), self.maxValue))
  11.                 elseif self.channeling then
  12.                         self.timer:SetText(format("%.1f", max(self.value, 0)))
  13.                 else
  14.                         self.timer:SetText("")
  15.                 end
  16.                 self.update = .1
  17.         else
  18.                 self.update = self.update - elapsed
  19.         end
  20. end)

thank you so much! but i cant get it to work!:S

Last edited by Nallepuh : 01-29-13 at 10:51 AM.
  Reply With Quote
01-29-13, 10:39 AM   #4
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
I edited my original post with a link that allows your to turn scripts into an AddOn. I created the AddOn for you, but I suggest giving the link a go first!
Attached Files
File Type: zip CastBarTimer.zip (689 Bytes, 349 views)

Last edited by Clamsoda : 01-29-13 at 11:36 AM.
  Reply With Quote
01-29-13, 11:01 AM   #5
Nallepuh
A Deviate Faerie Dragon
Join Date: Oct 2010
Posts: 19
Originally Posted by Clamsoda View Post
I edited my original post with a link that allows your to turn scripts into an AddOn. I created the AddOn for you, but I suggest giving the link a go first!
thanks mate, i just copy the lua code and create my addon and give me files and then put the map in addon map, for the link you said, not good at lua that you can see! i can't get the file you u linked me and the LUA code to me working, am i doing something wrong?:S

Last edited by Nallepuh : 01-29-13 at 11:06 AM.
  Reply With Quote
01-29-13, 11:16 AM   #6
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
Well, there are a few possibilities:

I didn't write the code, so it could be non-functioning code. It appears that it would work though =X. My servers are down for two more hours, I can't test that yet.

The websites gives you your AddOn in a .ZIP file. Make sure you extract the folder to your WoW's AddOn folder like any other AddOn you download.

If you are sure you extracted it correctly, and it is appearing in the in-game AddOn list, then I'll test the code here in a few hours and get back to you.
  Reply With Quote
01-29-13, 11:17 AM   #7
Nallepuh
A Deviate Faerie Dragon
Join Date: Oct 2010
Posts: 19
Originally Posted by Clamsoda View Post
Well, there are a few possibilities:

I didn't write the code, so it could be non-functioning code. It appears that it would work though =X. My servers are down for two more hours, I can't test that yet.

The websites gives you your AddOn in a .ZIP file. Make sure you extract the folder to your WoW's AddOn folder like any other AddOn you download.

If you are sure you extracted it correctly, and it is appearing in the in-game AddOn list, then I'll test the code here in a few hours and get back to you.
thanks, it does appear in my addon list!
  Reply With Quote
01-29-13, 11:26 AM   #8
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
You are positive you are using the default casting bar, and that no other AddOn is trying to touch it?

Also, with LUA error reporting enabled, are any errors being produced?

Edit: Soooo, I am an idiot. I named it Blizzard..., and then WoW...yeah...just...I am so stupid. Go back up a few posts and re-download, and re-install. Make sure to delete the old one, which should have ".old" affixed to it.

I just tried it and it works.

Sorry ~.~

Last edited by Clamsoda : 01-29-13 at 11:36 AM.
  Reply With Quote
01-29-13, 11:44 AM   #9
Nallepuh
A Deviate Faerie Dragon
Join Date: Oct 2010
Posts: 19
Originally Posted by Clamsoda View Post
You are positive you are using the default casting bar, and that no other AddOn is trying to touch it?

Also, with LUA error reporting enabled, are any errors being produced?

Edit: Soooo, I am an idiot. I named it Blizzard..., and then WoW...yeah...just...I am so stupid. Go back up a few posts and re-download, and re-install. Make sure to delete the old one, which should have ".old" affixed to it.

I just tried it and it works.

Sorry ~.~
i works, but the cast timer is under the bar itself! i took a screen shot of it!

http://imageshack.us/photo/my-images...913184055.jpg/
  Reply With Quote
01-29-13, 11:51 AM   #10
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
Yeah, I saw that, and it sucks. I'll try to redo it so the spell text is on the left, and the time is on the right.
  Reply With Quote
01-29-13, 11:54 AM   #11
Nallepuh
A Deviate Faerie Dragon
Join Date: Oct 2010
Posts: 19
Originally Posted by Clamsoda View Post
Yeah, I saw that, and it sucks. I'll try to redo it so the spell text is on the left, and the time is on the right.
i most say that: I LOVE YOU! thank you so much for your time! <3
  Reply With Quote
01-29-13, 12:34 PM   #12
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
Here you go. Just replace the LUA in code.lua with this, or create a new AddOn with the link at the top. Enjoy.

Lua Code:
  1. CastingBarFrame.timer = CastingBarFrame:CreateFontString(nil)
  2. CastingBarFrame.timer:SetFont(STANDARD_TEXT_FONT, 12, "NONE")
  3. CastingBarFrame.timer:SetShadowColor(0, 0, 0, 1)
  4. CastingBarFrame.timer:SetShadowOffset(1, -1)
  5. CastingBarFrame.timer:SetPoint("RIGHT", CastingBarFrame, "RIGHT", -7, 2)
  6. CastingBarFrame.update = .1
  7.  
  8. hooksecurefunc("CastingBarFrame_OnUpdate", function(self, elapsed)
  9.         if not self.timer then return end
  10.         if self.update and self.update < elapsed then
  11.                 if self.casting then
  12.                         self.timer:SetText(format("%2.1f/%1.1f", max(self.maxValue - self.value, 0), self.maxValue))
  13.                 elseif self.channeling then
  14.                         self.timer:SetText(format("%.1f", max(self.value, 0)))
  15.                 else
  16.                         self.timer:SetText("")
  17.                 end
  18.                 self.update = .1
  19.         else
  20.                 self.update = self.update - elapsed
  21.         end
  22. end)
  Reply With Quote
01-29-13, 12:47 PM   #13
Nallepuh
A Deviate Faerie Dragon
Join Date: Oct 2010
Posts: 19
Originally Posted by Clamsoda View Post
Here you go. Just replace the LUA in code.lua with this, or create a new AddOn with the link at the top. Enjoy.

Lua Code:
  1. CastingBarFrame.timer = CastingBarFrame:CreateFontString(nil)
  2. CastingBarFrame.timer:SetFont(STANDARD_TEXT_FONT, 12, "NONE")
  3. CastingBarFrame.timer:SetShadowColor(0, 0, 0, 1)
  4. CastingBarFrame.timer:SetShadowOffset(1, -1)
  5. CastingBarFrame.timer:SetPoint("RIGHT", CastingBarFrame, "RIGHT", -7, 2)
  6. CastingBarFrame.update = .1
  7.  
  8. hooksecurefunc("CastingBarFrame_OnUpdate", function(self, elapsed)
  9.         if not self.timer then return end
  10.         if self.update and self.update < elapsed then
  11.                 if self.casting then
  12.                         self.timer:SetText(format("%2.1f/%1.1f", max(self.maxValue - self.value, 0), self.maxValue))
  13.                 elseif self.channeling then
  14.                         self.timer:SetText(format("%.1f", max(self.value, 0)))
  15.                 else
  16.                         self.timer:SetText("")
  17.                 end
  18.                 self.update = .1
  19.         else
  20.                 self.update = self.update - elapsed
  21.         end
  22. end)
now im getting pissed, neither dosen't work, gonna try disable all my addons and see if it works then because this is just something, cant Think of anything!:P thanks anyway!

UPDATE: nope disable my addons didnt work either!

i can't do anything wrong?!:S

Last edited by Nallepuh : 01-29-13 at 01:04 PM.
  Reply With Quote
01-29-13, 01:17 PM   #14
Nallepuh
A Deviate Faerie Dragon
Join Date: Oct 2010
Posts: 19
Originally Posted by Clamsoda View Post
You are positive you are using the default casting bar, and that no other AddOn is trying to touch it?

Also, with LUA error reporting enabled, are any errors being produced?

Edit: Soooo, I am an idiot. I named it Blizzard..., and then WoW...yeah...just...I am so stupid. Go back up a few posts and re-download, and re-install. Make sure to delete the old one, which should have ".old" affixed to it.

I just tried it and it works.

Sorry ~.~
Message: Interface\AddOns\castbar timer\code.lua:3: malformed number near '1.CastingBarFrame'
Time: 01/29/13 20:16:43
Count: 1
Stack:
Locals:



omg, im so stupid, it working now, only problem is that "healing touch" spell almost overlaps with timer! THANK YOU SO MUCH FOR YOUR TIME AND EVERYTHING YOU DID!<3

Last edited by Nallepuh : 01-29-13 at 01:23 PM.
  Reply With Quote
01-29-13, 01:27 PM   #15
Nallepuh
A Deviate Faerie Dragon
Join Date: Oct 2010
Posts: 19
timer

hi, just a Quick question, if i want to remove "show total" like 1.4/2.2´and i only want 1.4 example... in the future, what do i remove/add in LUA code! thanks!

Last edited by Nallepuh : 01-29-13 at 01:30 PM.
  Reply With Quote
01-29-13, 03:27 PM   #16
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
Originally Posted by Nallepuh View Post
hi, just a Quick question, if i want to remove "show total" like 1.4/2.2´and i only want 1.4 example... in the future, what do i remove/add in LUA code! thanks!
You would change line 12 from:
lua Code:
  1. self.timer:SetText(format("%2.1f/%1.1f", max(self.maxValue - self.value, 0), self.maxValue))

to:
lua Code:
  1. self.timer:SetText(format("%.1f", max(self.maxValue - self.value, 0)))
  Reply With Quote
01-29-13, 05:39 PM   #17
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I'd suggest using the SetFormattedText method instead of SetText with an additional call to format, as the former is much faster, and doesn't fill up memory with strings.

You can also speed things up by using local variables instead of table members; reading a local variable is faster than doing a table lookup.

Also, you're basically recreating GameFontHighlight, so you might as well just use the predefined font object.

Here's the revised code:

Code:
local timer = CastingBarFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
timer:SetPoint("RIGHT", CastingBarFrame, "RIGHT", -7, 2)

local update = 0.1

hooksecurefunc("CastingBarFrame_OnUpdate", function(self, elapsed)
	update = update - elapsed
	if update <= 0 then
		if self.casting then
			timer:SetFormattedText("%.1f", max(self.maxValue - self.value, 0))
		elseif self.channeling then
			timer:SetFormattedText("%.1f", max(self.value, 0))
		else
			timer:SetText("")
		end
		update = 0.1
	end
end)
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
01-30-13, 06:29 AM   #18
Nallepuh
A Deviate Faerie Dragon
Join Date: Oct 2010
Posts: 19
Originally Posted by ravagernl View Post
You would change line 12 from:
lua Code:
  1. self.timer:SetText(format("%2.1f/%1.1f", max(self.maxValue - self.value, 0), self.maxValue))

to:
lua Code:
  1. self.timer:SetText(format("%.1f", max(self.maxValue - self.value, 0)))
Originally Posted by Phanx View Post
I'd suggest using the SetFormattedText method instead of SetText with an additional call to format, as the former is much faster, and doesn't fill up memory with strings.

You can also speed things up by using local variables instead of table members; reading a local variable is faster than doing a table lookup.

Also, you're basically recreating GameFontHighlight, so you might as well just use the predefined font object.

Here's the revised code:

Code:
local timer = CastingBarFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
timer:SetPoint("RIGHT", CastingBarFrame, "RIGHT", -7, 2)

local update = 0.1

hooksecurefunc("CastingBarFrame_OnUpdate", function(self, elapsed)
	update = update - elapsed
	if update <= 0 then
		if self.casting then
			timer:SetFormattedText("%.1f", max(self.maxValue - self.value, 0))
		elseif self.channeling then
			timer:SetFormattedText("%.1f", max(self.value, 0))
		else
			timer:SetText("")
		end
		update = 0.1
	end
end)
thank you so much!

Last edited by Nallepuh : 01-30-13 at 06:33 AM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Cast timer addon?


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