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 Discussion / Annoying Error

Author
Message
Axelman
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location: Parallel Universe
Posted: 18th Jul 2004 13:12
Okay, I got this Code, and when i try to run it it comes up with an error saying "Runtime error at line 30 : Object ID number Range is from 1 to 6550". The Thing is i didn't id a number past 6550, the highest i went is to 3000. another strange thing is that line 108 has got nothing to do with object ids. Its Quite strange and would like to finish this before the next comp starts.

And yes, i am making a snake game, because it will be my first completed game (I'm working on other major projects aswell.) ever. I would Like to post the code in th noob forum so they can disect it to their hearts contempt.

Anyways, Hope You Guys Can Help,
Axelman.

CURRENT PROJECT: Enemy At The Gates
zenassem
22
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 18th Jul 2004 13:22 Edited at: 18th Jul 2004 13:33
Ok I don't get the same error as you but there are problemse with the code.

The error I get is an invalid object # at line 74. I have some questions. First what is p suppose to be equal to? Because You have it incrementing in an if command that can't ever be true.
Quote: "
IF Score = Score + 10
"


This can never be true. Score cannot ever be equal to score + 10 in an if condition

just like 10 can never = 10 + 10

you can use that statement without the if command to add 10 to score but not as a logical if condition.

score=score+10

I also don't understand why that if condition is at the top of your code where nothing yet has a value; the code will never get a chance to execute so why the if condition?

So since p is essentially 0 line #74 is trying to color object 0, which doesn' exist.

=====================================================================
I see you create an obeject 1. But, where are you creating objects 2-100? I see other objects starting at 101. So I am a bit confused unless I am seeing this all wrong.

It also seems that you are trying to adjust objects that haven't been created yet. I'll look at it more but my first take was that the code layou is quite confusing.

I'll check back in a bit. Perhaps I'm looking at it wrong.

~zen


Axelman
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location: Parallel Universe
Posted: 19th Jul 2004 12:12
I think you are right and wrong at the same time zenassem, no offense.

Quote: "
The error I get is an invalid object # at line 74. I have some questions. First what is p suppose to be equal to? Because You have it incrementing in an if command that can't ever be true.

Quote: "
IF Score = Score + 10
"
"


Score can Equal score + 10, Because score starts off as 0, and when the snake (Object 1) collides with the food (Object f) 10 is added to score, as so.

Quote: "
`Food
FOR f = 106 to 3000
MAKE OBJECT CUBE f,10
POSITION OBJECT f,RND(145),0,RND(145)
COLOR OBJECT f,Green
WAIT RND(1000)
NEXT f

`Collision With Food
IF OBJECT COLLISION(P,f) = 1
Score = Score + 10
HIDE OBJECT f
ENDIF
"

Quote: "
also don't understand why that if condition is at the top of your code where nothing yet has a value; the code will never get a chance to execute so why the if condition?
"

I agree, It was stupid of me to put this If Condition at the top of the program, because it will never get a chance to run.

Quote: "
what is p suppose to be equal to?
"


The Pronumeral P stands for Player, and makes the tail of the snake.
This FOR NEXT loop inside the IF ENDIF Condition still needs to be tweaked, and this will happen soon.

P is object 2 to 100, Because i think that there is a small chance that someone will eat 100 peices of food in this game of snake, especially because the snake level is quite small and you will probably bump into the walls or yourself along 25 - 50.

So you See, Whenever a peice of food is eaten 10 is added to the score and a new peice of tail is made.

So Zenassem, I have changed the code accordingly, and i hope you agree with me that these problems have been fixed.

'sept there are still some problems, like when i run it now the error doesn't come up but the walls are all out of place and the snake doesn't move, But i'll try to figure this one out myself.

Anyways,
Thanks Alot Zenassem,
Cya Later,
Axelman

CURRENT PROJECT: Enemy At The Gates

Login to post a reply

Server time is: 2025-05-24 23:20:32
Your offset time is: 2025-05-24 23:20:32