I am in the process of designing a small MUD game using racket. In my game, gems which are collected by the player are used to bribe guards. Currently if the player possesses more than 1 gem, the game will not let them bribe a guard.
Here is the relevant code:
;; This code processes the bribe command.
((equal? cmd 'bribe)
(if (get-area-item rid 'guard)
(begin
(if (eq? (user-attribute 'gem) 1)
(begin
(hash-table-set! areasdb rid (replace-area-item (get-area rid) 'guard '(guard #f)))
(user-add-value 'gem -1))
(describe 'bribe-no-gem))
(describe 'bribe))
(describe 'bribe-blank)))