DECLARE FUNCTION menu (title$, items$()) ' Here is the menu() function. (Press F2 to see it) ' With this I give you great power. ' Use it wisely. ' (C)BAM1998 DIM array$(1 TO 7) ' This is the array to store the menu choices. ' Seven elements, seven possible choices. Hmm... array$(1) = "TRAINING" ' Choice one is TRAINING. array$(2) = "SARGE" ' Choice two is SARGE. array$(3) = "FOOD" ' And so on. array$(4) = "HEALTH" ' Easy, huh? a = menu(" BOOTCAMP ", array$()) ' Easy as 3.1415926 ' remember to store as a variable. ' (In this case, 'a') LOCATE 10, 1 ' This is just where we print what they choose SELECT CASE a ' The mighty SELECT CASE statement. Learn it well. ' Put the cursor over SELECT and press F1. CASE 1: PRINT "You chose TRAINING" CASE 2: PRINT "You chose SARGE" CASE 3: PRINT "You chose FOOD" CASE 4: PRINT "You chose HEALTH" END SELECT ' That's it! ' Your friend, ' ' ÍÍÍÍÍÍ» º º º º º Û Û Û ÛÛ Û ' ÍÍÍÍÍͼ º ÌÍÍÍ͹ º º °ÛÛ ÛÛ Û Û °Û Û°Û ' ÉÍÍÍÍÍ» ÌÍ ÈÍÍÍͼ Ì͹ °Û Û°Û ÛÛÛÛÛ°Û° ÛÛ ' ÈÍÍÍÍͼ º º º °Û° °Û°Û°°°Û°Û °°Û ' ° ° ° ° ° ° ' ' ' °°°±±²ÃNow write BOOTCAMP for me!´²±±°°° FUNCTION menu (title$, items$()) CLS ' Clears the screen. var = 1 ' var is the number of menu elements. COLOR 0, 7 ' Inverse colors PRINT title$ ' Print the title! COLOR 7, 0 ' Normal colors FOR x = 1 TO 7 ' Checks the whole array to see if there's a choice there. IF items$(x) <> "" THEN PRINT LTRIM$(STR$(x)); ":" + items$(x): count = x ELSE GOTO start ' Which means... ' IF the array element has something (NOT "") THEN PRINT "x:something" and ' raise count (number of choices) to x. IF the array element doesn't have ' anything ("") THEN assume the list is over and start selection. ' Whew! NEXT start: LOCATE var + 1, 1: COLOR 0, 7: PRINT LTRIM$(STR$(var)); ":" ' ^ Place cursor, invert colors, print the number. DO ' This is the choice selection loop. (Hard to understand) k$ = INKEY$ ' Get the key, put it in k$. ' By the way, CHR$(0) + "H" is the up arrow key, ' CHR$(0) + "P" is down, ' CHR$(0) + "K" is left, ' CHR$(0) + "M" is right. IF k$ <> "" THEN ' IF you hit a key, THEN... LOCATE var + 1, 1: COLOR 7, 0: PRINT LTRIM$(STR$(var)); ":" ' Unhighlight the ' current choice. SELECT CASE k$ ' The mighty SELECT CASE strikes again. CASE CHR$(0) + "H": IF var > 1 THEN var = var - 1 ' If you hit up, and ' you're not at the top, ' go up one. CASE CHR$(0) + "P": IF var < count THEN var = var + 1 ' If you hit down, and ' you're not at the ' bottom, go down one. END SELECT LOCATE var + 1, 1: COLOR 0, 7: PRINT LTRIM$(STR$(var)); ":" ' Highlight the ' current choice. END IF ' For the IF k$ <> "" LOOP WHILE k$ <> CHR$(13) ' Loop while the dude doesn't hit Enter. COLOR 7, 0 ' Reset the normal colors. menu = var ' Return the value of var END FUNCTION ' Did you get all that?