Defining north between two rooms with the low engine


My summary of this post is quite a lot better than looking at this post:

While there isn't any high level interface to my engine, In hypothetical high-level I did this:
@create $room named start-locn
@create $room named forest
LISP> (push 'screwtape (get 'start-locn :inhabitants))
@verb $room is (com-north (progn #<find 'north in exits and move PLAYER there>)
north

 You head north to FOREST.
LISPMOO2/MAIN> (symbol-plist 'forest)
(:OWNER SCREWTAPE :PARENTS ($ROOM $OBJECT) :CONTENTS NIL :INHABITANTS (SCREWTAPE) :EXITS NIL) LISPMOO2/MAIN>

This devlog is a bit of a catastrophe, but I did reverse-engineer (my own) moonclimb in order to create two $room derivatives, and have an exit north from one to the other, and have a general-purpose com-north command @verbed on $room.

As you can see, moonclimb is basically the bottom-most level of interaction- a kernel, and some primitives to pull us upward. If we are a sprouting plant, we are still deep in the mud.

Anyway it was at least a partial success if a very very scrappy one.

1. @creating start-locn

LISPMOO2/MAIN> (push (verb-plist :verb 'com-@create :dobj '$room :prep :named :iobj 'start-locn)
             (get 'screwtape :Queue))
((:VERB COM-@CREATE :DOBJ $ROOM :PREP :NAMED :IOBJ START-LOCN :HERE NIL :CALLER
  NIL :PLAYER NIL :PASSES 0))
LISPMOO2/MAIN> (funcall *krnl* :push-now 'screwtape)
NIL
LISPMOO2/MAIN> (funcall *krnl*)
;;; fifty quiggilion lines of warnings
LISPMOO2/MAIN> (inspect 'start-locn)
The object is a SYMBOL.
0. Name: "START-LOCN"
1. Package: #<PACKAGE "LISPMOO2/MAIN">
2. Value: #<APPLICATION-PANE START-LOCN {100594EFA3}>
3. Function: "unbound"
4. Plist: (:OWNER SCREWTAPE :PARENTS ($ROOM $OBJECT) :CONTENTS NIL :INHABITANTS
           NIL :EXITS NIL)
> q
; No value
LISPMOO2/MAIN> 

alright the fifty million compiler warnings notwithstanding, I guess I made a a $room named start-locn.

2. @create $room named forest

Very similarly.

LISPMOO2/MAIN> (push (verb-plist :verb 'com-@create :dobj '$room :prep :named :iobj 'forest)
             (get 'screwtape :Queue))
((:VERB COM-@CREATE :DOBJ $ROOM :PREP :NAMED :IOBJ FOREST :HERE NIL :CALLER NIL
  :PLAYER NIL :PASSES 0))
LISPMOO2/MAIN> (funcall *krnl* :push-now 'screwtape)
NIL
LISPMOO2/MAIN> (funcall *krnl*)

forest.

3. Connect start-locn -> forest

LISPMOO2/MAIN> (push '(north . forest) (get 'start-locn :exits))
((NORTH . FOREST))

I just kinda guessed where I was going with the $room :exits property.

4. A verb to follow that connection

Okay so now I think I can do this

LISPMOO2/MAIN> (push (verb-plist :verb 'com-@verb
            :dobj 'start-lcon
            :prep :is
            :iobj '(com-north
                (let* ((exits (get here :exits))
                   (dest (cdr (assoc 'north exits))))
                  (if dest
                  (progn
                    (format t "You head north to ~a." dest)
                    (setf (get player :room) dest)
                    (setf (get here :inhabitants)
                      (remove player (get here :inhabitants)))
                    (setf (get dest :inhabitants)
                      (append (get dest :inhabitants)
                          (list player)))
                    )
                  (format t "You can't or don't want to go north."))))
                  )
             (get 'screwtape :queue))
LISPMOO2/MAIN> (funcall *krnl* :push-now 'screwtape)
NIL
LISPMOO2/MAIN> (funcall *krnl*)

5. Finally

well I can't say I'm exceedingly happy but it seems like we did get from start-locn to forest via com-north (on $room, as it happened).

LISPMOO2/MAIN> (push 'screwtape (get 'start-locn :inhabitants))
(SCREWTAPE)
LISPMOO2/MAIN> (setf (get 'screwtape :room) 'start-locn)
START-LOCN
LISPMOO2/MAIN> (push (verb-plist :verb 'com-north :here 'start-locn :player 'screwtape) (get 'screwtape :queue))
((:VERB COM-NORTH :DOBJ NIL :PREP NIL :IOBJ NIL :HERE START-LOCN :CALLER NIL
  :PLAYER SCREWTAPE :PASSES 0))
LISPMOO2/MAIN> (funcall *krnl* :push-now 'screwtape)
NIL
LISPMOO2/MAIN> (funcall *krnl*)
You head north to FOREST.
(SCREWTAPE)
LISPMOO2/MAIN> (symbol-plist 'forest)
(:OWNER SCREWTAPE :PARENTS ($ROOM $OBJECT) :CONTENTS NIL :INHABITANTS
 (SCREWTAPE) :EXITS NIL)
LISPMOO2/MAIN> 

Author: screwlisp

Created: 2024-11-02 Sat 17:09

Validate

Get lispmoo2

Leave a comment

Log in with itch.io to leave a comment.