home *** CD-ROM | disk | FTP | other *** search
/ MikeOS 4.5 / mikeos.iso / mikeos.flp / advnture.bas next >
BASIC Source File  |  2014-12-21  |  9KB  |  321 lines

  1.  
  2. REM ------------------------------------------------
  3. REM ADVENTURE 2.3 -- By Justin Tokarchuk
  4. REM For MikeOS and MikeBasic Derivatives
  5. REM ------------------------------------------------
  6.  
  7. REM VARS:
  8. REM $1 = Player Name
  9. REM a = room number
  10. REM b = got note
  11. REM c = got candle
  12. REM d = opened treasure chest
  13. REM e = got key
  14.  
  15. a = 1
  16. b = 0
  17. c = 0
  18. d = 0
  19. e = 0
  20. f = 0
  21. $1 = ""
  22.  
  23. LOGO:
  24.   CLS
  25.   PRINT "          _______     __                     __                     __ " 
  26.   PRINT "         |   _   |.--|  |.--.--.-----.-----.|  |_.--.--.----.-----.|  |"
  27.   PRINT "         |       ||  _  ||  |  |  -__|     ||   _|  |  |   _|  -__||__|"
  28.   PRINT "         |___|___||_____| \___/|_____|__|__||____|_____|__| |_____||__|"
  29.   PRINT " "
  30.   PRINT "         --------------------------------------------------------------"
  31.   PRINT "                        |  A Text-Based Adventure Game  |              "
  32.   PRINT "                         -------------------------------               "
  33.   PRINT ""
  34.   PRINT ""
  35.   PRINT ""
  36.   PRINT ""
  37.  
  38. GETNAME:
  39.   PRINT ""
  40.   PRINT " What do you call yourself?: " ;
  41.   INPUT $1
  42.   IF $1 = "" THEN GOTO GETNAME
  43.  
  44. GETNAMEREMARK:
  45.   RAND X 1 3
  46.   PRINT ""
  47.   PRINT " " ;
  48.   PRINT $1 ;
  49.   if x = 1 then PRINT "! Did your mother even love you? Oh well, it's your name."
  50.   if x = 2 then PRINT "? What kind of name is that! Oh well, not like we can change it."
  51.   if x = 3 then PRINT "!? You aren't from around here, are you?"
  52.   GOSUB PRESSAKEY
  53.   
  54. GOTO GAMEINTRO
  55.  
  56. HELP:
  57.   PRINT ""  
  58.   PRINT " The following are valid commands ingame:"
  59.   PRINT ""
  60.   PRINT " CLS                       - CLEARS THE SCREEN"
  61.   PRINT " LOOK                      - REPRINTS ROOM DESCRIPTION"
  62.   PRINT " INVENTORY                 - VIEW WHAT YOU ARE CARRYING"
  63.   PRINT " NORTH, WEST, SOUTH, EAST  - MOVES TO INPUTTED DIRECTION"
  64.   PRINT " EXAMINE (OBJECT)          - EXAMINES AN OBJECT"
  65.   PRINT " USE (OBJECT)              - USES AN OBJECT"
  66.   PRINT " TAKE (OBJECT)             - TAKES AN OBJECT"
  67.   PRINT " OPEN (OBJECT)             - OPENS A CONTAINER"
  68.   PRINT " UNLOCK (OBJECT)           - ATTEMPTS TO UNLOCK AN OBJECT"
  69.   PRINT " HELP                      - VIEW THESE COMMANDS AGAIN"
  70.   PRINT " EXIT                      - QUITS THE GAME"
  71.   RETURN
  72.  
  73. LOWERCASE:
  74.   J = & $2
  75.   FOR X = 1 TO 20
  76.     PEEK K J
  77.     IF K < 65 THEN GOTO NOTCAPITAL
  78.     IF K > 90 THEN GOTO NOTCAPITAL
  79.     K = K + 32
  80.     POKE K J
  81.     NOTCAPITAL:
  82.     J = J + 1
  83.   NEXT X
  84. RETURN
  85.  
  86. GAMEINTRO:
  87.   PRINT ""
  88.   PRINT " HALLOWEEN NIGHT. The spookiest night of the year! Not very spooky"
  89.   PRINT " in your cruddy room, though. So what if toilet paper takes hours"
  90.   PRINT " to clean off of MR. RAUL's house. Why did I have to get grounded?"
  91.   GOSUB PRESSAKEY
  92.   PRINT " SCREW IT. I am " ;
  93.   PRINT $1 ;
  94.   PRINT ", I am mighty! I will not be held down by parents!"
  95.   PRINT " I'm going to sneak out, and prove to everyone that MR. RAUL's house"
  96.   PRINT " is not haunted!"
  97.   GOSUB PRESSAKEY
  98.   PRINT " You sneak down the stairs from your room, and notice your mother is"
  99.   PRINT " fast asleep on the couch! Opportunity is knocking! You dart through"
  100.   PRINT " your front door and across the street to MR. RAUL's house."
  101.   GOSUB PRESSAKEY
  102.   PRINT " You notice the door is cracked open, you push the door open and walk"
  103.   PRINT " inside."
  104.   GOSUB PRESSAKEY
  105.   PRINT " -- SLAM!! -- Oh no! The door swings shut behind you! -- CLICK! --"
  106.   PRINT " You examine the door to find a padlock holding it shut!"
  107.   GOSUB PRESSAKEY
  108.   GOSUB MOVEROOM
  109.   GOTO PARSER   
  110.  
  111. MOVEROOM:
  112.   IF a = 1 THEN GOSUB R1
  113.   IF a = 2 THEN GOSUB R2
  114.   IF a = 3 THEN GOSUB R3
  115.   IF a = 4 THEN GOSUB R4
  116.   IF a = 5 THEN GOSUB R5
  117.   IF a = 6 THEN GOSUB R6
  118.   RETURN
  119.  
  120. R1:
  121.   PRINT ""
  122.   PRINT " -- The House Entrance -- "
  123.   PRINT " The entrance of the house."
  124.   PRINT " There is a large padlock behind you, barring your freedom." 
  125.   RETURN
  126.  
  127. R2:
  128.   PRINT ""
  129.   PRINT " -- The Dining Room -- "
  130.   PRINT " There is a large table in the middle of the room. There are multiple"
  131.   PRINT " doors going out of this room. You see a large painting."
  132.   RETURN
  133.  
  134. R3:
  135.   PRINT ""
  136.   PRINT " -- The Kitchen -- "
  137.   PRINT " There is a doorway in this room, with the door ripped off of the"
  138.   PRINT " hinges. Odd, you think. The rest of the kitchen seems immaculate."
  139.   RETURN
  140.  
  141. R4:
  142.   PRINT ""
  143.   PRINT " -- The Bathroom -- "
  144.   PRINT " Odd, for being a bathroom there are no windows or methods of"
  145.   PRINT " ventilation."
  146.   IF c = 0 THEN PRINT " There is a candle sitting atop the sink."
  147.   RETURN
  148.  
  149. R5:
  150.   PRINT ""
  151.   PRINT " -- The Bedroom -- "
  152.   PRINT " A door leads back to the dining room." 
  153.   RETURN
  154.  
  155. R6:
  156.   PRINT ""
  157.   PRINT " -- The Basement -- "
  158.   IF c = 1 THEN PRINT " + You light your candle."
  159.   IF c = 1 THEN PRINT " There is a treasure Chest on the floor."
  160.   IF c = 0 THEN PRINT " It is too dark to see anything in here."
  161.   RETURN
  162.  
  163. PARSER:
  164.   x = 0
  165.   PRINT ""
  166.   PRINT "> " ;
  167.   INPUT $2
  168.   GOSUB LOWERCASE
  169.   IF $2 = "cls" THEN CLS
  170.   IF $2 = "help" THEN GOSUB HELP
  171.   IF $2 = "north" THEN GOSUB NORTH
  172.   IF $2 = "n" THEN GOSUB NORTH
  173.   IF $2 = "south" THEN GOSUB SOUTH
  174.   IF $2 = "s" THEN GOSUB SOUTH
  175.   IF $2 = "west" THEN GOSUB WEST
  176.   IF $2 = "w" THEN GOSUB WEST
  177.   IF $2 = "east" THEN GOSUB EAST
  178.   IF $2 = "e" THEN GOSUB EAST
  179.   IF $2 = "look" THEN GOSUB MOVEROOM
  180.   IF $2 = "inventory" THEN GOSUB INVENTORY
  181.   IF $2 = "examine rug" AND a = 1 THEN PRINT " A worn-out, stained old rug."
  182.   IF $2 = "examine table" AND a = 2 THEN PRINT " A grandiose hardwood table."
  183.   IF $2 = "examine table" AND a = 2 AND b = 0 THEN PRINT " A note sits atop it."
  184.   IF $2 = "examine painting" AND a = 2 THEN PRINT " It is a picture of MR. RAUL"
  185.   IF $2 = "take note" AND a = 2 AND b = 0 THEN b = 1
  186.   IF $2 = "take note" AND a = 2 AND b = 1 THEN PRINT " You've taken the note."
  187.   IF $2 = "open treasure chest" THEN GOSUB TREASURECHEST
  188.   IF $2 = "unlock door" AND a = 1 AND e = 1 THEN GOTO GAMEEND
  189.   IF $2 = "use note" THEN GOSUB NOTE
  190.   IF $2 = "read note" THEN GOSUB NOTE
  191.   IF $2 = "take candle" AND a = 4 AND c = 0 THEN GOSUB CANDLE
  192.   IF $2 = "exit" THEN END
  193.   IF $2 = "" THEN PRINT " Confused? Need a hand? Type HELP for a list of commands!"
  194.   GOTO PARSER
  195.  
  196. CANDLE:
  197.   PRINT " + You take the candle from the sink."
  198.   c = 1
  199.   RETURN
  200.  
  201. TREASURECHEST:
  202.   IF a = 6 AND c = 1 THEN e = 1
  203.   IF a = 6 AND e = 1 AND f = 0 THEN PRINT " + You open the treasure chest and take a KEY out of it."
  204.   IF f = 1 THEN PRINT " You already have the treasure!" 
  205.   f = 1
  206.   RETURN    
  207.  
  208. NOTE:
  209.   IF b = 1 THEN PRINT " The note reads:"
  210.   IF b = 1 THEN PRINT " The secret to your freedom lies in a box!"
  211.   RETURN
  212.  
  213. GAMEEND:
  214.   PRINT " You unlock the door and rush outside as you gasp the free air!"
  215.   PRINT " Nightfall is close and you almost had to spend the night! You "
  216.   PRINT " decide that it would be wise to run home before mom wakes."
  217.   PRINT " GAME OVER! Thanks for playing!"
  218.   END
  219.  
  220. INVENTORY:
  221.   PRINT ""
  222.   IF b = 0 AND c = 0 AND e = 0 THEN GOSUB EMPTY
  223.   IF b = 1 THEN PRINT " NOTE"   
  224.   IF c = 1 THEN PRINT " CANDLE"  
  225.   IF e = 1 THEN PRINT " KEY"
  226.   RETURN
  227.  
  228. EMPTY:
  229.   RAND X 1 5
  230.   IF X = 1 THEN PRINT " Nothing. Not even so much as a fly out of your packsack."
  231.   IF X = 2 THEN PRINT " You wonder why your packsack is so light, it's empty."
  232.   IF X = 3 THEN PRINT " Your packsack has a surprising emptyness."
  233.   IF X = 4 THEN PRINT " Apart from several dead flies in your packsack, it's empty."
  234.   IF X = 5 THEN PRINT " You're packsack is full of loot!"
  235.   IF X = 5 THEN PRINT " Not really, it's empty."
  236.   RETURN
  237.  
  238. NODIR:
  239.   RAND X 1 3
  240.   IF x = 1 THEN PRINT " ..So that's how the wall feels on my face. Excellent."
  241.   IF x = 2 THEN PRINT " You cannot go that way."
  242.   IF x = 3 THEN PRINT " You win!"
  243.   IF x = 3 THEN PRINT " .... Just kidding." 
  244.   RETURN
  245.  
  246. NORTH:
  247.   REM -- ENTRANCE TO DINING ROOM --
  248.   IF a = 1 THEN x = 1
  249.   IF a = 1 THEN a = 2
  250.   IF x = 1 THEN GOSUB MOVEROOM
  251.   IF x = 1 THEN RETURN
  252.   REM -- DINING ROOM TO KITCHEN --
  253.   IF a = 2 THEN x = 2
  254.   IF a = 2 THEN a = 3
  255.   IF x = 2 THEN GOSUB MOVEROOM
  256.   IF x = 2 THEN RETURN
  257.   GOSUB NODIR  
  258.   RETURN
  259.  
  260. WEST:
  261.   REM -- ENTRANCE TO BEDROOM --
  262.   IF a = 1 THEN x = 1
  263.   IF a = 1 THEN a = 5
  264.   IF x = 1 THEN GOSUB MOVEROOM
  265.   IF x = 1 THEN RETURN
  266.   REM -- DINING ROOM TO BASEMENT --
  267.   IF a = 2 THEN x = 2
  268.   IF a = 2 THEN a = 6
  269.   IF x = 2 THEN GOSUB MOVEROOM
  270.   IF x = 2 THEN RETURN
  271.   REM -- KITCHEN TO BATHROOM
  272.   IF a = 3 THEN x = 3
  273.   IF a = 3 THEN a = 4
  274.   IF x = 3 THEN GOSUB MOVEROOM
  275.   IF x = 3 THEN RETURN
  276.   GOSUB NODIR
  277.   RETURN
  278.  
  279. SOUTH:
  280.   REM -- DINING ROOM TO ENTRANCE
  281.   IF a = 2 THEN x = 2
  282.   IF a = 2 THEN a = 1
  283.   IF x = 2 THEN GOSUB MOVEROOM
  284.   IF x = 2 THEN RETURN
  285.   REM -- KITCHEN TO DINING ROOM --
  286.   IF a = 3 THEN x = 3
  287.   IF a = 3 THEN a = 2
  288.   IF x = 3 THEN GOSUB MOVEROOM
  289.   IF x = 3 THEN RETURN
  290.   GOSUB NODIR
  291.   RETURN
  292.  
  293. EAST:
  294.   REM -- BATHROOM TO KITCHEN --
  295.   IF a = 4 THEN x = 4
  296.   IF a = 4 THEN a = 3
  297.   IF x = 4 THEN GOSUB MOVEROOM
  298.   IF x = 4 THEN RETURN
  299.   REM -- BEDROOM TO ENTRANCE --
  300.   IF a = 5 THEN x = 5
  301.   IF a = 5 THEN a = 1
  302.   IF x = 5 THEN GOSUB MOVEROOM
  303.   IF x = 5 THEN RETURN
  304.   REM -- BASEMENT TO DINING ROOM --
  305.   IF a = 6 THEN x = 6
  306.   IF a = 6 then a = 2
  307.   IF x = 6 THEN GOSUB MOVEROOM
  308.   IF x = 6 THEN RETURN
  309.   GOSUB NODIR
  310.   RETURN
  311.  
  312. PRESSAKEY:
  313.   PRINT ""
  314.   PRINT " -- Press any key to continue. --"
  315.   WAITKEY X
  316.   PRINT ""
  317.   RETURN
  318.  
  319.  
  320.  
  321.