Older Version Newer Version

ChrisIverson ChrisIverson Jan 27, 2008

This is actually Noble D. Bell's Text Adventure Engine, with slight modifications by me. I am posting it here for accessibility purposes.

' **********************************************************************************************************************
' * TEXT ADVENTURE ENGINE                                                                                              *
' * RELEASE 1.0.0  - FREEWARE                                                                                          *
' * BY NOBLE D. BELL (http://www.noblebell.com)                                                                        *
' *                                                                                                                    *
' * NOTICE:                                                                                                            *
' * You are free to use this text game engine for any use. The author, Noble D. Bell, is not responsible in any way    *
' * for the use or misuse of this engine. If you do make changes or modifications to the code I require that you email *
' * me the revised code.                                                                                               *
' **********************************************************************************************************************

' REVISIONS:
'   * February 5, 2006 - OFFICIAL RELEASE 1.0.0

' TO DO:
'   * Add: LIGHT / EXTINGUISH commands for using a light source
'   * Program: LEARN / CAST for magic spells

 
' ======================================================================================================================
' PROGRAM STARTS HERE
' ======================================================================================================================
    ' Every LB'er should know what this is for.
    NOMAINWIN
 
    ' Setup the Window that will be used to play the game.
    GOSUB [Setup.GUI]
 
 
    ' Setup global variables for True/False
    GLOBAL TRUE,FALSE
    TRUE = 1
    FALSE = 0
 
    ' Setup global variables that will be used throughout the game.
    ' score - the current score for the player, turns - the number of turns the player has taken
    ' rm - the current room the player is in, maxinventory - the total number of items the player can pack
    ' inventorycount - the total number of items the player is carrying, OK - used as a flag
    ' maxhits - the max number of damage a player can take, hits - the total points of damage the player has taken
    ' defense - the number needed to hit a player, offense - the amount of damage a player can inflict
    ' gold - the amount of money the player has, maxmp - the total amount of magic the player can wield
    ' mp - the total amount of magic the player has left, armor$ - the type of armor the player is wearing
    ' weapon$ - the type of weapon the player is wielding, encounter - flag indicating a current battle
    ' lantern - a flag indicating if the lantern is on or off, needlight - a flag indicating if an area is dark or not
    ' noun - the number of the selected noun, verb - the number of the selected verb
    ' gametitle$ - the title of your game, gamedescription - the description of your game, crlf$ - carriage return/linefeed

    GLOBAL score,turns,maxscore,rm,maxinventory,inventorycount,OK
    GLOBAL maxhits,hits,defense,offense,gold,maxmp,mp,armor$,weapon$
    GLOBAL encounter,lantern,needlight,noun,verb
    GLOBAL gametitle$,gamedescription$,crlf$
 
    ' Special game variables and arrays
    ' rooms$(100) - This contains the description for each room in the game upto 100 rooms.
    ' roomProperties(100, 2) - Determines if the room is available for teleporting.
    ' exits(100,15) - This contains the visible exits in each room
    ' help$(100) - This contains some help or a clue for a particular room in the game.
    ' objects$(100) - Contains a list of objects the player can interact with in the game upto 100.
    ' objectproperties(100,7) - Contains a list of different properties about an object in the game.