Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Writing a text adventure in Perl

by matija (Priest)
on Jul 29, 2004 at 14:13 UTC ( #378385=note: print w/replies, xml ) Need Help??

in reply to Writing a text adventure in Perl

For knowing when a command is entered, you could employ the services of Term::ReadLine - that should give you not only notification of a command's entry, but also such wellcome features as command line editing and history.

As for combining it with an object, you should first define the commands and the grammar you would accept, then perhaps parse the commands with something akin to Parse::RecDescent - or something simpler if your grammar is simple enough.

Personaly, for an adventure of any sophistication, I don't think hashes are going to be sophisticated enough - to simulate actions on objects you should use, well, objects...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://378385]
[virtualsue]: nice photo
[holli]: the fricking beast will only eat dry food
[holli]: nothing else, not even minced meat or fish
[Discipulus]: see you nuns and monks!
[KurtZ]: mice?
[Discipulus]: your cat is dryarian holli
[holli]: not even remotely KurtZ. i did find feathers in the garden a few times though
[holli]: yet no body
[virtualsue]: I was called upon to remove a gnawed mouse carcass from the living room this morning

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2017-11-21 12:44 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (300 votes). Check out past polls.