Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Announce] Lisp IF Library - Proof of concept version

18 views
Skip to first unread message

Timofei Shatrov

unread,
Aug 28, 2005, 4:17:22 AM8/28/05
to
For those interested in both programming and interactive fiction,
I'm going to upload the proof-of-concept version (meaning about
10% of functionality) of my Lisp IF Library (Can anyone suggest a
good catchy name?). It's basically enough stuff to run a Cloak of
Darkness demo (except darkness is not yet implemented fully...).

Test it yourself (not for the weak ;)):
1. Download Lisp implementation:
http://www.gigamonkeys.com/lispbox/lispbox.html - seems to be
the best option - I used CLISP for developing.
2. Download the library:
http://grue3.tripod.com/iflib.zip
3. Load the library into your Lisp:
If you have asdf installed (should be true for Lispbox installation):
(pushnew "..path to library.." asdf:*central-registry* :test #'equal)
(asdf:oos 'asdf:load-op :iflib)

Note: when you enter path use double backslash instead of backslash
if you're old-style DOS user. Use vanilla slash if you're not.

If you don't have asdf installed:
(load (compile-file "..path../if.lisp"))
(load (compile-file "..path../iflib.lisp"))
(load (compile-file "..path../verbs.lisp"))

4. Load Cloak of Darkness:
(load (compile-file "..path../cloak.lisp"))

Note: you may use load without compiling - as in (load "..path../if.lisp")
but everything may work slower.

Note: at least on CLISP everything should compile without warnings.
If there are warnings present, just ignore them - they're harmless.

5. Run Cloak of Darkness:
(in-package :cloak-of-darkness)
(test-seq)

6. Play the game. Note you can enter the bar while it's dark and it
would appear as it's lit but in fact you can't read the message...
Darkness is half-implemented as well as many other things.


In the great tradition of Paul Allen Panks here's the entire code
for the cloak.lisp for those who don't bother to go through the above
steps. I give the permission to Roger Firth or whoever mantains the
CoD page to add the code to that page.

The code should be fairly understandable for anyone who programs in
Inform. I'm not sure about TADS people, but containers and supporters
being a class seems to be a TADS idea. In fact, to be a container an
object must be of class container AND have a flag :container (the flag
is set by default but can be turned off to disable object's
containerosity).

Note: the ugliness of the if construct is NOT my fault...

;;;;;;;;;;;;;CLOAK.LISP;;;;;;;;;;;;;;;;;;;;

(if-lib::load-libs :cloak-of-darkness)

(in-package :cloak-of-darkness)

;;These are ugly but necessary at the time...
(defvar cloak nil) (defvar message nil)

(object foyer (room) "Foyer of the Opera House"
(description "You are standing in a spacious hall, splendidly
decorated in red and gold, with glittering chandeliers overhead.
The entrance from the street is to the north, and there are doorways
south and west.")
(s-to 'bar)
(w-to 'cloakroom)
(n-to "You've only just arrived, and besides, the weather outside
seems to be getting worse."))

(object cloakroom (room) "Cloakroom"
(description "The walls of this small room were clearly once lined
with hooks, though now only one remains. The exit is a door to the east.")
(e-to 'foyer))

(object hook (supporter) "small brass hook" cloakroom
(name "small" "brass" "hook" "peg")
(description (lambda () (format nil "It's just a small brass hook, ~a"
(if (in cloak *player*)
"screwed to the wall."
"with a cloak hanging on it."))))
(has :scenery))

(object bar (room) "Foyer bar"
(description "The bar, much rougher than you'd have guessed after
the opulence of the foyer to the north, is completely empty. There seems
to be some sort of message scrawled in the sawdust on the floor.")
(n-to 'foyer)
(before
(go-to (when (and (hasnt self :light)
(not (eql *noun* dir-n)))
(incf (num message) 2)
"Blundering around in the dark isn't a good idea!"))
(t (when (hasnt self :light)
(incf (num message) 1)
"In the dark? You could easily disturb something!")))
(has :~light))

(object cloak (clothing) "velvet cloak" *player*
(name "handsome" "dark" "black" "velvet" "satin" "cloak")
(description "A handsome cloak, of velvet trimmed with satin, and
slightly spattered with raindrops. Its blackness is so deep that it almost
seems to suck light from the room.")
(before
((drop put-on)
(if (eql *location* cloakroom)
(progn (give bar :light)
(when (and (eql *action* 'put-on) (has self :general))
(give self :~general)
(incf *score*) nil))
"This isn't the best place to leave a smart cloak lying around.")))
(after (take (give bar :~light) nil))
(has :general :worn))

(object message () "scrawled message" bar
(name "message" "sawdust" "floor")
(description (lambda ()
(if (< (num message) 2)
(progn (incf *score*)
(setf *gamestate* 2)
(sprint "The message, neatly marked in the
sawdust, reads..."))
(progn (setf *gamestate* 3)
(sprint "The message has been carelessly
trampled, making it difficult to read. You can just distinguish
the words...")))))
(num integer 0)
(has :scenery))

(defun init ()
(setf *location* foyer)
"~%~%Hurrying through the rainswept November night, you're glad to see
the bright lights of the Opera House. It's surprising that there aren't
more people about but, hey, what do you expect in a cheap demo game...?~%~%")

(defun print-gamestate () "You have lost")

(verb "hang" '(:held "on" :noun -> put-on))

--
|a\o/r|,-------------.,---------- Timofei Shatrov aka Grue ------------.
| m"a ||FC AMKAR PERM|| mail: grue at mail.ru http://grue3.tripod.com |
| k || PWNZ J00 || Kingdom of Loathing: Grue3 lvl 18 Seal Clubber |
`-----'`-------------'`-------------------------------------------[4*72]

Giles

unread,
Aug 28, 2005, 7:02:20 PM8/28/05
to

Timofei Shatrov wrote:
> For those interested in both programming and interactive fiction,
> I'm going to upload the proof-of-concept version (meaning about
> 10% of functionality) of my Lisp IF Library (Can anyone suggest a
> good catchy name?).
>


Lifp?

-Giles

Chris Pickett

unread,
Aug 29, 2005, 12:30:52 AM8/29/05
to

That's just perfect. Funniest thing I've read in ages.

Chris

Kevin Forchione

unread,
Aug 29, 2005, 3:51:59 PM8/29/05
to
"Timofei Shatrov" <gr...@mail.ru> wrote in message
news:4311691e...@news.readfreenews.net...

> For those interested in both programming and interactive fiction,
> I'm going to upload the proof-of-concept version (meaning about
> 10% of functionality) of my Lisp IF Library <snip>

At first glance this looks very interesting. I'm looking forward to testing
it out as you suggest over the next week. Do you have a development mailing
list?

--Kevin


0 new messages