Orgins Posted March 26, 2008 Share Posted March 26, 2008 (edited) I don't get why it keeps coming out with the wrong average (time attacking) number. The right numbers come up in the tooltip (so I know its reading them right) but when I try to get the average number its wrong. Can someone point out my mistake and call me a noob? $aSection = IniReadSection("Timer.ini","Attack") $ini = 1 $Key = 1 $AttackTime = 0 Do $Timeattacking = IniRead("Timer.ini", "Attack", $Key, "NotFound") ToolTip($Timeattacking , 0, 0) Sleep(1000) $ini = $ini + 1 $Key = $Key + 1 $AttackTime = $AttackTime + $Timeattacking;Trying to get total attacking time (all the numbers added up) until $ini = UBound($aSection) IniWrite ( "Timer.ini", "Avg", "Attack", $AttackTime / $Key);trying to get the average numberini: [Attack] 1=16 2=21 3=14 4=12 5=17 [Heal] 1=4 [Avg] Attack=13.3333333333333 It should be: [Avg] Attack=16 Edited March 26, 2008 by Orgins I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
Achilles Posted March 26, 2008 Share Posted March 26, 2008 Try dividing by ($key - 1), I think you're incrementing it an extra time on your last iteration. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Orgins Posted March 26, 2008 Author Share Posted March 26, 2008 That works. I tried $key - 1 but didn't have the ()'s so it didn't work before. I'm a newbie.Sorry if I don't reposed to your replays very fast. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now