Category: Combat Mods
Addon Information
Works with 3.2
Download Latest Version.
To add favorites please register for a free account. If you already have one you need to login. How do I install this? (FAQ)
Author:
Version:
1.1
Date:
11-05-2009 12:26 PM
Size:
1.14 Kb
Downloads:
89
Favorites:
2
MD5:
Pictures
CPM
Shows you the average amount of critical strikes you make per minute.

/CPM - displays the critical strikes per minute
/CPMreset - resets the count



This is my first addon, and I made it to get into Lua, don't be too harsh in those comments.

If you find any bugs, please leave a note in the comments. Thanks =)
  Change Log - CPM
1.1
Made the numbers have less decimals.
  Archived Versions - CPM
File Name
Version
Size
Author
Date
 CPM
1.0
1kB
Malakahh
11-01-2009 05:24 PM
  Comments - CPM
Post A Reply Comment Options
Old 11-04-2009, 07:45 AM  
Malakahh
A Kobold Labourer
Interface Author - Click to view interfaces

Forum posts: 0
File comments: 1
Uploads: 1
Thanks

Thanks for the comments =)
Malakahh is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-01-2009, 09:30 PM  
Akryn
An Onyxian Warder
Interface Author - Click to view interfaces

Forum posts: 361
File comments: 58
Uploads: 7
Quote:
Originally posted by Cralor
Multiplying and dividing by the same number is what essentially does the "rounding". I really can't tell you why though.
The math.floor function rounds down to the nearest integer, so to round to the nearest hundredth using that particular function, you need to multiply by 100 so that the relevant decimal place is the one that the function acts on (units). The 0.5 gets added after the multiplication is done because of the order of operations, and therefore is effectively the same as adding 0.005 to the number before the multiplication. The result of that is that, since floor always rounds down, if the thousandths place is >=5, the resulting hundredths place will be increased by 1, otherwise it will stay the same.

In any case, using string.format is easier if the goal is to output text.
Akryn is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-01-2009, 07:47 PM  
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
Premium Member
Interface Author - Click to view interfaces

Forum posts: 553
File comments: 225
Uploads: 6
Quote:
Originally posted by xtoq
I'll admit that math isn't my strong suit, so I have to ask what is probably a dumb question. Wouldn't multiplying by 100 then dividing by 100 leave you with the same number you had before multiplying? Or is that what the math.floor function is for?
Multiplying and dividing by the same number is what essentially does the "rounding". I really can't tell you why though.
__________________
Cralor is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-01-2009, 07:27 PM  
mrruben5
PvP Clicking Holydin :P
Premium Member
Interface Author - Click to view interfaces

Forum posts: 486
File comments: 149
Uploads: 2
You don't really need to use math.floor. Just use string.format.
lua Code:
  1. local format = string.format
  2. print( format( "Criticals per minute: %.2f", (critical / (timer / 60)) ) )
__________________
mrruben5 is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-01-2009, 06:40 PM  
xtoq
A Fallenroot Satyr
 
xtoq's Avatar
Interface Author - Click to view interfaces

Forum posts: 24
File comments: 495
Uploads: 1
Quote:
Originally posted by nightcracker
I suggest rounding those numbers off to a certain decimal. For example, to the second decimal works like this:
lua Code:
  1. local originalnumber = 24.1258921
  2. local newnumber = math.floor(.5+originalnumber*100)/100
And that's about it!
I'll admit that math isn't my strong suit, so I have to ask what is probably a dumb question. Wouldn't multiplying by 100 then dividing by 100 leave you with the same number you had before multiplying? Or is that what the math.floor function is for?
__________________
There is absolutely no evidence to support the theory that life is serious.
xtoq is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Old 11-01-2009, 06:13 PM  
nightcracker
A Flamescale Wyrmkin
 
nightcracker's Avatar
Interface Author - Click to view interfaces

Forum posts: 149
File comments: 50
Uploads: 11
I suggest rounding those numbers off to a certain decimal. For example, to the second decimal works like this:
lua Code:
  1. local originalnumber = 24.1258921
  2. local newnumber = math.floor(.5+originalnumber*100)/100
And that's about it!
nightcracker is offline Report comment to moderator   Edit/Delete Message Reply With Quote
Post A Reply



Category Jump:




The Network:
EQInterface | EQ2Interface | LoTROInterface | MMOInterface | War.MMOUI | WoWInterface | VGInterface | Allakhazam | Thottbot | Wowhead | Zam


©2009 MMOUI / ZAM Network
vBulletin - Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.