From: Christopher Allan Webber Date: Tue, 3 Jan 2017 01:29:34 +0000 (-0600) Subject: Update all actor usage of <- to not pass in from-actor. X-Git-Tag: fosdem-2017~122 X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=commitdiff_plain;h=754bd427883ab189433fad90293e05d9aced2f70 Update all actor usage of <- to not pass in from-actor. Unless necessary, in which case use <-*. --- diff --git a/mudsync/game-master.scm b/mudsync/game-master.scm index b11d21c..4576de3 100644 --- a/mudsync/game-master.scm +++ b/mudsync/game-master.scm @@ -106,7 +106,7 @@ (match-lambda ((special-obj . loc) (if loc - (<-wait gm special-obj 'set-loc! + (<-wait special-obj 'set-loc! #:loc (hash-ref (gm-special-dir gm) loc))))) set-locs) @@ -114,7 +114,7 @@ (for-each (lambda (special-obj) (format #t "Initializing ~s...\n" (address->string special-obj)) - (<-wait gm special-obj 'init)) + (<-wait special-obj 'init)) specials)) @@ -125,7 +125,7 @@ #:send-input-to (actor-id gm))) ;; TODO: Add host and port options - (<-wait gm (gm-network-manager gm) 'start-listening)) + (<-wait (gm-network-manager gm) 'start-listening)) (define (gm-setup-database gm) 'TODO) @@ -146,16 +146,16 @@ ;; debugging (format #t "DEBUG: From ~s: ~s\n" client data) - (<- actor player 'handle-input + (<- player 'handle-input #:input data)) (define* (gm-lookup-special actor message #:key symbol) - (<-reply actor message (hash-ref (slot-ref actor 'special-dir) symbol))) + (<-reply message (hash-ref (slot-ref actor 'special-dir) symbol))) (define* (gm-write-home actor message #:key text) (define client-id (hash-ref (gm-reverse-client-dir actor) (message-from message))) - (<- actor (gm-network-manager actor) 'send-to-client + (<- (gm-network-manager actor) 'send-to-client #:client client-id #:data text)) @@ -167,7 +167,7 @@ ;; room, if we have one. ;; (In some games, if the user never connected) (when actor-id - (<-wait gm actor-id 'disconnect-self-destruct) + (<-wait actor-id 'disconnect-self-destruct) ;; Unregister from the client directories. (gm-unregister-client! gm client))) @@ -192,19 +192,19 @@ using the gameobj-spec." #:gm (actor-id gm) args))) ;; Set the location - (<-wait gm special-obj 'set-loc! - #:loc (hash-ref (gm-special-dir gm) loc)) + (<-wait special-obj 'set-loc! + #:loc (hash-ref (gm-special-dir gm) loc)) ;; Initialize the object, and depending on if an object ;; already exists with this info, ask it to coordinate ;; replacing with the existing object. (if existing-obj - (<-wait gm special-obj 'init #:replace existing-obj) - (<-wait gm special-obj 'init)) + (<-wait special-obj 'init #:replace existing-obj) + (<-wait special-obj 'init)) ;; Register the object (hash-set! (gm-special-dir gm) symbol special-obj) ;; Destroy the original, if it exists. (if existing-obj - (<- gm existing-obj 'self-destruct #:why 'replaced)))))) + (<- existing-obj 'self-destruct #:why 'replaced)))))) ;;; GM utilities @@ -220,7 +220,7 @@ using the gameobj-spec." (hash-remove! (gm-reverse-client-dir gm) client-id) ;; Destroy player (if destroy-player - (<- gm player-id 'self-destruct))) + (<- player-id 'self-destruct))) (#f (throw 'no-client-to-unregister "Can't unregister a client that doesn't exist?" client-id)))) @@ -246,10 +246,10 @@ with an anonymous persona" ;; Register the player in our database of players -> connections (gm-register-client! gm client-id player) ;; Dump the player into the default room - (<-wait gm player 'set-loc! #:loc room-id) + (<-wait player 'set-loc! #:loc room-id) ;; Initialize the player - (<-wait gm player 'init) - (<- gm room-id 'tell-room + (<-wait player 'init) + (<- room-id 'tell-room #:text (format #f "You see ~a materialize out of thin air!\n" guest-name) #:exclude player))))) diff --git a/mudsync/gameobj.scm b/mudsync/gameobj.scm index 07b3ddb..8efe565 100644 --- a/mudsync/gameobj.scm +++ b/mudsync/gameobj.scm @@ -123,7 +123,7 @@ ;; Kind of a useful utility, maybe? (define (simple-slot-getter slot) (lambda (actor message) - (<-reply actor message (slot-ref actor slot)))) + (<-reply message (slot-ref actor slot)))) (define (gameobj-replace-step-occupants actor occupants) ;; Snarf all the occupants! @@ -131,7 +131,7 @@ (when occupants (for-each (lambda (occupant) - (<-wait actor occupant 'set-loc! + (<-wait occupant 'set-loc! #:loc (actor-id actor))) occupants))) @@ -141,7 +141,7 @@ (define (run-replacement actor replaces replace-steps) (when replaces (msg-receive (_ #:key occupants) - (<-wait actor replaces 'assist-replace) + (<-wait replaces 'assist-replace) (for-each (lambda (replace-step) (replace-step actor occupants)) @@ -165,8 +165,7 @@ Assists in its replacement of occupants if necessary and nothing else." (define (gameobj-act-goes-by actor message) "Reply to a message requesting what we go by." - (<-reply actor message - #:goes-by (gameobj-goes-by actor))) + (<-reply message #:goes-by (gameobj-goes-by actor))) (define (val-or-run val-or-proc) "Evaluate if a procedure, or just return otherwise" @@ -186,7 +185,7 @@ Assists in its replacement of occupants if necessary and nothing else." (define filtered-commands (filter-commands (val-or-run (slot-ref actor 'commands)) verb)) - (<-reply actor message + (<-reply message #:commands filtered-commands #:goes-by (gameobj-goes-by actor))) @@ -195,14 +194,14 @@ Assists in its replacement of occupants if necessary and nothing else." (define filtered-commands (filter-commands (val-or-run (slot-ref actor 'container-commands)) verb)) - (<-reply actor message #:commands filtered-commands)) + (<-reply message #:commands filtered-commands)) (define* (gameobj-get-contained-commands actor message #:key verb) "Get commands as being contained (eg inventory) of commanding gameobj" (define filtered-commands (filter-commands (val-or-run (slot-ref actor 'contained-commands)) verb)) - (<-reply actor message + (<-reply message #:commands filtered-commands #:goes-by (gameobj-goes-by actor))) @@ -240,11 +239,10 @@ Assists in its replacement of occupants if necessary and nothing else." (define occupants (gameobj-occupants actor #:exclude exclude)) - (<-reply actor message - #:occupants occupants)) + (<-reply message #:occupants occupants)) (define (gameobj-act-get-loc actor message) - (<-reply actor message (slot-ref actor 'loc))) + (<-reply message (slot-ref actor 'loc))) (define (gameobj-set-loc! gameobj loc) "Set the location of this object." @@ -256,9 +254,9 @@ Assists in its replacement of occupants if necessary and nothing else." (slot-set! gameobj 'loc loc) ;; Change registation of where we currently are (if old-loc - (<-wait gameobj old-loc 'remove-occupant! #:who (actor-id gameobj))) + (<-wait old-loc 'remove-occupant! #:who (actor-id gameobj))) (if loc - (<-wait gameobj loc 'add-occupant! #:who (actor-id gameobj))))) + (<-wait loc 'add-occupant! #:who (actor-id gameobj))))) ;; @@: Should it really be #:id ? Maybe #:loc-id or #:loc? (define* (gameobj-act-set-loc! actor message #:key loc) @@ -284,7 +282,7 @@ and whos-asking, and see if we should just return it or run it." ((? procedure? desc-proc) (desc-proc actor whos-looking)) (desc desc))) - (<-reply actor message desc-text)) + (<-reply message desc-text)) (define (gameobj-visible-to-player? gameobj whos-looking) "Check to see whether we're visible to the player or not. @@ -306,7 +304,7 @@ By default, this is whether or not the generally-visible flag is set." name) (#f #f)) #f)) - (<-reply actor message #:text name-to-return)) + (<-reply message #:text name-to-return)) (define (gameobj-self-destruct gameobj) "General gameobj self destruction routine" @@ -338,7 +336,7 @@ By default, this is whether or not the generally-visible flag is set." ;; But that's life in a live hacked game! (define (gameobj-act-assist-replace actor message) "Vanilla method for assisting in self-replacement for live hacking" - (apply <-reply actor message + (apply <-reply message (gameobj-replace-data* actor))) @@ -350,7 +348,7 @@ By default, this is whether or not the generally-visible flag is set." (match special-symbol ;; if it's a symbol, look it up dynamically ((? symbol? _) - (msg-val (<-wait gameobj (slot-ref gameobj 'gm) 'lookup-special + (msg-val (<-wait (slot-ref gameobj 'gm) 'lookup-special #:symbol special-symbol))) ;; if it's false, return nothing (#f #f) diff --git a/mudsync/networking.scm b/mudsync/networking.scm index f12a7e0..d2593d1 100644 --- a/mudsync/networking.scm +++ b/mudsync/networking.scm @@ -135,7 +135,7 @@ (sockaddr:addr client-details))) (fcntl client F_SETFL (logior O_NONBLOCK (fcntl client F_GETFL))) (hash-set! (nm-clients nm) client-id client) - (<- nm (nm-send-input-to nm) 'new-client #:client client-id) + (<-* `(#:actor ,nm) (nm-send-input-to nm) 'new-client #:client client-id) (nm-client-receive-loop nm client client-id)) (define (nm-client-receive-loop nm client client-id) @@ -147,7 +147,7 @@ (begin (nm-handle-line nm client client-id (string-trim-right line #\return)) - (when (actor-am-i-alive? nm) + (when (actor-alive? nm) (loop))))) (loop)) @@ -155,18 +155,19 @@ "Handle a closed port" (format #t "DEBUG: handled closed port ~x\n" client-id) (hash-remove! (nm-clients nm) client-id) - (<- nm (nm-send-input-to nm) 'client-closed #:client client-id)) + (<-* `(#:actor ,nm) (nm-send-input-to nm) 'client-closed #:client client-id)) (define-method (nm-handle-port-eof nm client client-id) "Handle seeing an EOF on port" (format #t "DEBUG: handled eof-object on port ~x\n" client-id) (close client) (hash-remove! (nm-clients nm) client-id) - (<- nm (nm-send-input-to nm) 'client-closed #:client client-id)) + (<-* `(#:actor ,nm) (nm-send-input-to nm) 'client-closed + #:client client-id)) (define-method (nm-handle-line nm client client-id line) "Handle an incoming line of input from a client" - (<- nm (nm-send-input-to nm) 'client-input + (<-* `(#:actor ,nm) (nm-send-input-to nm) 'client-input #:data line #:client client-id)) diff --git a/mudsync/player.scm b/mudsync/player.scm index e3ae2ba..1063955 100644 --- a/mudsync/player.scm +++ b/mudsync/player.scm @@ -63,7 +63,7 @@ (define (player-init player message) ;; Look around the room we're in - (<- player (gameobj-loc player) 'look-room)) + (<- (gameobj-loc player) 'look-room)) (define* (player-handle-input player message #:key input) @@ -79,20 +79,20 @@ (match winner ((cmd-action winner-id message-args) - (apply <- player winner-id cmd-action message-args)) + (apply <- winner-id cmd-action message-args)) (#f - (<- player (gameobj-gm player) 'write-home + (<- (gameobj-gm player) 'write-home #:text "Huh?\n")))) (define* (player-tell player message #:key text) - (<- player (gameobj-gm player) 'write-home + (<- (gameobj-gm player) 'write-home #:text text)) (define (player-disconnect-self-destruct player message) "Action routine for being told to disconnect and self destruct." (define loc (gameobj-loc player)) (when loc - (<- player loc 'tell-room + (<- loc 'tell-room #:exclude (actor-id player) #:text (format #f "~a disappears in a puff of entropy!\n" (slot-ref player 'name)))) @@ -103,7 +103,7 @@ (define inv-names (map (lambda (inv-item) - (msg-val (<-wait player inv-item 'get-name))) + (msg-val (<-wait inv-item 'get-name))) (gameobj-occupants player))) (define text-to-show (if (eq? inv-names '()) @@ -113,7 +113,7 @@ (map (lambda (item-name) (string-append " * " item-name "\n")) inv-names)))) - (<- player (actor-id player) 'tell #:text text-to-show)) + (<- (actor-id player) 'tell #:text text-to-show)) ;;; Command handling @@ -134,9 +134,8 @@ (define room-commands ;; TODO: Map room id and sort (msg-receive (_ #:key commands) - (<-wait player player-loc - 'get-container-commands - #:verb verb) + (<-wait player-loc 'get-container-commands + #:verb verb) commands)) ;; All the co-occupants of the room (not including ourself) @@ -144,7 +143,7 @@ (remove (lambda (x) (equal? x (actor-id player))) (msg-receive (_ #:key occupants) - (<-wait player player-loc 'get-occupants) + (<-wait player-loc 'get-occupants) occupants))) ;; @@: There's a race condition here if someone leaves the room @@ -157,8 +156,8 @@ (fold (lambda (co-occupant prev) (msg-receive (_ #:key commands goes-by) - (<-wait player co-occupant 'get-commands - #:verb verb) + (<-wait co-occupant 'get-commands + #:verb verb) (append (map (lambda (command) (list command goes-by co-occupant)) @@ -182,8 +181,7 @@ (fold (lambda (inv-item prev) (msg-receive (_ #:key commands goes-by) - (<-wait player inv-item - 'get-contained-commands + (<-wait inv-item 'get-contained-commands #:verb verb) (append (map (lambda (command) diff --git a/mudsync/room.scm b/mudsync/room.scm index efb52d8..0ad886c 100644 --- a/mudsync/room.scm +++ b/mudsync/room.scm @@ -105,28 +105,28 @@ (dyn-ref room (slot-ref exit 'to)) #f)) (define player-name - (msg-val (<-wait room (message-from message) 'get-name))) + (msg-val (<-wait (message-from message) 'get-name))) (cond (exit ;; Set the player's new location - (<-wait room (message-from message) 'set-loc! + (<-wait (message-from message) 'set-loc! #:loc to-address) ;; Tell everyone else the person walked away (room-tell-room room (format #f "~a wanders ~a.\n" player-name direct-obj)) - (<- room to-address 'announce-entrance + (<- to-address 'announce-entrance #:who-entered (message-from message)) ;; Have the new room update the player to the new location - (<- room to-address 'look-room + (<- to-address 'look-room #:to-id (message-from message))) (else - (<- room (message-from message) 'tell + (<- (message-from message) 'tell #:text "You don't see any way to go there.\n")))) (define (room-cmd-go-where room message) - (<- room (message-from message) 'tell + (<- (message-from message) 'tell #:text "Go where?\n")) ;;; look commands @@ -160,7 +160,7 @@ (define occupant-names-all (map (lambda (occupant) - (call-with-message (<-wait room occupant 'visible-name + (call-with-message (<-wait occupant 'visible-name #:whos-looking player-id) (lambda* (_ #:key text) text))) @@ -185,7 +185,7 @@ (string-append room-text occupant-names-string) room-text)) - (<- room player-id 'tell + (<- player-id 'tell #:text final-text)) @@ -203,7 +203,7 @@ (for-each (lambda (occupant) (msg-receive (_ #:key goes-by) - (<-wait room occupant 'goes-by) + (<-wait occupant 'goes-by) (if (member called-this goes-by) (return occupant)))) (hash-map->list (lambda (key val) key) @@ -221,15 +221,15 @@ (cond (matching-object (let ((obj-desc - (msg-val (<-wait room matching-object 'get-desc + (msg-val (<-wait matching-object 'get-desc #:whos-looking (message-from message))))) (if obj-desc - (<- room (message-from message) 'tell + (<- (message-from message) 'tell #:text (string-append obj-desc "\n")) - (<- room (message-from message) 'tell + (<- (message-from message) 'tell #:text (string-append %formless-desc "\n"))))) (else - (<- room (message-from message) 'tell + (<- (message-from message) 'tell #:text "You don't see that here, so you can't look at it.\n")))) @@ -242,7 +242,7 @@ (if wait <-wait <-)) - (deliver-method room tell-me 'tell + (deliver-method tell-me 'tell #:text text)) who-to-tell)) @@ -255,8 +255,7 @@ (define* (room-cmd-say room message #:key phrase) "Command: Say something to room participants." (define player-name - (msg-val (<-wait room (message-from message) - 'get-name))) + (msg-val (<-wait (message-from message) 'get-name))) (define message-to-send (format #f "~a says: ~a\n" player-name phrase)) (room-tell-room room message-to-send)) @@ -264,15 +263,14 @@ (define* (room-cmd-emote room message #:key phrase) "Command: Say something to room participants." (define player-name - (msg-val (<-wait room (message-from message) - 'get-name))) + (msg-val (<-wait (message-from message) 'get-name))) (define message-to-send (format #f "* ~a ~a\n" player-name phrase)) (room-tell-room room message-to-send)) (define* (room-announce-entrance room message #:key who-entered) (define player-name - (msg-val (<-wait room who-entered 'get-name))) + (msg-val (<-wait who-entered 'get-name))) (define message-to-send (format #f "~a enters the room.\n" player-name)) (room-tell-room room message-to-send diff --git a/mudsync/thing.scm b/mudsync/thing.scm index 6963c01..f2e2180 100644 --- a/mudsync/thing.scm +++ b/mudsync/thing.scm @@ -70,9 +70,9 @@ (define* (thing-cmd-take thing message #:key direct-obj) (define player (message-from message)) (define player-name - (msg-val (<-wait thing player 'get-name))) + (msg-val (<-wait player 'get-name))) (define player-loc - (msg-val (<-wait thing player 'get-loc))) + (msg-val (<-wait player 'get-loc))) (define thing-name (slot-ref thing 'name)) (define should-take (slot-ref-maybe-runcheck thing 'takeable player)) @@ -80,24 +80,24 @@ ;; Set the location to whoever's picking us up (begin (gameobj-set-loc! thing player) - (<- thing player 'tell + (<- player 'tell #:text (format #f "You pick up ~a.\n" thing-name)) - (<- thing player-loc 'tell-room + (<- player-loc 'tell-room #:text (format #f "~a picks up ~a.\n" player-name thing-name) #:exclude player)) - (<- thing player 'tell + (<- player 'tell #:text (format #f "It doesn't seem like you can pick up ~a.\n" thing-name)))) (define* (thing-cmd-drop thing message #:key direct-obj) (define player (message-from message)) (define player-name - (msg-val (<-wait thing player 'get-name))) + (msg-val (<-wait player 'get-name))) (define player-loc - (msg-val (<-wait thing player 'get-loc))) + (msg-val (<-wait player 'get-loc))) (define thing-name (slot-ref thing 'name)) (define should-drop (slot-ref-maybe-runcheck thing 'dropable player)) @@ -105,14 +105,14 @@ ;; Set the location to whoever's picking us up's location (begin (gameobj-set-loc! thing player-loc) - (<- thing player 'tell + (<- player 'tell #:text (format #f "You drop ~a.\n" thing-name)) - (<- thing player-loc 'tell-room + (<- player-loc 'tell-room #:text (format #f "~a drops ~a.\n" player-name thing-name) #:exclude player)) - (<- thing player 'tell + (<- player 'tell #:text (format #f "It doesn't seem like you can drop ~a.\n" thing-name)))) diff --git a/worlds/bricabrac.scm b/worlds/bricabrac.scm index daf6353..7570b0d 100644 --- a/worlds/bricabrac.scm +++ b/worlds/bricabrac.scm @@ -64,7 +64,7 @@ (cmd-read readable-cmd-read)))) (define (readable-cmd-read actor message) - (<- actor (message-from message) 'tell + (<- (message-from message) 'tell #:text (string-append (slot-ref actor 'read-text) "\n"))) @@ -77,7 +77,7 @@ (format #f "~a says: \"~a\"\n" (slot-ref actor 'name) (random-choice (slot-ref actor 'catchphrases)))) - (<- actor (message-from message) 'tell + (<- (message-from message) 'tell #:text text-to-send)) (define chat-commands @@ -146,15 +146,15 @@ or 'skribe'? Now *that's* composition!")) (define* (sign-cmd-sign-in actor message #:key direct-obj indir-obj preposition) (define old-name - (msg-val (<-wait actor (message-from message) 'get-name))) + (msg-val (<-wait (message-from message) 'get-name))) (define name indir-obj) (if (valid-name? indir-obj) (begin - (<-wait actor (message-from message) 'set-name! name) - (<- actor (slot-ref actor 'loc) 'tell-room + (<-wait (message-from message) 'set-name! name) + (<- (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 + (<- (message-from message) 'tell #:text "Sorry, that's not a valid name. Alphanumerics, _ and - only, 2-15 characters, starts with an alphabetic character.\n"))) @@ -182,13 +182,13 @@ character.\n"))) ;; handler... meanwhile, this procedure suspends until we get ;; their response. (define who-rang - (msg-val (<-wait bell (message-from message) 'get-name))) + (msg-val (<-wait (message-from message) 'get-name))) ;; Now we'll invoke the "tell" message handler on the player ;; who rang us, displaying this text on their screen. ;; This one just uses <- instead of <-wait, since we don't ;; care when it's delivered; we're not following up on it. - (<- bell (message-from message) 'tell + (<- (message-from message) 'tell #:text "*ring ring!* You ring the bell!\n") ;; We also want everyone else in the room to "hear" the bell, ;; but they get a different message since they aren't the ones @@ -196,7 +196,7 @@ character.\n"))) ;; name as extracted and assigned to the who-rang variable. ;; Notice how we send this message to our "location", which ;; forwards it to the rest of the occupants in the room. - (<- bell (gameobj-loc bell) 'tell-room + (<- (gameobj-loc bell) 'tell-room #:text (format #f "*ring ring!* ~a rings the bell!\n" who-rang) @@ -204,7 +204,7 @@ character.\n"))) ;; Now we perform the primary task of the bell, which is to summon ;; the "clerk" character to the room. (This is configurable, ;; so we dynamically look up their address.) - (<- bell (dyn-ref bell (slot-ref bell 'summons)) 'be-summoned + (<- (dyn-ref bell (slot-ref bell 'summons)) 'be-summoned #:who-summoned (message-from message))) @@ -390,12 +390,12 @@ if this room is intended for children or child-like adults." (define* (furniture-cmd-sit actor message #:key direct-obj) (define player-name - (msg-val (<-wait actor (message-from message) 'get-name))) - (<- actor (message-from message) 'tell + (msg-val (<-wait (message-from message) 'get-name))) + (<- (message-from message) 'tell #:text (format #f "You ~a ~a.\n" (slot-ref actor 'sit-phrase) (slot-ref actor 'sit-name))) - (<- actor (slot-ref actor 'loc) 'tell-room + (<- (slot-ref actor 'loc) 'tell-room #:text (format #f "~a ~a on ~a.\n" player-name (slot-ref actor 'sit-phrase-third-person) @@ -497,7 +497,7 @@ seat in the room, though." ;; call the gameobj main init method (gameobj-act-init clerk message) ;; start our main loop - (<- clerk (actor-id clerk) 'update-loop)) + (<- (actor-id clerk) 'update-loop)) (define clerk-help-topics '(("changing name" . @@ -538,10 +538,10 @@ with tuition at where it is...")) (define* (clerk-cmd-chat clerk message #:key direct-obj) (match (slot-ref clerk 'state) ('on-duty - (<- clerk (message-from message) 'tell + (<- (message-from message) 'tell #:text clerk-general-helpful-line)) ('slacking - (<- clerk (message-from message) 'tell + (<- (message-from message) 'tell #:text (string-append "The clerk says, \"" @@ -549,7 +549,7 @@ with tuition at where it is...")) "\"\n"))))) (define (clerk-cmd-ask-incomplete clerk message) - (<- clerk (message-from message) 'tell + (<- (message-from message) 'tell #:text "The clerk says, \"Ask about what?\"\n")) (define clerk-doesnt-know-text @@ -561,34 +561,34 @@ with tuition at where it is...")) ('on-duty (match (assoc (pk 'indir indir-obj) clerk-help-topics) ((_ . info) - (<- clerk (message-from message) 'tell + (<- (message-from message) 'tell #:text (string-append "The clerk clears her throat and says:\n \"" info "\"\n"))) (#f - (<- clerk (message-from message) 'tell + (<- (message-from message) 'tell #:text clerk-doesnt-know-text)))) ('slacking - (<- clerk (message-from message) 'tell + (<- (message-from message) 'tell #:text "The clerk says, \"Sorry, I'm on my break.\"\n")))) (define* (clerk-act-be-summoned clerk message #:key who-summoned) (match (slot-ref clerk 'state) ('on-duty - (<- clerk who-summoned 'tell + (<- who-summoned 'tell #:text "The clerk tells you as politely as she can that she's already here, so there's no need to ring the bell.\n")) ('slacking - (<- clerk (gameobj-loc clerk) 'tell-room + (<- (gameobj-loc clerk) 'tell-room #:text "The clerk's ears perk up, she stamps out a cigarette, and she runs out of the room!\n") (gameobj-set-loc! clerk (dyn-ref clerk 'room:lobby)) (slot-set! clerk 'patience 8) (slot-set! clerk 'state 'on-duty) - (<- clerk (gameobj-loc clerk) 'tell-room + (<- (gameobj-loc clerk) 'tell-room #:text (string-append " Suddenly, a uniformed woman rushes into the room! She's wearing a @@ -601,10 +601,10 @@ You can ask me about the following: (define* (clerk-cmd-dismiss clerk message . _) (define player-name - (msg-val (<-wait clerk (message-from message) 'get-name))) + (msg-val (<-wait (message-from message) 'get-name))) (match (slot-ref clerk 'state) ('on-duty - (<- clerk (gameobj-loc clerk) 'tell-room + (<- (gameobj-loc clerk) 'tell-room #:text (format #f "\"Thanks ~a!\" says the clerk. \"I have somewhere I need to be.\" The clerk leaves the room in a hurry.\n" @@ -612,11 +612,11 @@ The clerk leaves the room in a hurry.\n" #:exclude (actor-id clerk)) (gameobj-set-loc! clerk (dyn-ref clerk 'room:break-room)) (slot-set! clerk 'state 'slacking) - (<- clerk (gameobj-loc clerk) 'tell-room + (<- (gameobj-loc clerk) 'tell-room #:text clerk-return-to-slacking-text #:exclude (actor-id clerk))) ('slacking - (<- clerk (message-from message) 'tell + (<- (message-from message) 'tell #:text "The clerk sternly asks you to not be so dismissive.\n")))) (define clerk-slacking-texts @@ -647,7 +647,7 @@ attend to.\n") (define (clerk-act-update-loop clerk message) (define (tell-room text) - (<- clerk (gameobj-loc clerk) 'tell-room + (<- (gameobj-loc clerk) 'tell-room #:text text #:exclude (actor-id clerk))) (define (loop-if-not-destructed) @@ -660,7 +660,7 @@ attend to.\n") ;; route: it's much more live hackable. If we change the definition ;; of this method, the character will act differently on the next ;; "tick" of the loop. - (<- clerk (actor-id clerk) 'update-loop))) + (<- (actor-id clerk) 'update-loop))) (match (slot-ref clerk 'state) ('slacking (tell-room (random-choice clerk-slacking-texts)) diff --git a/worlds/goblin-hq.scm b/worlds/goblin-hq.scm index 3330a10..6bfd154 100644 --- a/worlds/goblin-hq.scm +++ b/worlds/goblin-hq.scm @@ -80,12 +80,12 @@ Only the universe knows.")) (wrap-apply typewriter-dispatch))) (define (typewriter-cmd-type-gibberish actor message) - (<- actor (message-from message) 'tell + (<- (message-from message) 'tell #:text "*tikka takka!* *tikka takka!* You type some gibberish on the typewriter.\n")) (define (type-thing actor message type-text) - (<- actor (message-from message) 'tell + (<- (message-from message) 'tell #:text (format #f "You type out a note.\nThe note says: ~s\n" type-text)))