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 / error exiting program

Author
Message
Mychal B
14
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 5th Sep 2010 12:15
Alrighty, I know it's not anything with my computer for if I run other projects it will escape perfectly fine, but when I try to escape out of the game I'm currently making every time I hit escape or click on the x a message pops up from windows saying "mygame has stopped working." I cannot figure this one out!

Could it be because I'm not exiting out of a loop properly? The way I have it set up is:

do
if upkey() = 1 then end
loop
Thanks for the help!
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 5th Sep 2010 15:50
I think we need to see a little bit more code than that to help.

Your snippet works fine for me.

Mychal B
14
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 6th Sep 2010 00:21
Well...There's a ton of code, and I have no idea where the problem is... I can put up the main page at least though!!!Any tips for helping me find out what the problem may be would be great! Thanks in advance

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 6th Sep 2010 00:52 Edited at: 6th Sep 2010 00:55
Instead of :



try :



You've disabled the escapekey. Also, you're going to need an END statement after your DO - LOOP.

So many games to code.......so little time.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 6th Sep 2010 09:27
Quote: "Could it be because I'm not exiting out of a loop properly? "


You are leaving the DO/LOOP properly in the code snip but it's probably because after you EXIT from the DO/LOOP it eventually hits the RETURN without a GOSUB. Listen to LBFN and put an END after the DO/LOOP. The same thing is true with functions. If the program hits a function without a call to it the program ends with an error.

Mychal B
14
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 6th Sep 2010 10:12
MY HOLY CHEESE NIPS!!! With one quick reference from your posts it works! Thank you guys so much. This ones been buging me for quite some time. I think prety soon my game will be ready for the WIP forum
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 6th Sep 2010 13:52
Quote: "You are leaving the DO/LOOP properly in the code snip"

Grog is correct. Since you are checking the escapekey's status in your do - loop, it does indeed exit. One has to wonder why you disable the escapekey in the first place, though.

Quote: "MY HOLY CHEESE NIPS!!!"

You are funny.

So many games to code.......so little time.
Mychal B
14
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 6th Sep 2010 23:07
disable escape key? Because I'm a total newb. didn't know how the escape key actually exits the program so I decided to try and disable it,trying to make it so I could possibly make it exit out a different way via:


But it works GRRRRRRRRREATTT now!!! Thanks much
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 7th Sep 2010 02:26
Here is a simple example of how disable escapekey works. Primarily, it is used when you want to do something (delete some stuff, change screen rez, etc.) before the game actually exits.



So many games to code.......so little time.
Mychal B
14
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 7th Sep 2010 09:18
Wow, that's just great. I don't even know what to say, but I do know what my next post will be! I'm wondering about copyright infringments for replicating buildings and businesses from a real town

Login to post a reply

Server time is: 2024-11-24 12:14:20
Your offset time is: 2024-11-24 12:14:20