my 2nd IF adventure

Discuss whatever you want here--both QB and non-QB related. Anything from the DEF INT command to the meaning of life!

Moderators: Pete, Mods

Post Reply

Is this game worth playing?

YES!
2
33%
MABY...
3
50%
NAH...
1
17%
 
Total votes: 6

User avatar
bongomeno
Veteran
Posts: 231
Joined: Wed Dec 10, 2008 9:08 am
Location: San Bernardino CA
Contact:

my 2nd IF adventure

Post by bongomeno » Sun Jan 18, 2009 1:31 pm

:evil: Hey, everyone! I made a new IF game! :twisted:

I spent about 2 days making it. It still could use some work.

I would appreciate any comments or suggestions for this game or any future game that i might make.

The game is simple and shouldnt take tooooo long to beat.
If you get stuck then just do ctrl+break and veiw the code to see what commands you can use at the moment or just type help.

Here is the code...

Code: Select all

REM MAGIC REALM - Geek Basic Software

REM PROGRAMMED BY : Gemino Michael Smothers
REM EMAIL         : bongo_meno@yahoo.com
REM HOME          : http://www.freewebs.com/geekbasic

REM This is my 2nd IF game, my 1st was Haunted House.
REM I spent about 2 days making this game.
REM Magic Realm is fairly short, but it is worth playing if you want a short game.
REM Plase email me if you have questions, comments, ideas for future IF games or would
REM like to report a bug.

LET r = 1
LET gotnote = 0
LET gotrune = 0
LET gotcart = 0
LET gotkey = 0
LET gothammer = 0
LET gotlantern = 0
LET dresser = 1
LET closet = 1
LET giant = 1

COLOR 11, 1
CLS

PRINT "                   WELCOME TO MAGIC REALM BY GEEK BASIC SOFTWARE!"
PRINT
PRINT "YOU START TO WAKE UP FROM A DEEP SLEEP..."
PRINT "YOU HAVE NO CLUE WHERE YOU ARE."
PRINT "THE LAST THING YOU REMEMBER IS AN OLD MAN WITH BLUE ROBES AND A STAFF."
PRINT "HE RAISED HIS STAFF AND EVERYTHING FADED OUT TO WHITE..."
DO: LOOP UNTIL INKEY$ <> ""

DO
CLS
PRINT "                      MAGIC REALM BY GEEK BASIC SOFTWARE"
PRINT
PRINT "                                      N"
PRINT "*---------------------------------* W + E *------------------------------------*"
PRINT "                                      S"
PRINT
PRINT "TYPE HELP IF YOU GET STUCK."
PRINT
GOSUB room
GOSUB parser
LOOP

room:
IF r = 1 THEN : GOSUB r1
IF r = 2 THEN : GOSUB r2
IF r = 3 THEN : GOSUB r3
IF r = 4 THEN : GOSUB r4
IF r = 5 THEN : GOSUB r5
IF r = 6 THEN : GOSUB r6
IF r = 7 THEN : GOSUB r7
IF r = 8 THEN : GOSUB r8
IF r = 9 THEN : GOSUB r9
IF r = 10 THEN : GOSUB r10
IF r = 11 THEN : GOSUB r11
RETURN

