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 / Main Menu Help

Author
Message
BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 16th Jul 2010 00:45 Edited at: 16th Jul 2010 00:47
Hi, I need help with my Main Menu. Everything works but when you select stuff on it. I have it so when you select whatever it Clears Screen and executes the Subroutine. But when you release the Enter key the Main Menu pops back up. Example: You go down to 'Exit', you press Enter, verifies that you want to Exit, you release Enter, and Main Menu options pop back up. Don't mind the ExitGame Subroutine. I just put that there because i have no idea where it goes.Here's code. Please help.

Lucky 13
17
Years of Service
User Offline
Joined: 29th May 2007
Location:
Posted: 16th Jul 2010 01:08 Edited at: 16th Jul 2010 01:08
Hello!

I've had a look at your code and one thing I can point out is that you are only trying to trigger your exit routine when the enter key is being pressed: -



Basically, you're telling DBP that you only want to use the ExitGame routine when you're pressing the return key. This may have been fine if you'd chosen to use a goto rather than a gosub because goto would actually break the main loop and send the user to your exit routine. You may want to consider this:



Hope that's helped.
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 16th Jul 2010 01:13
Hi, I think it is the repeat command that is causing you trouble. You have a repeat command in your ExitGame subroutine. I just deleted this command and your program worked perfectly.

A clever person solves a problem, a wise person avoids it - Albert Einstein
BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 16th Jul 2010 01:22
Hi Hodgey!I need it to Verify that the user wants to Exit like is most games. For example..*User hits Exit* Displays "Are you are you want to Quit?". I need it to do that without, when releasing the Enter Key, displaying the Main Menu again.
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 16th Jul 2010 02:10 Edited at: 16th Jul 2010 02:14
Ok, it took a bit of time but I got your code working but I made a few changes and have only commented out parts of your original program.

Here is the code, it may not be commented to well though


Edit Oh yeah, if you use this in you main program make sure to make a back up of your original code.

A clever person solves a problem, a wise person avoids it - Albert Einstein
BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 16th Jul 2010 03:02
Hey Hodgey! Nope doesn't work like I need it. It instantly closes when I it enter. )': I need a verification to pop up like "Are you are you want to Exit". Can't find any Menu tutorials sadly. )': Thankyou though for trying to help out!
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 16th Jul 2010 04:20
Ok, I've been able to sit down and work it out, sorry about the code before, it was a rush job and was a bit buggy. Ok this should work.



A clever person solves a problem, a wise person avoids it - Albert Einstein
BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 16th Jul 2010 04:57
Thank you very much Hodgey! It works perfectly. Hopefully I can understand how your code works and use it for other stuff on the Main Menu. Thanks Again!
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 16th Jul 2010 05:23
No worries, as for understanding the code you should be able to sit down and work out what each variable and condition does, and hopefully you will get the jist of it.

A clever person solves a problem, a wise person avoids it - Albert Einstein
BMX1997
14
Years of Service
User Offline
Joined: 12th Jan 2010
Location:
Posted: 16th Jul 2010 05:32
Big thing that I need to work on is organizing my code! Suck at that at the moment. I don't know which stuff comes first,second,last,etc.
garlantinapple
14
Years of Service
User Offline
Joined: 6th Jul 2010
Location:
Posted: 16th Jul 2010 11:08
it would just look like a big list. I prefer this way because each link can be made more conspicuous.

Login to post a reply

Server time is: 2024-11-24 13:52:19
Your offset time is: 2024-11-24 13:52:19