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 number illegal

Author
Message
Ultimate Newbie
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location:
Posted: 16th Jun 2006 14:41
Could someone please tell me why I get "object number illegal at line 29? Presumably, if I get this one correct it will say the same thing at line 30. It compiles but will not work. I hope this is enough of the code to make sense.
`Load bike
load object "h-sport bike-move.3ds",2 :position object 2, 512,10,512
bx#=object position x(0)

bz#=object position z(0)
if bx#<0.0 then bx#=0
if bx#>size# then bx#=size#
if bz#<0.0 then bz#=0
if bz#>size# then bz#=size#
position object 2, cx#,get terrain height(TerrainNumber,cx#,cz#)+5,cz#

If it doesn't work the first time, then there's always television.
Dream And Death
18
Years of Service
User Offline
Joined: 21st Feb 2006
Location: The circus! Juggling job, kids and DBPro
Posted: 16th Jun 2006 15:07
I'm guessing
bx#=object position x(0)
is line 29?

In which case, ask yourself - what is object 0.
If you haven't got an object 0 - there is your problem!
Ultimate Newbie
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location:
Posted: 16th Jun 2006 18:08
Thanks. I tried getting rid of 0 but that didn't help. I'm just rehashing a help example and this time I've included the whole code if that's any help for anyone to see how I've managed to trash the original code.


sync on : sync rate 0 : color backdrop 0
set text font "arial" : set text size 16
set text to bold : set text transparent

rem Make Simple Terrain
TerrainNumber=1
make terrain TerrainNumber,"land.bmp"

rem Position The Terrain
position terrain TerrainNumber, 0, 0, 1025

rem Texture terrain
ImageNumber=1
load image "grass.bmp",ImageNumber
texture terrain TerrainNumber,ImageNumber
size#=1025

rem Load sky object
load object "sky\sb.x",1
scale object 1,40,40,40
set object cull 1,0
set object light 1,0
set object texture 1,2,1
`Load bike
load object "h-sport bike-move.3ds",2 :position object 2, 512,10,512
bx#=object position x()
by#=object position y()
bz#=object position z()
if bx#<0.0 then bx#=0
if bx#>size# then bx#=size#
if bz#<0.0 then bz#=0
if bz#>size# then bz#=size#
position object 2, cx#,get terrain height(TerrainNumber,cx#,cz#)+5,cz#

rem Position camera in center of terrain
position camera 512,10,512


rem Main loop
desc$="LOD Terrain from Bitmap"
while mouseclick()=0

rem Control camera over terrain
control camera using arrowkeys 0,1,1
cx#=camera position x(0)
cz#=camera position z(0)
if cx#<0.0 then cx#=0
if cx#>size# then cx#=size#
if cz#<0.0 then cz#=0
if cz#>size# then cz#=size#
position camera cx#,get terrain height(TerrainNumber,cx#,cz#)+5,cz#



rem Position sky at player
position object 1,camera position x(0),camera position y(0)-150,camera position z(0)


rem Update screen
sync

rem End loop
endwhile

rem Delete Terrain
delete terrain TerrainNumber

If it doesn't work the first time, then there's always television.
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 16th Jun 2006 18:20

You don't seem to know what this does. object position x(#) gets the x position (as in x, y, z location) of object #. You need a number there. Look at the code where you load the bike. What number do you load the bike into? It's pretty easy to see. So put THAT number in between the parenthesis, so it should be

where you replace bike number with the number you loaded the bike into. I know you can do it!

Assuming you don't have any camera problems, that should fix you up. What were you attempting to do, anyway?

Ultimate Newbie
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location:
Posted: 17th Jun 2006 14:39
Thanks for the help. Probably wishful thinking but my ultimate aim is to move the bike around whilst being strafed by an aeroplane which I drew in in on of the object applications.

If it doesn't work the first time, then there's always television.
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 21st Jun 2006 11:27
Ok ultimate newbie (nice name !) heres a quick low-down on position object.



I hope that explains a little how the Object position command is used.
If it didnt, then sorry!

M.I.A is pending

Login to post a reply

Server time is: 2024-09-25 01:32:21
Your offset time is: 2024-09-25 01:32:21