%This the the code I wrote to test my idea%
var input : boolean
procedure one
put "hello!"
loop
get input
if input = true then put "advancing"
two
end if
if input = false then put "remaining"
end if
exit when input = true
end loop
end one
procedure two
put " area two"
loop
get input
if input = true then put "remaining"
end if
if input = false then put "returning"
one
end if
exit when input = false
end loop
end two
one
%This is the code I wrote for the actual game%
put "You and a band of other adventurers were exploring a dungeon when the "
put "entrance collapsed! Only you made it out, but your survival came at the "
put "expense of your equipment! Now, you find yourself stranded in a strange "
put "cave system, with only one goal: find a way out!"
%VARIABLES
var input : string
var knife : boolean
var potion : boolean
var key : boolean
var sword : boolean
var helmet : boolean
var gold : int
var maxhealth : int
var currenthealth : int
var maxstamina : int
var currentstamina : int
var torch : boolean
var gottenkey : boolean
gottenkey := false
torch := false
knife := false
potion := false
key :=false
sword := false
helmet := false
gold :=0
maxhealth:= 20
currenthealth := 20
maxstamina := 10
currentstamina := 10
%Procedures
%Tutorial segment
procedure entrance
loop
get input
if input = "look" then put "Behind you is a pile of rubble which used to be the "
put "entrance to the dungeon. In front of you is the cave mouth, shrouded in inky "
put "blackness. To your right there flickers a dim torch. (type help for help)"
end if
if input = "inv" then put "You are carrying:"
if gold >0 then put gold, " gold pieces"
if knife = true then put "a knife"
if potion = true then put "a potion"
if key = true then put "a key"
if sword = true then put "a sword"
if helmet = true then put "a helmet"
end if
end if
end if
end if
end if
end if
end if
if input = "get torch" or input ="torch" then put "you pick up the dim torch"
torch :=true
end if
if input = "go forward" or input ="forward" and torch = false then put "The dark makes you uneasy"
end if
if input = "go forward" or input = "forward" and torch = true then put "you advance forward"
end if
if input = "help" then put "inv opens inventory, look looks around, get (object) picks up an object,"
put " go (direction) or just (direction) will move in that direction, and nav open the navigation menu."
end if
exit when input = "go forward" or input = "forward" and torch = true
end loop
end entrance
%tutorial area hallway%
procedure firsthall
put "You are in a long, smooth hallway carved into the rock of the cave. "
put "Immediately to your left is a large doorway. Ahead and to your right is another"
put "gaping hole in the wall. Straight ahead is a large gate with an oversized lock"
put "on it."
loop
get input
if input = "look" then put "You are in a long, smooth hallway carved into the rock of the cave. "
put "Immediately to your left is a large doorway. Ahead and to your right is another"
put "gaping hole in the wall. Straight ahead is a large gate with an oversized lock"
put "on it."
end if
if input = "inv" then put "You are carrying:"
if gold >0 then put gold, " gold pieces"
if knife = true then put "a knife"
if potion = true then put "a potion"
if key = true then put "a key"
if sword = true then put "a sword"
if helmet = true then put "a helmet"
end if
end if
end if
end if
end if
end if
end if
if input = "help" then put "inv opens inventory, look looks around, get (object) picks up an object,"
put " go (direction) or just (direction) will move in that direction, and nav open the navigation menu."
end if
if input = "left" or input = "go left" then keyroomONE
if input = "right" or input = "go right" then tut_goldroom
if input = "forward" or input = "go forward" and key = false then tut_gate_nokey
if input = "forward" or input = "go forward" and key = true then tut_gate_key
end if
end if
end if
end if
exit when input = "forward" or input = "go forward" and key = true
end loop
end firsthall
%First Keyroom%
procedure keyroomONE
put "The room to your left is carved equally smoothly out of the solid rock. The room seems completely"
put "barren at first, but the light of your torch reflects of a small object in the center of the room."
put "It is a key!"
loop
get input
if input = "look" then put "The room to your left is carved equally smoothly out of the solid rock. The room seems completely"
put "barren at first, but the light of your torch reflects of a small object in the center of the room."
put "It is a key!"
end if
if input = "look key" then put "It is hard to see from the doorway of the room, but the key seems gold or brass, and about the"
put "right size to fit the lock on the gate you saw earlier."
end if
if input = "inv" then put "You are carrying:"
if gold >0 then put gold, " gold pieces"
if knife = true then put "a knife"
if potion = true then put "a potion"
if key = true then put "a key"
if sword = true then put "a sword"
if helmet = true then put "a helmet"
end if
end if
end if
end if
end if
end if
end if
if input = "help" then put "inv opens inventory, look looks around, get (object) picks up an object,"
put " go (direction) or just (direction) will move in that direction, and nav open the navigation menu."
end if
if input = "key" or input = "get key" and gottenkey = false then put "You notice the key is strangely warm as you slip it into your"
put "pocket. Gained ONE KEY!"
gottenkey := true
end if
if input = "key" or input = "get key" and gottenkey = true then put "You already have the key."
end if
if input = "go back" or input = "back" or input = "return" or input = "door" then firsthall
end if
exit when input = "go back" or input = "back" or input = "return" or input = "door"
end loop
end keyroomONE
%opening the gate with the key%
procedure tut_gate_key
put "The key slides in easily and the gate vanishes. You head forward, eager to escape,"
put "but when you look behind you there is naught but a solid stone wall."
main_entrance
end tut_gate_key
|