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 / Menu Clearing Issue

Author
Message
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 10th Nov 2006 21:46
I'm trying to setup a menu for my game. There's nothing special about this menu, in general, if you click on something, it should lead to a separate menu while clearing the first menu off the screen.

Currently, when I go to another menu, the first stays on the screen and gets in the way. Take a look.


"I will work harder... if you ask me enough times... or give me enough coffee"
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 11th Nov 2006 00:41
Try making a variable, called menu. Then on make the buttons "if menu=1" or "if menu=2" you know?

Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 11th Nov 2006 19:27
I know what you mean, but I think the problem is within the clearing of the first menu, not the creation of the second.

The program is setup in a branching subroutine fashion and I'm just not sure how to clear the first menu away while the second appears.

I attempted to implement the if menu's as shown in the


combined with the


The main menu should close when the options menu is opened because the menu variable becomes equal to 3 and the main should only be open when menu equals one. I suppose that the first stays open because the menu continues to loop. Any suggestions?

"I will work harder... if you ask me enough times... or give me enough coffee"
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 12th Nov 2006 01:07 Edited at: 12th Nov 2006 01:16
It's doing it because when you click on options it does "gosub options;". In the options label if the back menu hasn't been selected immediately it returns back to the line after the gosub to get to options... which means your back in the main menu.

It's best to avoid "goto" at all costs and use only "gosub" if you must... but even using "gosub" can cause problems if you're not carful.

Are you using Classic or Pro?

Edit: Also using "cls;" is making it not clear the screen. Remove all semicolons because their not needed... this isn't C++.
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 12th Nov 2006 06:20
I'm using pro, and the semicolons are just a habit from java. I thought that the cls command did clear the screen, I wasn't aware that it hindered screen clearing.....

"I will work harder... if you ask me enough times... or give me enough coffee"
Programmer of Power
19
Years of Service
User Offline
Joined: 22nd Aug 2005
Location: Home
Posted: 21st Nov 2006 04:07
Alright, I've attempted to implement the if statements version and there's some success, but the menu still doesn't clear itself.



"I will work harder... if you ask me enough times... or give me enough coffee"
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 21st Nov 2006 05:53 Edited at: 21st Nov 2006 05:59
Have used the while command, run it and see, what it does is keeps doing the mainmenu until you press the 1 key or if you use your button code then goes to that bit of code.




Dark Physics makes any hot drink go cold.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 21st Nov 2006 09:27
You're still using "cls;" which won't clear the screen because of the semicolon. Remove it and it'll clear the screen.

I made this to help you kick the habit of semicolons:

Login to post a reply

Server time is: 2024-11-26 08:56:03
Your offset time is: 2024-11-26 08:56:03