parser:
PRINT
LINE INPUT "> "; cmd$
LET cmd$ = LTRIM$(RTRIM$(UCASE$(cmd$)))
IF cmd$ = "END" OR cmd$ = "QUIT" OR cmd$ = "EXIT" OR cmd$ = "Q" OR cmd$ = "BYE" THEN
END
END IF
IF cmd$ = "HELP" OR cmd$ = "H" OR cmd$ = "?" THEN
CLS
PRINT "HERE ARE SOME BASIC COMMANDS THAT CAN BE USED IN THE GAME..."
PRINT
PRINT "LOOK                         - CHECK FOR AVAILABLE EXITS"
PRINT "NORTH, EAST ,SOUTH, AND WEST - MOVE TO AN AVAILABLE LOCATION"
PRINT "EXAMINE (OBJECT)             - EXAMINE AN OBJECT"
PRINT "USE (OBJECT)                 - USE AN OBJECT"
PRINT "READ (OBJECT)                - READ AN OBJECT"
PRINT "UNLOCK (OBJECT)              - UNLOCK AN OBJECT"
PRINT "TAKE (OBJECT)                - TAKE OR MOVE AN OBJECT"
PRINT "TALK                         - TALK TO SOMEONE"
PRINT "INVENTORY                    - VIEW YOUR INVENTORY"
PRINT "HELP                         - VIEW THIS SCREEN"
PRINT "END                          - END GAME"
PRINT
PRINT "PRESS ANY KEY..."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF cmd$ = "LOOK AROUND" OR cmd$ = "LOOK" OR cmd$ = "L" THEN
CLS
IF r = 1 THEN : PRINT "YOU CAN MOVE NORTH AND EAST."
IF r = 2 THEN : PRINT "YOU CAN MOVE NORTH, EAST, AND SOUTH."
IF r = 3 THEN : PRINT "YOU CAN MOVE WEST."
IF r = 4 THEN : PRINT "YOU CAN MOVE NORTH, EAST, SOUTH, AND WEST."
IF r = 5 THEN : PRINT "YOU CAN MOVE EAST."
IF r = 6 THEN : PRINT "YOU CAN MOVE SOUTH."
IF r = 7 THEN : PRINT "YOU CAN MOVE WEST."
IF r = 8 THEN : PRINT "YOU CAN MOVE EAST AND WEST."
IF r = 9 THEN : PRINT "YOU CAN MOVE NORTH AND WEST."
IF r = 10 THEN : PRINT "YOU CAN MOVE NORTH AND SOUTH."
IF r = 11 THEN : PRINT "YOU CAN MOVE SOUTH."
PRINT
PRINT "PRESS ANY KEY..."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF cmd$ = "INVENTORY" OR cmd$ = "INV" OR cmd$ = "ITEMS" OR cmd$ = "I" THEN
CLS
PRINT "INVENTORY..."
PRINT
IF gotrune = 1 THEN : PRINT "RUNESTONE"
IF gotcart = 1 THEN : PRINT "CART"
IF gothammer = 1 THEN : PRINT "HAMMER"
IF gotkey = 1 THEN : PRINT "KEY"
IF gotnote = 1 THEN : PRINT "NOTE"
IF gotlantern = 1 THEN : PRINT "LANTERN"
PRINT
PRINT "PRESS ANY KEY..."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF cmd$ = "GO NORTH" OR cmd$ = "NORTH" OR cmd$ = "N" THEN
IF r = 1 THEN : LET r = 2: GOTO moved
IF r = 2 THEN : LET r = 4: GOTO moved
IF r = 4 THEN : LET r = 6: GOTO moved
IF r = 9 THEN : LET r = 10: GOTO moved
IF r = 10 THEN : LET r = 11: GOTO moved
END IF
IF cmd$ = "GO EAST" OR cmd$ = "EAST" OR cmd$ = "E" THEN
IF r = 1 THEN : LET r = 3: GOTO moved
IF r = 2 THEN : LET r = 8: GOTO moved
IF r = 4 THEN : LET r = 7: GOTO moved
IF r = 5 THEN : LET r = 4: GOTO moved
IF giant = 0 AND r = 8 THEN : LET r = 9: GOTO moved
END IF
IF cmd$ = "GO SOUTH" OR cmd$ = "SOUTH" OR cmd$ = "S" THEN
IF r = 2 THEN : LET r = 1: GOTO moved
IF r = 4 THEN : LET r = 2: GOTO moved
IF r = 6 THEN : LET r = 4: GOTO moved
IF r = 10 THEN : LET r = 9: GOTO moved
IF r = 11 THEN : LET r = 10: GOTO moved
END IF
IF cmd$ = "GO WEST" OR cmd$ = "WEST" OR cmd$ = "W" THEN
IF r = 3 THEN : LET r = 1: GOTO moved
IF r = 4 THEN : LET r = 5: GOTO moved
IF r = 7 THEN : LET r = 4: GOTO moved
IF r = 8 THEN : LET r = 2: GOTO moved
IF r = 9 THEN : LET r = 8: GOTO moved
END IF
IF (cmd$ = "EXAMINE NOTE") AND gotnote = 0 AND r = 1 THEN
CLS
PRINT "IT IS A SMALL NOTE WITH WRITING AND A PICTURE ON IT."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "EXAMINE LANTERN") AND gotlantern = 0 AND r = 2 THEN
CLS
PRINT "THIS COULD BE HELPFUL IF YOU EEVER FIND YOURSELF IN A DARK PLACE."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "EXAMINE BEAUTIFUL FLOWERS" OR cmd$ = "EXAMINE FLOWERS") AND r = 2 THEN
CLS
PRINT "THERE ARE 69105 OF THEM."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "EXAMINE BIRDS") AND r = 2 THEN
CLS
PRINT "THEY ARE LARGE BLUE AND UGLY..."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "EXAMINE RUNESTONE" OR cmd$ = "EXAMINE STONE" OR cmd$ = "EXAMINE RUNE") AND r = 3 THEN
CLS
PRINT "IT IS SHINY, AND IS INLAID WITH RUNIC WRITING."
PRINT "IT IS TOO BIG TO CARRY WITH YOUR BARE HANDS..."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "EXAMINE DRESSER") AND dresser = 1 AND r = 5 THEN
CLS
PRINT "IT IS MADE OF WOOD. IT IS WORN AND HAS CHIPS IN IT."
PRINT "THERE IS A LARGE RUSTY LOCK KEEPING IT CLOSED."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "EXAMINE KEY") AND gotkey = 0 AND dresser = 0 AND r = 5 THEN
CLS
PRINT "THIS IS FOR UNLOCKING SOMETHING."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "EXAMINE HAMMER") AND gothammer = 0 AND r = 6 THEN
CLS
PRINT "GOOD FOR SMASHING THINGS!"
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "EXAMINE CLOSET") AND r = 7 THEN
CLS
PRINT "IT IS BIG AND MADE OF WOODEN. DONT EVEN THINK ABOUT BREAKING THROUGH THE DOOR."
PRINT "THERE IS A KEYHOLE IN THE DOOR."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "EXAMINE CART") AND closet = 0 AND gotcart = 0 AND r = 7 THEN
CLS
PRINT "IT IS A WOODEN CART WITH WHEELES. YOU COULD USE IT TO TOW SOMETHING BIG."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "TAKE NOTE" OR cmd$ = "GET NOTE") AND gotnote = 0 AND r = 1 THEN
LET gotnote = 1
END IF
IF (cmd$ = "TAKE LANTERN" OR cmd$ = "GET LANTERN") AND gotlantern = 0 AND r = 2 THEN
LET gotlantern = 1
END IF
IF (cmd$ = "TAKE RUNESTONE" OR cmd$ = "TAKE RUNE" OR cmd$ = "TAKE STONE" OR cmd$ = "GET RUNESTONE" OR cmd$ = "GET RUNE" OR cmd$ = "GET STONE") AND gotrune = 0 AND r = 3 THEN
CLS
IF gotcart = 1 THEN
LET gotrune = 1
PRINT "YOU LOAD THE BIG RUNE ON TO THE CART."
ELSE
PRINT "IT IS WAY TOO HEAVY."
END IF
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "TAKE KEY" OR cmd$ = "GET KEY") AND dresser = 0 AND r = 5 THEN
LET gotkey = 1
END IF
IF (cmd$ = "TAKE HAMMER" OR cmd$ = "GET HAMMER") AND r = 6 THEN
LET gothammer = 1
END IF
IF (cmd$ = "TAKE CART" OR cmd$ = "GET CART") AND closet = 0 AND gotcart = 0 AND r = 7 THEN
LET gotcart = 1
END IF
IF (cmd$ = "READ NOTE" OR cmd$ = "USE NOTE") THEN
CLS
PRINT "YOU READ THE NOTE. IT SAYS: 'HELLO, THERE! I AM THE GREAT WIZZARD"
PRINT "BONGO! I HAVE TELEPORTED YOU TO A LAND FAR AWAY FROM WHERE YOU WERE."
PRINT "I NEED YOU TO DO SOMETHING FOR ME. THERE IS A GREAT ENTITY LIVING"
PRINT "NEARBY YOUR LOCATION. THAT CERTAIN ENTITY IS WHAT KILLED OFF ALL OF"
PRINT "THE LOCALS NEARBY. IF THE ENTITY AWAKENS, IT COULD HAVE THE POWER"
PRINT "TO DESTROY THE WORLD! ITS TIME TO AWAKEN IS ALMOST UP. WHAT I AM"
PRINT "ASKING YOU TO DO IS TO FIND IT AND DELAY ITS AWAKENING."
PRINT "IT WILL TAKE THE POWER OF THE OLD RUNES TO DO THIS..."
PRINT "I WISH I COULD TELL YOU MORE, BUT I AM BUSY WORKING ON A WAY TO KILL"
PRINT "THE ENTITY. ONCE YOU HAVE COMPLETED YOUR MISSION, I WILL TELEPORT"
PRINT "YOU BACK TO YOUR LANDS AND KILL THE ENTITY FOR ALL ETERNITY!!!"
PRINT "GOOD LUCK."
PRINT "           ~ BONGO'"
PRINT "YOU SEE A PICTURE OF A RUNESTONE AT THE BOTTOM OF THE NOTE."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "USE HAMMER") AND gothammer = 1 AND dresser = 1 AND r = 5 THEN
CLS
LET dresser = 0
PRINT "YOU SMASH THE DRESSER INTO PIECES!"
PRINT "A KEY FALLS OUT OF IT ONTO THE FLOOR."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "UNLOCK CLOSET" OR cmd$ = "USE KEY") AND gotkey = 1 AND closet = 1 AND r = 7 THEN
CLS
LET closet = 0
PRINT "YOU UNLOCK THE CLOSET AND OPEN IT."
PRINT "YOU SEE A CART INSIDE."
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "TALK" OR cmd$ = "TALK TO GIANT") AND giant = 1 AND r = 8 THEN
CLS
PRINT "THE GIANT ASKS YOU FOR THE CODE."
PRINT "TRY TO GUESS IT..."
LINE INPUT "> "; code$
LET code$ = UCASE$(code$)
IF code$ = "XYZZY" THEN
LET giant = 0
PRINT "GIANT SAYS: THATS IT! IM SORRY, PLEASE ALLOW ME TO HELP YOU OVER THE HILL."
ELSE
PRINT "GIANT SAYS: THATS NOT THE CODE! GO AWAY!"
END IF
DO: LOOP UNTIL INKEY$ <> ""
END IF
IF (cmd$ = "USE RUNESTONE" OR cmd$ = "USE RUNE" OR cmd$ = "USE STONE") AND gotrune = 1 AND r = 11 THEN
GOTO win
END IF
moved:
RETURN

