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 / weird error?

Author
Message
sjonny
17
Years of Service
User Offline
Joined: 25th Nov 2006
Location: darkbasic classic
Posted: 23rd Dec 2006 20:30
i have a problem with my code. I made many boxes but now suddenly a exact copy but on a other place doesn't work as you see here:



it gives this error: runtime error at line 1299. object does not exist
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 24th Dec 2006 02:34
Turn Sync On to Sync Off and run it again.

If one of the above lines is actually line 1299 (you didn't say) then the problem is elsewhere.

Doing the above will tell you where the error really is because there's nothing wrong with the code above.

TDK_Man

indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 24th Dec 2006 05:48
change the media numbers of one of the box sets, it appears your trying to re-create a box thats already defined. both share the media location 344

sjonny
17
Years of Service
User Offline
Joined: 25th Nov 2006
Location: darkbasic classic
Posted: 24th Dec 2006 10:33 Edited at: 24th Dec 2006 10:35
but how do you do that then tdk_man? i tried to but this didn't work, i put my sync at the end does that matter? and indi i do not have twice the same box number.

sjonny
17
Years of Service
User Offline
Joined: 25th Nov 2006
Location: darkbasic classic
Posted: 26th Dec 2006 12:09
please, i need a answer on this question i have a deadline to be met, so how can i change the sync so it will notice the error?

Sjonny
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 26th Dec 2006 17:53
Quote: "Turn Sync On to Sync Off and run it again."


Go to the part in your program that says:

Sync On

and change the 'On' to 'Off'.

When you run the program, the line where the error is occuring should be highlighted - rather than the line where the screen is updated with the Sync command.

Note that the returned error line number will be different with some - not all - errors. It tends to work with most 3D object-related errors though - depends what is causing your error.

When you've found the cause of your error, don't forget to turn Sync back on...

TDK_Man

sjonny
17
Years of Service
User Offline
Joined: 25th Nov 2006
Location: darkbasic classic
Posted: 26th Dec 2006 22:19
i did that allready but the highlighted part was:

make object box 344,7.5,1,25

i dont know what is wrong about it but it gives the error. what could be wrong about it?
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 26th Dec 2006 22:36
The line

make object box 344,7.5,1,25

is 1299 right?

Because the snippet you posted worked fine for me.

As the error message says 'object does not exist', and that line is creating an object, I doubt very much that the error message is even referring to that line - and the problem is elsewhere.

Unless you can sort it yourself, I'm afraid you are going to have to post the whole program on here for us to take a look at...

TDK_Man

sjonny
17
Years of Service
User Offline
Joined: 25th Nov 2006
Location: darkbasic classic
Posted: 26th Dec 2006 22:39
ok here it comes (this will be a pretty long program to read) it is still unfinished though because of the error no colours etc...:

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 26th Dec 2006 23:34 Edited at: 26th Dec 2006 23:35
It's always best to look at the lines above the line that gives the error.

These are the lines above and on 1299:


See the error? You're using object number 344 instead of 343 like the lines above it. Object 344 doesn't exist yet (it's created after this line).

You really should make an array to load up all those walls and use a for/next loop so you can reduce your code like crazy.
sjonny
17
Years of Service
User Offline
Joined: 25th Nov 2006
Location: darkbasic classic
Posted: 27th Dec 2006 09:27 Edited at: 27th Dec 2006 09:38
i adepted the program later on so the error was on line 1301 now. but i thought i checked every single number but that didn't notice me. but i dont know about the arrays i'm a newbie in that so how to make a array out of this?

and yes indi you were right i was wrong
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 27th Dec 2006 09:30
media number hey, well well well.

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 27th Dec 2006 17:12
The moral of the story with DB is that although you can't always rely on the error line number, you can trust the error message.

If an error message says that DB can't do something because something doesn't exist, then you can ignore all lines which actually create objects - the error will be on a line that tries to use the non-existant object, (or the line that creates that object is missing).

If a message says DB can't do something because something already exists, then the error will be on the line which is trying to create an object - so you can ignore all lines which use that object number.

TDK_Man

sjonny
17
Years of Service
User Offline
Joined: 25th Nov 2006
Location: darkbasic classic
Posted: 28th Dec 2006 09:40
i know it, i just didn't check it that good. while you guys did thanks for that, but i still have trouble with the array. how can i make it into an array? im a newb with programming so i dont get it,
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 28th Dec 2006 13:30
There are plenty of tutorials which cover arrays including:

http://forum.thegamecreators.com/?m=forum_view&t=96010&b=7

Scroll down to 'TDK's Programming For Beginners - Part 1 Variables'. You might also want to check out Parts 2, 3 and 4 too - as well as the one called 'Choosing the correct variables'.

There's also:

http://forum.thegamecreators.com/?m=forum_view&t=84908&b=7

...and many more if you check out the stickies on the Newcomers board.

TDK_Man

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 28th Dec 2006 23:31
Quote: "but i dont know about the arrays i'm a newbie in that so how to make a array out of this?"


I'll show you in data statements first. "data" allows you to have everything in code so you can edit it at will... without having to load an external file. I personally don't like using "data" but it's an easy way to reduce code and you don't really have to store it in an array either... arrays just make it easier to manipulate objects in the world.

I created a data extractor... it takes your raw code and converts the object creation to data statements. The extractor and your modified code do have a couple of arrays so you can see the power of arrays.

Here's the extractor it looks at a file that has your code but just the objects creation code... the file is attached to this message.



Using that code above it created a set of "data" statements that I then copied to your code and removed all the old object creation stuff. I then added loading of the data. Just making data statements reduced your code by 1,330 lines. Some of the walls are messed up (don't know exactly why because they were extracted from your code but they can be edited within the data statements). I also found out that Classic has a major error with regards to reading data statements. If we read a float the value in the data must be a float otherwise it won't read it (Pro doesn't care). So in the extractor above I added code that converts all the numbers to floats so it works in Classic.

Here's your modified code:


The next step is taking all that data and making it into another file but I'll leave that for another message... just let me know when you're ready.

Login to post a reply

Server time is: 2024-09-25 15:18:40
Your offset time is: 2024-09-25 15:18:40