diff --git a/interpret.rkt b/interpret.rkt index 5ea08ab..95dd3f3 100644 --- a/interpret.rkt +++ b/interpret.rkt @@ -8,7 +8,7 @@ (dim 10 10) (list (weapon "BIG SWORD" (pos 5 5) 4 'sword 5) (armor "LEATHER CAP" (pos 5 9) 1 'helmet 2)))) -(define plyr (player "ME" room1 '() 'human 20 '() 50)) +(define plyr (player "YOU" room1 '() 'human 20 '() 50)) (set-room-contents! room1 (append (room-contents room1) (list plyr))) (define (interpret in) @@ -26,7 +26,7 @@ (let ([room (obj-pos plyr)]) (if (empty? what) (string-join (obj-names (room-contents room)) ", " - #:before-first "In this area, there is " + #:before-first "In this area, there is: " #:before-last ", and " #:after-last ".") (let* ([what-str (string-join what)] diff --git a/main.rkt b/main.rkt index eb8177e..fd54fc5 100644 --- a/main.rkt +++ b/main.rkt @@ -10,16 +10,17 @@ (require racket/gui/easy racket/gui/easy/operator) (require "interpret.rkt") +(require "console.rkt") (define mono (send the-font-list find-or-create-font 12 'modern 'normal 'normal)) -(define/obs @log "You awake in a dark room.\n") +(define/obs @log "You awake in a dark room.") (define/obs @input "Type here...") (define (text-entered event content) (when (eqv? event 'return) (:= @input "") (let ([input (string-upcase content)]) - (:= @log (~a (obs-peek @log) "> " input "\n" (interpret input) "\n"))))) + (:= @log (~a (obs-peek @log) "\n> " input "\n" (interpret input)))))) (render (window @@ -27,7 +28,8 @@ (hpanel (vpanel (input @log - #:enabled? #f + ;hack to prevent text editing without disabling the editor + (λ (ev cnt) (let ([old (obs-peek @log)]) (:= @log "") (:= @log old))) #:style '(multiple) #:min-size '(600 400) #:font mono)