!\ Okay, so this is the code to the game I wrote while trying to learn the basics of Hugo.
As you can see, I started off with the shell.hug file and added from there.
I ended up borrowing code from Guilty Bastards, Spur, sample.hug, and help from others
(who I don't want to incriminate by saying their names).
In any case, it's my hope that despite my ugly coding, some things might be easier for
newbies to understand (like, getting NPCs to follow and basic NPC interaction) just
because this game is so simplistic.
Unfortunately, this game is pretty juvenile and was originally only written as an
inside joke between my siblings and I. I apologize if the tone offends you; I did
edit out some of the swears and what not.
\!
prompt = ">"
color TEXTCOLOR, BGCOLOR
MAX_SCORE = 30
MAX_RANK = 4
ranking[0] = "Jerk-Faced Loser"
ranking[1] = "The Ponginator"
ranking[2] = "King Pong"
ranking[3] = "Spartacus Jonez"
cls
"You dreaded this day. In fact, you wish it was still nothing more
than a cold-sweat-inducing nightmare that woke you in the darkest hours
of the night. Alas, the day has come that you would need Anne's help.\n"
Font(BOLD_ON | DEFAULT_FONT)
"Anne and the Terrordome of Evil"
Font(BOLD_OFF)
"An Interactive True Story\n"
print BANNER
player = you ! player initialization
location = emptyroom
old_location = location
move player to location
FindLight(location)
DescribePlace(location)
location is visited
CalculateHolding(player)
#ifset PRECOMPILED_LIBRARY
replace main
{
#else
routine main
{
#endif
counter = counter + 1
PrintStatusLine
run location.each_turn
runevents
RunScripts
if parent(speaking)~=location
speaking = 0
}
!\ I put this stuff in here to see if I could get resources to work.
It worked fine with the 32-bit DOS interpreter, but I had actually been confused
about whether the other DOS interpreters have any kind of sound or graphic
capabilities... I guess they don't.
player_character you "you"
{
nouns "me"
long_desc
{
"You are as cool as twelve velvet Elvis's and a bag of Cheetos.\n"
}}
room emptyroom "Entrance to the Terrordome of Evil"
{
long_desc
{
"To the west is the Terrordome of Evil. By golly, it looks fun!\n\n
There seems to be activity to the east.\n"
}
cant_go {
"There's nothing of interest in that direction.\n"
}
w_to {
if Anne is not blah
{"As much as you'd like to go to the Terrordome of Evil, you lack the
courage to do it alone."}
else
{print "With Anne following you around like a lame little hell-puppy, you confidently
stroll into the Terrordome of Evil. It's everything you hoped it would be.\n"
score = score + 10
endflag = 1}
}
in_to { return self.w_to }
e_to {
!\ sound "anne_snd", "ding", 100
One of the times that I tested the sound resources.
\!
return anneroom
}
}
object terrordome "Terrordome of Evil"
{
in emptyroom
nouns "terrordome" "evil"
adjectives "terrordome" "of"
long_desc
{"Wow! You can't wait to enter it!"}
is hidden
is static
}
object activity "activity"
{
in emptyroom
nouns "activity"
long_desc
{"You can't see much from here."}
is hidden
is static
}
room anneroom "Temple of Anne"
{
nouns "temple"
adjectives "temple" "of"
long_desc
{"This is where Anne sits and worships herself. You feel like
burning it all down but somehow manage to resist the urge.
Besides the exit to the west, there is also a cloud of darkness
to the south.\n"}
w_to { return emptyroom }
s_to {print "\nAs you approach the cloud of darkness, it becomes
apparent that it isn't actually darkness, persay. Truthfully, it
actually seems to be a...\n"
return daveroom}
}
attribute blah alias special
character anne "Anne"
{
in anneroom
noun "anne"
short_desc
{
"Anne is here, worshipping herself.\n"
self is moved
}
long_desc
{
"Anne reminds you why it's so cool to be you and not
someone like her.\n"
}
before
{
object DoKiss
{ "You don't want to put your lips on that!"}
}
after
{
xobject DoGive
{
select object
case belt
{
print "Naw, that'd be silly. Anne just has to earn it someday like
a real man."
return true
}
case else
return false
}
xobject DoShow
{
select object
case belt
{
if (Anne is not blah)
{ "\"Wow, you must've beat Dave. I am truly in awe of your
mad ping-ponginating skillz. I shall follow you
to the ends of the earth, so that I may learn
the Way of the True Ping Pong Master.\""
Activate(anne_following)
Anne is blah
score = score + 10
}
else
"You don't need to rub it in."
}
case else
return false
}
object DoAsk
{
select xobject
case anne
"\"I'm the coolest thing since
ChiPs, yo.\""
case anneroom
"\"This place rocks.\""
case belt
"\"The one who holds the championship
ping pong belt has the respect and admiration
of millions. I'd follow that person to the ends
of the earth. One day, I will wear it myself.\"\n
\n
You hold back a guffaw."
case dave
"\"He bites my ass. What can I say?\""
case else
"Anne's eyes start glazing over and drool
dribbles out of the corner of her mouth.
I guess she doesn't know anything about
that.\""
}
}
}
event in anne
{
if (Anne is not blah)
{
if (belt is worn)
{print "Anne notices the shiny golden goodness that is your
ping pong championship belt."
Perform( &DoShow, belt, Anne)
}
}
}
daemon anne_following
{
timer 0
}
event in anne_following
{
if anne in location or location = old_location ! no need to follow
return
! Deal with special following messages for certain locations:
select location
! locations:
case daveroom ! Cloud of Ugly
{
"\nAnne follows you into the cloud."
}
case anneroom ! Temple of Anne
{
if old_location = daveroom
"\nAnne exits the Cloud of Ugly and
follows you back to the temple."
else
"\nAnne follows you back to the temple."
}
case emptyroom
{
if old_location = anneroom
"\nAnne follows you west."
}
move anne to location
}
scenery cloud "cloud of darkness"
{
in anneroom
noun "cloud" "darkness"
adjective "cloud" "of"
article "the"
long_desc {"It's certainly a strange thing. There's no logical
reason for the cloud of darkness to the south."}
door_to ! so a player can "go cloud"
{return daveroom}
before
{
object DoEnter
{
return daveroom
}
}
}
room daveroom "Cloud of Ugly"
{
long_desc
{"You are choking in a big cloud of Ugly. It's definitely not
fun. Escape is to the north.\n"}
n_to {return anneroom}
}
object pingpong "ping pong table"
{
in daveroom
nouns "pong" "table" "paddles" "ball"
adjectives "ping" "pong"
short_desc
{"Surprisingly enough, there is a ping pong table here.\n"}
long_desc
{"You almost missed it in this whole cloud of Ugly, but there's no
denying that yes, there's a ping pong table, complete with paddles
and everything.\n"}
before
{
object DoGet
{ "You don't need to take that, but feel free to play some
wild and crazy ping pong!" }
}
is static
}
character dave "Dave"
{
in daveroom
noun "dave" "david"
adjective "ugly"
short_desc
{
"It's obvious that the source of all of the ugliness is Dave,
who is standing nearby, doing stupid Dave things. He holds a ping pong
championship belt.\n"
self is moved
}
long_desc
"In ancient times, Dave is what would've been called a \"jerk-faced loser.\"
You do your best to not slap him around.\n"
before
{
parent(object) DoGet
{
"Dave holds ";
The(object)
" away from you. \"Easy there, leadbelly.\""
}
object DoKiss
{
"You don't want to put your lips on that!"
}
}
after
{
object DoAsk
{
select xobject
case anne
"\"Ha! She thinks she can beat me at
ping pong, but we all know she can't hang. At least, she does
everything I say because I am the True Ping Pong Champion.\""
case dave
"\"What can I say? I'm the best there
ever was.\""
case belt
"\"This proves that I am as great in ping
pong as I am ugly!\""
case cloud
"\"It's not much, but I call it home.\""
case else
"Dave's eyes start glazing over and drool
dribbles out of the corner of his mouth.
I guess he doesn't know anything about
that.\""
}
}
}
object belt "championship ping pong belt"
{
in dave
noun "belt"
adjective "championship" "ping" "pong"
long_desc
{
"The belt seems to almost have a certain glow to it."
}
article "a"
is hidden
is clothing
}
!----------------------------------------------------------------------------
! NEW VERB ROUTINES
!----------------------------------------------------------------------------
routine DoRead
{
select object
case belt
{"Etched into its face are the words, \"He who wears this belt
is truly master over the wannabes.\""}
else
{
"There's nothing to read there."
}
}
routine DoChoke
{
if (player in daveroom)
{"That goes without saying."}
else
"But why?"
}
routine DoEscape
{
if (player in daveroom)
{return anneroom}
else
"But where?"
}
routine DoPing
{
if player not in daveroom
"There's no ping pong table here!"
else
{
if Dave in Daveroom
{ print "You ask Dave to play a game of ping pong and he confidently accepts
your offer. It doesn't seem like quite a match, though, and you beat him
easily.\n\n
\"Was there anything wrong?\" you ask. \"Did you have all of
your limbs cut off when I wasn't looking? Or maybe you just
really do suck. That was \Beasy\b!\"\n\n
Tears streaming down his face,
he hands you the belt and runs off to wallow in his ugliness. You feel bad
for the guy.\n
\n
Strangely enough, the Cloud of Ugly remains."
move belt to player
remove Dave
belt is not hidden
score = score + 10
return true }
else
{
if Anne in Daveroom
{ "You easily beat Anne. C'mon now! What did you expect?"}
else
"There's no one to play here!"
}
}
}