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 / Same program, different problem.

Author
Message
Moruk
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location:
Posted: 4th Mar 2005 16:10 Edited at: 4th Mar 2005 16:15
Alright, thanks to those that provided advice for making the ball bigger. I've modified the program, and I'd like to know two things, if possible:

One - Did I go about making this the right way? Is there anything else I could have done to make the code easier, smaller, etc?

Two - Is it the debugger, or something with the program, that causes "Could not close nest at line 122", or something like that?

Thanks
Jarred


*Edit* Putting the code might help ^_^'



P4 3.4ghz, 512mb DDR2 533mhz RAM, GeForce 6800 GTO 256mb Graphics Card, Sound Blaster Audigy 2. Win.
Zokomoko
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 4th Mar 2005 16:53
I've not read your previous post, and I don't exactly know what your code suppose to do.
But I think you should learn about arrays, that would definitely make your code smaller, and easier to read.


This part...
Quote: "
cubx1#=Rnd(3500)
cubz1#=Rnd(3500)
cubx2#=Rnd(3500)
cubz2#=Rnd(3500)
cubx3#=Rnd(3500)
cubz3#=Rnd(4500)
cubx4#=Rnd(3500)
cubz4#=Rnd(4500)
cubx5#=Rnd(3500)
cubz5#=Rnd(4500)
cubx6#=Rnd(3500)
cubz6#=Rnd(4500)
cubx7#=Rnd(3500)
cubz7#=Rnd(4500)
cubx8#=Rnd(3500)
cubz8#=Rnd(4500)
cubx9#=Rnd(3500)
cubz9#=Rnd(4500)
cubx10#=Rnd(3500)
cubz10#=Rnd(4500)
cubx11#=Rnd(3500)
cubz11#=Rnd(4500)
cubx12#=Rnd(3500)
cubz12#=Rnd(4500)
cubx13#=Rnd(3500)
cubz13#=Rnd(4500)
cubx14#=Rnd(3500)
cubz14#=Rnd(4500)
cubx15#=Rnd(3500)
cubz15#=Rnd(4500)
"


could be modified into this..


dim cubeX(15)
dim cubeZ(15)
for i=1 to 15
cubeX(15)=rnd(3500)
cubeZ(15)=rnd(4500)
next i


just search the forum for "arrays".
Moruk
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location:
Posted: 4th Mar 2005 17:25
Hah, that might be a bit easier ^_^' Thanks a lot for that. It's all a learning process =p

The previous post was basically to ask how to make the ball get bigger when you roll over the cubes. That's what this is supposed to do, but I get some error on the last line with the return command, for some reason. Some crap about a nest =p


P4 3.4ghz, 512mb DDR2 533mhz RAM, GeForce 6800 GTO 256mb Graphics Card, Sound Blaster Audigy 2. Win.
Zokomoko
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 4th Mar 2005 18:01
well, a nest error basically tells you, you forgot to close a nest.
an example for a nest would be:
if condition=1
`do stuff here
endif

that nest is closed, but if you don't put the "endif", then that nest is not closed. Same is for loops of any kind.

So if you have a subroutine, make sure all the nests in it are closed.
Moruk
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location:
Posted: 4th Mar 2005 18:15
They are, are far as I can tell. But thanks for telling me what a nest error was. I think it's just the debugger being a bugger again...Don't suppose anyone could double-check it for me, make sure everything's closed?


P4 3.4ghz, 512mb DDR2 533mhz RAM, GeForce 6800 GTO 256mb Graphics Card, Sound Blaster Audigy 2. Win.
Moruk
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location:
Posted: 4th Mar 2005 18:19 Edited at: 4th Mar 2005 18:22
It's the following that's got the error:


That's all closed, as far as I can tell?

*Edit* Ahaha, I forgot the "Next cub" ^_^'


P4 3.4ghz, 512mb DDR2 533mhz RAM, GeForce 6800 GTO 256mb Graphics Card, Sound Blaster Audigy 2. Win.
Moruk
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location:
Posted: 4th Mar 2005 18:47
Alright, new problem, I've almost got it.

I converted this:


To This:


Now, that's a hell of a lot cleaner. Thing is, when I run it, it says "Object already exists at line 34". What have I done wrong? >.>


P4 3.4ghz, 512mb DDR2 533mhz RAM, GeForce 6800 GTO 256mb Graphics Card, Sound Blaster Audigy 2. Win.
Zokomoko
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 4th Mar 2005 19:47 Edited at: 4th Mar 2005 19:50
The problem would be that you're trying to create an object with an already existent object number.
meaining, if you have object number 15, you cannot create another object which has the object number of 15.

this is where the problem lies:
Quote: "
For objnum = 2 To 15
For posnum = 2 to 15
Make object cube objnum,3
Position object objnum,cubx(posnum),10,cubz(posnum)
Next objnum
Next posnum
"


You have 2 for loop, we'll call the objnum loop "outer loop" , and the posnum "innner loop".
As you can see, each cycle of the outer loop, the inner loop does 13 (15-2) cycles. After the inner loop completes all of its cycles, the outer loop goes to its second cycle. And then everything happens again, the inner loop completes all of its cycles, and then the outer loop goes to its third cycle. I hope you understand until now.

The problem was, that you placed the "make object" command in the inner loop. so let's review what's going on when the program runs:
(1) The outer loop begins its first cycle
(2) the inner loop begins
(3) 13 objects are created with objects number from 2 to 15.
(4) The inner loop ends
Up until now, the inner loop as done 13 cycles, and the outer loop is only in its first cycle.

(5) The outer loop begins its second cycle
(6) the inner loop begins
(7) The inner loop tries to create objects with objects numbers from 2 to 15, but it fails. why ? because they already exist.
We've already created them in step 3.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 4th Mar 2005 19:59 Edited at: 4th Mar 2005 20:12


there is no need for the second time running to position as it tries to make them again too.

Also make sure to disable the cubes collision once hit or it will still hit the invisible cubes.



[edit] Another way to do the ball enlarging code would be to get the number of the object hit instead of cycling through them all. I haven't tested this with DBP collision but this way is much faster with Nuclear Glory Collision.


Moruk
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location:
Posted: 4th Mar 2005 21:15
Ah, that'd make sense. Thanks for the help, everyone. Much appreciated.


P4 3.4ghz, 512mb DDR2 533mhz RAM, GeForce 6800 GTO 256mb Graphics Card, Sound Blaster Audigy 2. Win.
Moruk
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location:
Posted: 4th Mar 2005 21:25 Edited at: 4th Mar 2005 21:35
If I use your method of collision - How do I make the object hide after collision? >.>

*Edit* Heh, it's hidden, ignore me. One problem though, you can still collide with the object, just it's invisible. So you can roll back and forth over the same spot to get bigger :p


P4 3.4ghz, 512mb DDR2 533mhz RAM, GeForce 6800 GTO 256mb Graphics Card, Sound Blaster Audigy 2. Win.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 5th Mar 2005 02:59 Edited at: 5th Mar 2005 03:02
This part of the code keeps that from happening. Both codes I posted work here in regards to not hitting the same cube twice and hiding them once hit.



[edit] the complete second code would be


Login to post a reply

Server time is: 2024-09-23 13:25:00
Your offset time is: 2024-09-23 13:25:00