From 5c865db1372030052d03914ecb412e5d96f43903 Mon Sep 17 00:00:00 2001 From: kiefac Date: Thu, 23 May 2024 17:11:42 -0400 Subject: [PATCH] typos, allowed output window scrolling (doesn't FUCKIN AUTOSCROLL AGH), reformat newlines --- interpret.rkt | 4 ++-- main.rkt | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) 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)