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 / Why doesn't this work?

Author
Message
davidt
23
Years of Service
User Offline
Joined: 29th Apr 2003
Location: United Kingdom
Posted: 19th May 2003 19:25
This is a very simple question, and I have no idea why it doesn't work. Could someone please help, because I am probably being really stupid?!

I have the following code in my program:

down_angle#=mousey()/screen height()
print down_angle#

This should give a decimal number between 0 and 1, depending on where the mouse is on the screen (I think), but all it returns from the print command is 0, wherever the mouse is.

Thanks, David
Spec - Abit NF7-S nForce 2, AMD Athlon 2100+, 256Mb PC2700, ATI Radeon 9000Pro, 20Gb Seagate U6, DVD-ROM, Zip 100, 15" TFT monitor
haggisman
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 19th May 2003 19:33
Try this code, it seems to work for me.



I believe it must be some issue with it being an interger divison with a fractional answer rounding down to zero.

Specs:- 1GHZ athlon, Radeon8500, 192mb ram, winxp
davidt
23
Years of Service
User Offline
Joined: 29th Apr 2003
Location: United Kingdom
Posted: 19th May 2003 19:38
Thanks for that, it works fine now. Maybe it is a bug, and I wonder whether it will get fixed.

David

Spec - Abit NF7-S nForce 2, AMD Athlon 2100+, 256Mb PC2700, ATI Radeon 9000Pro, 20Gb Seagate U6, DVD-ROM, Zip 100, 15" TFT monitor
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th May 2003 20:19
It's not a bug - it's integer arithmetic at work again

Login to post a reply

Server time is: 2026-07-11 19:05:32
Your offset time is: 2026-07-11 19:05:32