Jump to content

Math help calculate percentage


Recommended Posts

Hello,

As the tittle says i need some math help to calculate percentage.

This is my script

#include <GUIConstantsEx.au3>
$s = 58985480
$ts = Round($s / 1000)
$ds = 57603
$i = 0
Do
    $sec = @SEC
    $bs = 1500
    While @SEC = $sec
    WEnd
    $cs = $ds
 $ts = Round($ts - (($cs - $bs) /100))
 $ps = Round($ts / $s * 100000)
    ConsoleWrite($ts & @CRLF & $ps &"%" & @CRLF)
Until $i = 100

$ps is the percentage. What the script does is: It has a specific number and every sec that number gets lowered.

I have managed getting it percentage and count it but my problem is that is the wrong way.

It has to rise from 0% to 100%. Now it is the oposite. It is 100% and as the number gets lowered it gets too.

Any kind of help appretiated

I feel nothing.It feels great.

Link to comment
Share on other sites

What if you do

$ps = 100 - $ps

before the ConsoleWrite()? That would make it count up.

I would also add a Sleep() at least in the while-loop to make it less resource hungry.

Link to comment
Share on other sites

Hell yes!

You know dude? When mind gets stuck, that means i need a beer :D

The problem with sleep add is that is would change the diff from 1 sec to 1,1 and that would change my entire script after some seconds or minutes

I feel nothing.It feels great.

Link to comment
Share on other sites

I assume there's a timer or something somewhere then? Because in what you posted above you only use seconds so a few (or hundreds) of milliseconds wouldn't make any difference.

Edited by AdmiralAlkex
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...