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 / objects not deleting

Author
Message
emlyn
18
Years of Service
User Offline
Joined: 22nd Oct 2007
Location:
Posted: 30th Oct 2007 21:47
When I quit early or don't collect all the items in my game, they aren't deleted at the end. Here is the code that should delete them.


when they aren't delted the game can't restart.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 31st Oct 2007 03:36
Aaaaarrrrgghhhhh Goto!!!

As for your actual problem, there isn't enough information in that snippet for us to be able to help you. For example:

* How do we know that MyTimer actually equals zero at the point the code is executed.

* How do we know that your objects actually are objects numbered between 1 and 1000?

* How do we know if that piece of code is actually being executed? (That could be part of a subroutine, a function or just one small section of a large 'spaghetti-like' piece of code, but nothing you posted indicates that your program actually runs it)...

Apart from the Goto, there's nothing bad with the code snippet you posted (including syntax) - it's just that it relies heavily on parts of your program that you didn't show us.

TDK_Man

emlyn
18
Years of Service
User Offline
Joined: 22nd Oct 2007
Location:
Posted: 31st Oct 2007 21:09 Edited at: 1st Nov 2007 20:56
I thought that might be the case, but I wasn't sure how much to post. Here is the parts you suggested.

This is everything I think you need.





This is the timer, again. I changed it back to what it was, that didn't help.
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 31st Oct 2007 23:27
Quote: "Aaaaarrrrgghhhhh Goto!!!"

I blame adventure books

"You must be someone's friend to make comments about them." - MySpace lied.
emlyn
18
Years of Service
User Offline
Joined: 22nd Oct 2007
Location:
Posted: 1st Nov 2007 20:59 Edited at: 2nd Nov 2007 20:55
Quote: "I blame adventure books
"

????? Little confused. The goto works fine, that shouldn't be ther problem.
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 2nd Nov 2007 23:41
Ah, no, you misunderstand, GOTOs are the bane of all programmer's lives, they cause spaghetti code, which messes up your program immensley. TDK especially hates GOTO. (And gosubbing without return)

Nya!
Well, yes but - wait, what?
Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 3rd Nov 2007 04:05
I think I saw your wall problem somewhere else, that should really have been in the same thread if it is from the same program.

"You must be someone's friend to make comments about them." - MySpace lied.
emlyn
18
Years of Service
User Offline
Joined: 22nd Oct 2007
Location:
Posted: 5th Nov 2007 21:03
Ahh, so that is what GOTO means. That makes alot more sense. An if you saw the solution somewhere, could you please tell me where?

"I had a monumental idea this morning, but I didn't like it." Samuel Goldwyn

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 6th Nov 2007 08:19
Aaaaaaarrrrrrrgh!!! GOTO!!! GOTOO!!!!! Enver Use GOTO!!!!!!

I cant see were youre decrementing the MyTime.
shouldnt it be like this:



Oooooops!!! I accidentally formated drive c.
emlyn
18
Years of Service
User Offline
Joined: 22nd Oct 2007
Location:
Posted: 6th Nov 2007 21:04
Thanks for your suggestion but it didn't work, but it did make me realize what wasn't working. I changed the code for if you pressed q and had it set MyTimer = 0 and it fixed it. Thank you all for the help.

"I had a monumental idea this morning, but I didn't like it." Samuel Goldwyn

Bluestar4
20
Years of Service
User Offline
Joined: 19th Dec 2005
Location: USA
Posted: 1st Dec 2007 20:41
so I take it you fixed your timer issue ?

Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 1st Dec 2007 21:05
This is the reason that goto is bad:
http://xkcd.com/292/


Sudoku arts, the rabi and Nancy DrewG

Login to post a reply

Server time is: 2026-07-06 02:52:29
Your offset time is: 2026-07-06 02:52:29