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 / Problem with Object Number

Author
Message
Raybrite2
15
Years of Service
User Offline
Joined: 16th May 2009
Location: Cyberspace
Posted: 24th Jun 2009 10:15
I am following the videos in the forum for Dark Game Studio.
I am stuck on the first one. ( I have a copy of FPS and the Demo of DBP)
I get an error saying the object number in invalid( Runtime error 7006- object number illegal at line 9)


That is the line that begins "load object"

I tried changing it to 1 and it gives me a blue screen with no error.

It is supposed to be the small setting I made with FPSC.
I made a files folder and copied the levelbank and texturebank folders over like they said in the video.

Any suggestions? I think this will be the last error before I get to see something on the screen.
I know there is a camera setting change coming but, I am not concerned about that right now.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 24th Jun 2009 10:33
Quote: "I know there is a camera setting change coming but, I am not concerned about that right now."

I think that is exactly what you should be concerned about.

Object numbers start at 1, so 0 is invalid. If you then have a large (or very small) object, you would position the camera within (or too far away from) it, hence not seeing anything but the blue background.

Try setting the object number to a positive non-zero value, set autocam on and omitting the camera positioning line. If that works, what I just described should have been your problem.
(You can then check the proper camera positions using camera position x ... y ... z for where the camera was automatically positioned).

Raybrite2
15
Years of Service
User Offline
Joined: 16th May 2009
Location: Cyberspace
Posted: 24th Jun 2009 10:48
That has helped a lot.
I noticed the object is there but it is above me. I can just adjust the values to where I am in the room and then it should work out.
I tried the autocam setting and lost the rooms.
I do have movement with the arrow keys.
This is the closest I have some to getting something on my screen.
I decided if I can master some of this a new computer is coming for the new programs.
Thanks.
Raybrite2
15
Years of Service
User Offline
Joined: 16th May 2009
Location: Cyberspace
Posted: 24th Jun 2009 11:00
Something is not working right. It may be the Trial version versus the full edition.
autocam doesn't do anything but get me theblue screen.
Changing the values of X,Y, and Z don't seem to move camera start point.
I have only used values between 50 and -50. Maybe I should use larger numbers.
do I have to press enter after the change or save it before the changes take place?
Raybrite2
15
Years of Service
User Offline
Joined: 16th May 2009
Location: Cyberspace
Posted: 24th Jun 2009 11:28
I have it working (sort of). I must turn on more lights inside the rooms to really figure out which way I am going.
The numbers are around 500,500,500 to get the camera close. I am just moving them to reset the camera and then trying again. I have made it into the room so I am happy with that.
Thanks again. Just wanted to update you.
Still don't know why autocam doesn't work.
It must be a trial thing cause I get the help folder but no examples.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 24th Jun 2009 11:37
When thinking about it, I think autocam is actually on by default (which means that the main camera will be repositioned each time a new object is loaded / created to face it). If you want to manually set a starting point, you should turn autocam off or just position the camera after loading / creating all objects.

I'm not sure about the trial version, maybe it has broken commands seeing as its probably a lot older than the current version.

Raybrite2
15
Years of Service
User Offline
Joined: 16th May 2009
Location: Cyberspace
Posted: 24th Jun 2009 12:07
I finally got it fixed and sent you an email.(didn't want to get banned for bumping.)
I now have the camera at 150,550,-250 which puts me inside the room facing the wrong way. I will fix the facing problem later.
I may play with the autocam feature a bit now that I know how to turn it on and off and put the old script back in.
Thanks again.
I am sure this will not be my last problem before the new disk arrives with the full version on it.
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 25th Jun 2009 12:27 Edited at: 25th Jun 2009 12:27
To help prevent object number clashes, or in your case, setting an object to zero, the best thing you can do is setup your program to dynamically assign object numbers to logical names rather than numbers you have to remember. After all it's alot easier to refer to an object as "player" or "enemy" than it is to remember that the player object is one, and the enemy object is two. Sure it might seem easy from that point onwards. But as soon as you have 2, 10, 20, enemy's appearing, as well as your games objects in scenes etc. It becomes a small nightmare.

The way to do this is to write a simple function called Free_Object_ID() you can shorten it to free_obj() if you like. The code for this is:

Function Free_Object_ID()

ObjID = 0
Repeat
Inc ObjID
ID = Object Exist(ObjID)
Until ID = 0

EndFunction ObjID

This command litarily checks every single object ID number assigned to an existing object, as soon as it finds an object slot free.

You can then call objects at that ID by typing in:

Global MyLevel as Integer
MyLevel = Free_Object_ID()
Load Object "MyUniverse.dbo", MyLevel

This can be further advanced by applying data types and arrays to your program, allowing you to group objects by type, class, etc.

Login to post a reply

Server time is: 2024-09-28 08:24:55
Your offset time is: 2024-09-28 08:24:55