Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Multiloader loading bar, showing percentage of loading help?

Author
Message
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 11th Aug 2010 13:42
Made this function that should allow you to load anything in from a function, however I can not put may finger on why the bar does not up date correctly

if using this which I working fine in my weather program but now I've take bits of it out it will not work.

this is the line thats mucking things up.

rem pp#=(volume/12*100)*barsize_x/100
P# = (loadingcount/loadingtotal*100.0)*width/100.0

the rem one is what works ok in the weather code, but when adaptive for this code does not work, is my maths or something else?




Dark Physics makes any hot drink go cold.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 11th Aug 2010 21:09
Break down the calculation into BIDMAS, remembering to take the type with the number, and you'll see where you went wrong:
P# = (loadingcount/loadingtotal*100.0)*width/100.0

First inside the brackets:
1 (integer) / 3 (integer) * 100.0 (float)

1/3 = 0 in integer maths ... and we can stop there, as apart from the very last object loaded, the result of that calculation will always be zero.

If you convert one of those two values within the division to a float before you carry out the division, like so:
P# = ((loadingcount + 0.0)/loadingtotal*100.0)*width/100.0

... then the result will be:
1.0 (float) / 3 (integer) * 100.0 (float) = 0.333~ (float) * 100.0 (float) = 33.3~ (float)

HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 11th Aug 2010 22:33
Thanks IanM, been caught out by the integer V's float again, now you've shown what it was I was doing, no wonder it wouldn't work right.

Cheers now to give it the fix and see what else it broken if any.

Dark Physics makes any hot drink go cold.
Mugen Wizardry
User Banned
Posted: 17th Aug 2010 01:12
howdo, did u ever figure this out?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 18th Aug 2010 20:53
not yet, may get it going, its all there just needs to made to work right.

if you try doing as IanM I think it will work.

Dark Physics makes any hot drink go cold.

Login to post a reply

Server time is: 2026-07-25 17:49:55
Your offset time is: 2026-07-25 17:49:55