ileandros Posted January 30, 2013 Posted January 30, 2013 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.
AdmiralAlkex Posted January 30, 2013 Posted January 30, 2013 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. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
ileandros Posted January 30, 2013 Author Posted January 30, 2013 Hell yes! You know dude? When mind gets stuck, that means i need a beer 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.
AdmiralAlkex Posted January 30, 2013 Posted January 30, 2013 (edited) 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 January 30, 2013 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
ileandros Posted January 30, 2013 Author Posted January 30, 2013 (edited) Yes there is. And it could run for minutes or even hours. Anyway i added 10ms sleep. Saw the script running better after a while Edited January 30, 2013 by ileandros I feel nothing.It feels great.
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