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 does this suddenly not work???

Author
Message
Disrupter52
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 15th Sep 2011 20:23


This loop series worked flawlessly up until i added collisions to it. Now its failing at the last object saying "the cant find object number 225". I changed the number for the tree variable and it doesnt work. Im so sick of this stupid error, why does this happen for no good reason every once and again?
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 15th Sep 2011 21:02
"media\treetest.x\treetest.x" ???...

-In.Dev.X: A unique heavy story based shoot'em ~35%
-CoreFleet: An underground commander unit based RTS ~15%
-TailsVSEggman: An Sonic themed RTS under development for idea presentation to Sega ~15%
Disrupter52
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 15th Sep 2011 21:04
Answer the question please. Dont worry about my file layout. All the stuff i do is all tests.
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 15th Sep 2011 21:40
I think they meant you have the filename in the path twice. I know it's a valid folder path, but it could be unintentional?

My signature is NOT a moderator plaything! Stop changing it!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 15th Sep 2011 21:48 Edited at: 15th Sep 2011 21:49
Seems odd to have a folder with .x in it.

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 15th Sep 2011 21:51
Quote: ""media\treetest.x\treetest.x" ???..."


Slowly you're winning your avatar that really defines you as Lisa Simpson.

@Disrupter.
I think your problem is the Quantity of trees you have; too much polygons working at the same time. You cold try to convert all trees to the same object . Could you post your 3D Tree ?

Cheers.

I'm not a grumpy grandpa
Disrupter52
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 15th Sep 2011 21:58 Edited at: 15th Sep 2011 22:00
This is the actual model, or should be. I made it with Tree Magic.

And yes, when i made it in tree magic, it did that. I thought it best not to mess with it at the time. There is as folder that has the name of the .x file.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 15th Sep 2011 22:19
Try to put just a single box 10*50*10 in every tree trunk, and make collision check with these boxes.

Cheers.

I'm not a grumpy grandpa
Disrupter52
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 15th Sep 2011 22:42
Changed my code to this as per chafari's advise.



and here is where its called:



Same error but now for the treeBox boxes i made not the trees...
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 16th Sep 2011 00:46
You might also try object instancing instead of cloning, saves memory and also saves you having to load the object lots of times.

Before your 2 loops, load your object, then in the loops just instance it to other object ID's...

Warning! May contain Nuts!
darkvee
20
Years of Service
User Offline
Joined: 18th Nov 2005
Location:
Posted: 16th Sep 2011 01:13 Edited at: 16th Sep 2011 01:23
Hi Disrupter52

load image "media\treetest.x\eeeeeee.png",2
is treetest.x a folder LOL?

Try using the correct way
load image "media\eeeeeee.png", 2
load object "media\treetest.x", tree


Try this code out.


If this code had a error in it than there is a problem. However the code is getting 25 object numbers for tree and another 25 for treeBox giving a total of 50. Since your code is having problems show us all of your code, and not what you think is the problem.

darkvee
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 16th Sep 2011 01:32 Edited at: 16th Sep 2011 01:39
@Disrupter52

Try the same code I gave you some time ago and load your tree. In my PC works ok.




Example attached
Cheers.

I'm not a grumpy grandpa
29 games
20
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 16th Sep 2011 22:35 Edited at: 17th Sep 2011 13:10
@Disrupter, I think the for to next loops you posted work fine but that the problem you're having is the way you've ordered the code within your for to next loops and it's causing the error later on when you actaully detect for collisions.


[Edited: thanks Hodgey and zenassem for spotting the typo]
Because you are incrementing the variable "tree" after the object have been loaded you are creating 25 tree objects numbered 200 thru 224 but "tree" equals 225 once the for to next loop has finished.

However, there is no tree model that is numbered 225. Therefore, if later on in the code you try to make reference to any object labeled "tree", it will look for a model numbered 225 and hence the error "cant find object number 225".

In the second lot of code you posted, you do the same thing with the variable "treebox" and thus get a simillar error.

It would be better to increment the variable "tree" before the load object command and then the trees would be numbered 201 thru 225.

Or

after the for to next loop just put in a line that minuses 1 from the variable "tree", so it equals 224. This seems a little clumsy to me but should work.
Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 17th Sep 2011 07:09
I agree with 29 Games and here's a something a little more visual to emphasise on what he is saying.



Quote: "Because you are incrementing the variable "tree" after the object have been loaded you are creating 25 tree objects numbered 200 thru 254 but "tree" equals 255 once the for to next loop has finished."

224 and 225?

zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 17th Sep 2011 07:22 Edited at: 17th Sep 2011 07:24
Quote: ""Because you are incrementing the variable "tree" after the object have been loaded you are creating 25 tree objects numbered 200 thru 254 but "tree" equals 255 once the for to next loop has finished.""


just for clarity I think this should read

"Because you are incrementing the variable "tree" after the object have been loaded you are creating 25 tree objects numbered 200 thru 224 but "tree" equals 225 once the for to next loop has finished."

Your signature has been erased by a mod please reduce it to 600 x 120.
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 17th Sep 2011 10:25
Sorry but that seemed the typical DBPro error to me, when i screwed up something among the loading lines, and it shows me error on the other side of the code. Happened not once.

-In.Dev.X: A unique heavy story based shoot'em ~35%
-CoreFleet: An underground commander unit based RTS ~15%
-TailsVSEggman: An Sonic themed RTS under development for idea presentation to Sega ~15%
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Sep 2011 21:45
Quote: "This loop series worked flawlessly up until i added collisions to it. Now its failing at the last object saying "the cant find object number 225". I changed the number for the tree variable and it doesnt work. Im so sick of this stupid error, why does this happen for no good reason every once and again?"


That snippet works fine for me - but I had to delete the get ground bit since the code doesn't define a matrix. Perhaps the error is somewhere else in your code?

I sometimes get your particular error with my programs on my other machine when there's a problem with the graphics card.

You might also get it if the rest of your program executes a set display mode command after you've loaded your media.

Login to post a reply

Server time is: 2026-07-10 08:28:08
Your offset time is: 2026-07-10 08:28:08