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 / What's wrong with this code?

Author
Message
PiratSS
21
Years of Service
User Offline
Joined: 18th Oct 2002
Location:
Posted: 31st Dec 2003 04:16
lvl(object position x(obj)/25,object position y(obj)/-25)=1

I dimmed my lvl(10,20). but for some reason, this returns strange values(67531432)!

Dual AMD Athlon MP 2x1GHZ | IBM 15000Rpm SCSI 73.4 Gb X 2 | e-GeForce Ti4400 | Audigy 2 + 7.1 Surround sound | 17' Monitor | Ugly mouse
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 31st Dec 2003 06:05
Try just multiplying this by -1

object position y(obj)/25

Maybe?

RPGamer


Dont forget to Join the Forums!
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 31st Dec 2003 07:24
Array index values should be integers, you're probably giving the compiler a fit by using floats. Try,

lvl(int(object position x(obj)/25),int(object position y(obj)/-25))=1

and see if that helps.

Even with that code you can still go out of bounds on the array pretty easily.
--
TAZ
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 31st Dec 2003 17:27
You cannot use floating point values to access an array. Wrap your calculations with int() and it should work.

For free Plug-ins, source and the DBPro Interface library for Visual C++ 6 and .NET
http://www.matrix1.demon.co.uk

Login to post a reply

Server time is: 2024-09-21 13:28:30
Your offset time is: 2024-09-21 13:28:30