r1:
PRINT "YOU ARE STAINDING IN THE MIDDLE OF THE REMAINS OF AN OLD CASTLE."
PRINT "YOU FEEL SOME MAGICAL PRESENCE HERE."
IF gotnote = 0 THEN : PRINT "YOU SEE A NOTE ON THE GROUND."
RETURN

r2:
PRINT "YOU ENTER A BEAUTIL FIELD OF FLOWERS."
PRINT "THEY RANGE FROM A VARIETY OF COLORS."
PRINT "SEVERAL BIRDS SOAR ABOVE YOU. THEY ARE PROBABLY LOOKING FOR FOOD."
IF gotlantern = 0 THEN : PRINT "YOU SEE A LANTERN SITTING UPRIGHT ON A BIG ROCK."
RETURN

r3:
PRINT "YOU ARE PASSING THROUGH A CLEARING IN A SMALL FORREST OF TREES."
PRINT "THERE SEEMS TO BE NO WAY OUT OTHER THAN THE WAY YOU CAME IN,"
PRINT "BECAUSE IT IS SURROUNDED BY HILLS."
IF gotrune = 0 THEN : PRINT "A HUGE STONE WITH RUNIC WRITING SITS IN THE CENTER OF THE CLEARING."
RETURN

r4:
PRINT "YOU ARE WALKING DOWN THE CENTER OF A GHOST TOWN."
PRINT "YOU ARE SURROUNDED BY A FEW SMALL BUILDINGS."
PRINT "THIS TOWN HAS BE DEAD FOR A LONG TIME."
RETURN

