X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=worlds%2Fbricabrac.scm;h=3584e87c15dd0376bf91e3b5d16edfbd1936c6fc;hp=c18720fb2219fc6090a09d4504dfb118648fbcb9;hb=43b6ac4e8ceff7aad909294b1b00ebdd6a38ec15;hpb=e6f8f000860185b49867e9c5610324b30c98abbb diff --git a/worlds/bricabrac.scm b/worlds/bricabrac.scm index c18720f..3584e87 100644 --- a/worlds/bricabrac.scm +++ b/worlds/bricabrac.scm @@ -19,10 +19,12 @@ ;;; Hotel Bricabrac (use-modules (mudsync) + (mudsync parser) (8sync systems actors) (8sync agenda) (oop goops) - (ice-9 format)) + (ice-9 format) + (rx irregex)) @@ -117,6 +119,51 @@ or 'skribe'? Now *that's* composition!")) "a scroll of teletype paper holding the software Four Freedoms" "a telephone shaped like an orange cartoon cat")) +(define-class () + (commands + #:init-value + (list + (indir-as-direct-command "sign" 'cmd-sign-form + '("as")))) + (message-handler + #:init-value + (simple-dispatcher + (append + (build-actions + (cmd-sign-form (wrap-apply sign-cmd-sign-in))) + gameobj-actions)))) + + +(define name-sre + (sre->irregex '(: alpha (** 1 14 (or alphanum "-" "_"))))) + +(define forbidden-words + (append article preposition + '("and" "or" "but" "admin"))) + +(define (valid-name? name) + (and (irregex-match name-sre name) + (not (member name forbidden-words)))) + +(define-mhandler (sign-cmd-sign-in actor message direct-obj indir-obj) + (define old-name + (message-ref + (<-wait actor (message-from message) 'get-name) + 'val)) + (define name indir-obj) + (if (valid-name? indir-obj) + (begin + (<-wait actor (message-from message) 'set-name! + #:val name) + (<- actor (slot-ref actor 'loc) 'tell-room + #:text (format #f "~a signs the form!\n~a is now known as ~a\n" + old-name old-name name))) + (<- actor (message-from message) 'tell + "Sorry, that's not a valid name. +Alphanumerics, _ and - only, 2-15 characters, starts with an alphabetic +character."))) + + (define lobby (lol ('room:lobby @@ -130,7 +177,12 @@ somewhere overhead. The room is lined with various curio cabinets, filled with all sorts of kitschy junk. It looks like whoever decorated this place had great ambitions, but actually assembled it all in a hurry and used whatever -kind of objects they found lying around.") +kind of objects they found lying around. + There's a door to the north leading to some kind of hallway." + #:exits + (list (make + #:name "north" + #:to-symbol 'room:grand-hallway))) ;; NPC: hotel owner ('npc:hotel-owner 'room:lobby @@ -143,7 +195,7 @@ which says \"Hotel Proprietor\", but they look so disorganized that you think that can't possibly be true... can it? Despite their exhaustion, you sense they'd be happy to chat with you, though the conversation may be a bit one sided." - #:goes-by '("bescraggled fellow" "fellow" + #:goes-by '("frumpy fellow" "fellow" "Chris Webber" ; heh, did you rtfc? or was it so obvious? "hotel proprietor" "proprietor") #:catchphrases hotel-owner-grumps) @@ -175,7 +227,11 @@ Classy!" (format #f " The curio cabinet is full of all sorts of oddities! Something catches your eye! Ooh, ~a!" (random-choice random-bricabrac)))) - + ('thing:sign-in-form + 'room:lobby + #:name "sign-in form" + #:goes-by '("sign-in form" "form" "signin form") + #:desc "It looks like you could sign this form and set your name.") ;; Object: desk ;; - Object: bell ;; - Object: sign in form @@ -186,6 +242,26 @@ Ooh, ~a!" (random-choice random-bricabrac)))) ) + +;;; Grand hallway +;;; ------------- + +(define grand-hallway + (lol + ('room:grand-hallway + #f + #:name "Grand Hallway" + #:desc " A majestic red carpet runs down the center of the room. +Busts of serious looking people line the walls, but there's no +clear indication that they have any logical relation to this place. + To the south is the lobby. All around are various doors, but +they're all boarded up. Guess this is still a work in progress, huh?" + #:exits + (list (make + #:name "south" + #:to-symbol 'room:lobby)) + ))) + ;;; Playroom ;;; -------- @@ -218,7 +294,7 @@ Ooh, ~a!" (random-choice random-bricabrac)))) ;;; ---- (define game-spec - (append lobby)) + (append lobby grand-hallway)) (define (run-game . args) (run-demo "/tmp/bricabrac-game.db" game-spec 'room:lobby))