Sign in to follow this  
Followers 0
Orgins

I can't seem to get the average number.

3 posts in this topic

#1 ·  Posted (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 number
ini:

[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 by Orgins

I'm a newbie.Sorry if I don't reposed to your replays very fast.

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0