r5:
PRINT "YOU ENTER A VERY SMALL HOUSE."
PRINT "MOST FURNITURE IS ALL COMPLETELY DESTROYED AND ROTTING AWAY."
IF dresser = 1 THEN : PRINT "THERE IS A SMALL DRESSER IN THE CORNER."
IF dresser = 0 AND gotkey = 0 THEN : PRINT "YOU SEE A KEY BY THE SMASHED DRESSER."
RETURN

r6:
PRINT "YOU ENTER THE LOCAL MARKET."
PRINT "THERE ARE SMALL TRINKETS AND CONTAINERS OF WHAT USED TO BE FOOD."
IF gothammer = 0 THEN : PRINT "THERE IS A HAMMER IN THE MIDDLE OF THE FLOOR."
RETURN

r7:
PRINT "YOU ENTER A MEDIUM SIZED HOUSE."
PRINT "THROUGH THE WINDOW, YOU CAN SEE A GRAND VIEW OF THE HILL SIDE."
PRINT "THERE IS A BIG HARD WOOD DOOR IN THE WALL THAT LEADS TO A CLOSET."
IF closet = 1 THEN : PRINT "IT APPEARS TO BE LOCKED."
IF closet = 0 AND gotcart = 0 THEN : PRINT "YOU SEE A CART IN THE CLOSET."
RETURN

