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.

Newcomers DBPro Corner / Object Size Commands don't give the exact object size, is there a rounding command?

Author
Message
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 29th Dec 2005 14:16 Edited at: 29th Dec 2005 14:23
I've been working on the guide for FPS's again and Ive ran into a problem; Im now introducing the use of arrays and I thought I knew everything I needed to know about them but when I was working on some sample code for the readers to learn from something went wrong:

Basically, the sample code shows how to store object data in arrays, in this case Object1(1,3) stores object 1's x, y and z sixe. In the sample, object 1 is a box with dimensions 30x60x50, but the object size commands return 29.9956989something er other, 79.99989870 something er other, and 49.986708 something er other

I've tried using the integer command but for some reason it rounds the value down instead of up, even though in my mind should it not round up?

Here's the sample code Im working with:



(P.S I know theres a better way to write it that comes later in the guide)

<EDIT>

After looking up the INT command I can see why it isnt working, according to the definition it returns the largest whole number before the decimal. I still haven't come acrosx any rounding commands however.

<EDIT2>

Come to think of it it wouldn't be too hard to come up with a function to do it, its just Id rather not have to introduce functions right now if I dont have to



Hmm..I guess if its that simple to round something then I can see why there wouldn't be a command...

Either way if someone finds one please direct me to it (looks like functions are going to be introduced sooner than thought if not)

Jerok
19
Years of Service
User Offline
Joined: 7th May 2005
Location: Mars. Wait a sec I\'m on MARS. OMG
Posted: 29th Dec 2005 18:21 Edited at: 29th Dec 2005 18:21
works fine on mine it shows
object1
30
50
80
object2
20
20
20
object3
5
5
5

30
30

what's wrong with it

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 29th Dec 2005 18:50
Strange..Im getting decimals.

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 31st Dec 2005 16:30 Edited at: 31st Dec 2005 16:31
DarkBasic Professional doesn't usually don't return decimals as they should be returned.

http://forum.thegamecreators.com/?m=forum_view&t=68022&b=15

And it's not a bug

Login to post a reply

Server time is: 2024-09-24 11:30:16
Your offset time is: 2024-09-24 11:30:16