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 / Next Menu [beginner]

Author
Message
MocroGunz
13
Years of Service
User Offline
Joined: 11th Jul 2010
Location:
Posted: 11th Jul 2010 19:22
I wanted to make next menu exmample:
Main Menu
Character Menu

but the buttons still works from the main menu to the chracter menu i want it to make it so all functions only works in main menu and all functions in character menu only works in there

Main Menu:


Character Menu:


Remember im a beginner i just downloaded darkbasic pro and its awsome but hard so i hope some1 can help me
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 11th Jul 2010 20:55
Well to be honest I am a little confused as to what you are exactly trying to do, but here are some beginner structure tips.

Format your main loop as simply a block of subroutine calls like so:



I am using label names (for my subroutines) that give 2 pieces of info. The first part is "S" then a number. The number corresponds to the value that state must be for it to be called. That helps later when reading the code and debugging it. The second piece of data in the name is simply a very clear unambiguous label that shows what it will be doing.

Why this structure is helpful:

With multiple sets of loops (you have what you want looping in the main menu, and a whole different set of commands looping for the second) you really don't have many choices. You can have a LOT of IF->THEN commands and keep everything in one loop (Bad-destroys program readability) or you can break them up with subroutines. This way when someone clicks the "Next" button, all you do is change the value of the State variable and the program will switch gears.

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
MocroGunz
13
Years of Service
User Offline
Joined: 11th Jul 2010
Location:
Posted: 11th Jul 2010 22:38
I want it so that Main menu has his own script and character select own script becaus when i add like music at character screen i will hear 2 music sounds 1 from main menu and 1 from character screen

and the other problem is that i still can click the menu in character select screen

Sorry for my bad english im trying my best
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 12th Jul 2010 00:17
No problem on the English. In that case, yeah, my code above will solve the problem of having several scripts and as long as you keep things separate, there should be no button overlap (if you want to know what I mean, just say so). For the music I believe there is a STOP MUSIC command or something simimlar, which should solve your problem. Pseudocode would look something like this:



Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
MocroGunz
13
Years of Service
User Offline
Joined: 11th Jul 2010
Location:
Posted: 12th Jul 2010 01:39
I tried that but i can still click menu's on the character frame :S
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 14th Jul 2010 10:25
As long as you don't check for clicking on the wrong button, it won't accept clicks on it.

Read through your CheckRegion code. You will note it essentially says this:



Note that NONE of these checks will compare to a variable that keeps track of what menu is active. One variation would be once you progress to menu number 2, set a variable to 2 then make the if-thens check like so:



See? This, however, is a messy way of doing it. The approach I would use would be (assume the loop that checks a variable to determine what menu is up as demonstrated in previous posts):



See how if state=2 (thus the only code being run is the subroutine S2_CharMenu) it won't check for the button from the first menu?

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Silverman
17
Years of Service
User Offline
Joined: 18th Jan 2007
Location: France
Posted: 14th Jul 2010 14:11
Hi,

MocroGunz, try this code and you'll understand why your "character menu" code does not work correctly.



@+

AMD Athlon(tm)XP 3200+ (2.2GHz) / DDR pc3200 (1024Mo) / Nvidia 6800GT (driver 178.24 WHQL)/ XP Pro SP3 / DirectX 9.0c (February 2010)/ DBClassic v1.13 / DBPro v7.4

Login to post a reply

Server time is: 2024-04-20 00:42:47
Your offset time is: 2024-04-20 00:42:47