r8:
IF giant = 1 THEN
PRINT "THERE IS A GIANT BLOCKING YOUR PATH."
PRINT "GIANT SAYS: 'HALT! YOU DO NOT HAVE MY PERMISSION TO PASS OVER THIS HILL!"
PRINT "MY LEADER HAS ORDERED ME TO PROTECT THIS HILL FROM TRAVELERS."
PRINT "ONLY THOSE WHO KNOW THE SECRET CODE MAY PASS.'"
PRINT "YOU NOTICE AN EMBLEM ENGRAVED IN HIS ARM... IT SAYS: 'XYZZY'"
ELSE
IF gotcart = 1 THEN
PRINT "YOU CLIMB INTO THE CART AND THE GIANT TAKES YOU TO THE TOP OF THE HILL."
ELSE
PRINT "THE GIANT TAKES YOU TO THE TOP OF THE HILL."
END IF
PRINT "YOU CAN SEE THE WHOLE TOWN FROM HERE."
PRINT "IN THE DISTANCE, YOU CAN ALSO SEE WHAT APPEARS TO BE A CAVE."
PRINT "THE GIANT CARRIES YOU BACK DOWN TO THE OTHER SIDE OF THE HILL AND DROPS YOU OFF."
END IF
RETURN

r9:
PRINT "YOU ARE STANDING IN A GRASSY PLAIN."
PRINT "NOT FAR FROM HERE, YOU CAN SEE THE ENTERANCE A CAVE."
RETURN

r10:
IF gotlantern = 0 THEN
LET r = 9
PRINT "AS YOU ENTER THE CAVE, YOU DECIDE THAT IT IS TOO DARK AND YOU CANT SEE ANYTHING."
PRINT "YOU HEAD BACK OUT."
DO: LOOP UNTIL INKEY$ <> ""
GOTO moved
ELSE
PRINT "YOU LIGHT YOUR LANTERN AND GO INSIDE THE CAVE."
PRINT " IT IS DARK AND THE AIR IS HUMID."
END IF
RETURN

r11:
PRINT "YOU FIND A MASSIVE ROOM IN THE CAVE, IT IS ILLUMINATED BY A SERIES"
PRINT "OF HOLES IN THE ROOF THAT SEEM TO TAKE THE FORM OF RUNIC TEXT."
RETURN

win:
COLOR 14, 1
CLS
PRINT "YOU FIDDLE WITH THE RUNESTONE FOR A WHILE..."
PRINT "SUDDENLY EVERYTHING STARTS TO FADE TO BLACK!"
PRINT "YOU HEAR A LOUD WHIZZING NOISE."
PRINT "AFTER A FEW SECONDS, EVERYTHING STOPS."
PRINT "SLOWLY, YOU OPEN YOUR EYES."
PRINT "YOU ARE LYING ON YOUR BACK IN THE GRASS, YOU ARE BACK HOME."
PRINT "AS YOU START TO GET UP, YOU HEAR A FAINT VOICE SAY: 'THANK YOU"
PRINT "BRAVE ADVENTURER! YOU HAVE COMPLETED YOUR MISSION. YOU HAVE HELPED ME"
PRINT "IN DESTROYING THE ENTITY THAT COULD HAVE DESTROYED THE WORLD!"
PRINT "IF YOU EVER NEED ANYTHING, JUST CALL ME AT 1-666-6666."
DO: LOOP UNTIL INKEY$ <> ""
END
Home: http://www.geekbasic.com" target="_blank
Forum: http://www.geekbasic.com/index.gbws?$page=forumsmain" target="_blank
QB64 powered web server: http://www.geekbasic.com/index.gbws?$pa ... inter=%201" target="_blank

User avatar
sid6.7
Veteran
Posts: 318
Joined: Tue Jun 21, 2005 8:51 am
Location: west USA
Contact:

Post by sid6.7 » Mon Jan 19, 2009 3:51 pm

its a good start...

bungytheworm
Veteran
Posts: 288
Joined: Sat Feb 18, 2006 4:02 pm

Post by bungytheworm » Wed Jan 21, 2009 6:08 am

I dont have a QB here and now so cant test. Sorry :( But ill try it asap i get my own laptop back from my girlfriend.

By the code, it reminds me days back at 80's. I made similar type IF...THEN...GOTO games. It is a good start. Dont give up and most of all, do not throw away those codes no matter how you feel about them later.

I would give my right hand and left leg if i could get back all those codes i made back at 80's.[/u]

Post Reply