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 / Help Plisss

Author
Message
sin d roger
16
Years of Service
User Offline
Joined: 1st Apr 2009
Location:
Posted: 1st Apr 2009 09:05
help me please i dont know where is the eror



the program said the object doesnt exsist
Quirkyjim
16
Years of Service
User Offline
Joined: 18th Oct 2008
Location: At my computer
Posted: 1st Apr 2009 14:39 Edited at: 1st Apr 2009 14:40
You're problem is with using a semi-colon. To compress multiple lines of code onto one line, you use a colon (":").

Also, please try to use helpful titles. "Help Plissss" does not tell us what your problem is, and is most likely to turn most helpful people away. Try to use something more descriptive, like telling what error you get, or something like "Unknown Error at Line 11, Can't Figure Out."

Finally, try to indent your code. It makes it SO much easier to read and will make it easier to code in the long run.

So, this


Would turn more into this:


That's what they WANT you to think...
sin d roger
16
Years of Service
User Offline
Joined: 1st Apr 2009
Location:
Posted: 2nd Apr 2009 03:52
sorry i'm a noob

and thx for your help jim
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 2nd Apr 2009 07:30
thats not why he's getting THAT error.

your error is that when you hit the spacekey then your positioning the object and adding 1 to the object number hundreds of times a second(depending on your fps rate)

see when you press space you are adding one to A then it loops back and does it again and again and again exc...exc....

and your program loops at hundreds of times a second (Depending on your sync settings and fps rate) so do you see how this is a problem? because after 9 loops then the object a doesn't exist.


you need a switch. so when you press space you check if the switch is off. if so. delete the object and add one to your a variable and turn the switch on. if not, do nothing. then check if spacekey isn't being pressed if not? set switch off.

all a switch is, is a variable that you set to 1 or 0(1 being on 0 being off)

You can think of it like a Security alarm. you turn the alarm on and you can't go in. you turn it off and you can. so a example would be like this:


Hope that helps!

New Site! Check it out \/
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 2nd Apr 2009 13:33
@sin
you do need to manage your a variable like caleb said but you don't have to be so elaborate; if a > 9 then a = 1 after you alter a will make sure you don't go "out of bounds".
Programming Tip: since the 9 in my example relates to the highest object number it would be wise to convert it to a variable, that way we can change how many objects we have in the program without having to go through and find all the nines and change them too...

Great, but notice the nature of "a", it starts at 1, then increases until 9 and then resets to 1; just like a for loop!

The do loop simply restarts the for loop.

can't read?

Login to post a reply

Server time is: 2025-08-08 20:42:32
Your offset time is: 2025-08-08 20:42:32