LoginLogin

How to make a title screen that works (text only)

Root / Programming Questions / [.]

ElzoBroCreated:
when do something like @TITLE PRINT"Title Screen" B=BUTTON(2) IF B AND A GOTO @MENU1 @MENU1 BEEP PRINT"HI" For some reason it prints the title but then the program just ends any help? *~*

when do something like @TITLE PRINT"Title Screen" B=BUTTON(2) IF B AND A GOTO @MENU1 @MENU1 BEEP PRINT"HI" For some reason it prints the title but then the program just ends any help? *~*
Yeah, because the program reaches the end. @TITLE PRINT"Title Screen" B=BUTTON(2) IF B AND A GOTO @MENU1 GOTO @TITLE @MENU1 BEEP PRINT"HI" GOTO @MENU1 You may want to put CLS and VSYNC or WAIT.

@TITLE
PRINT"Title Screen"
B=BUTTON(2)
IF B AND A GOTO @MENU1
@MENU1
BEEP
PRINT"HI"
Your problem is the program keeps running past the IF statement onto the rest of the program. I think you're expecting the IF statement to hold the program from continuing. Instead of your IF statement, replace it with this.
REPEAT:UNTIL B AND A
This will hold the program until "B AND A" evaluates to TRUE. EDIT: I made a mistake!
REPEAT:B=BUTTON(2):UNTIL B AND A
This is the line you need! The other one freezes the program because the variable B never updates. Actually, I think the best way to do it is this:
@TITLE
PRINT"Title Screen"
REPEAT:UNTIL BUTTON(2) AND A
BEEP
PRINT"HI"
You can get rid of the B= and @MENU1 lines because they're unnecessary to my eyes.