# HG changeset patch # User Steve Losh # Date 1314400614 14400 # Node ID eb53408ae5e06fa1baa7b47514ff184ebaab015a # Parent 4693c1d0c9038275ea917e88725471c33ff701d0 Update the docs to reflect the action changes. diff -r 4693c1d0c903 -r eb53408ae5e0 docs/source/actions.rst --- a/docs/source/actions.rst Fri Aug 26 19:12:34 2011 -0400 +++ b/docs/source/actions.rst Fri Aug 26 19:16:54 2011 -0400 @@ -2,19 +2,19 @@ ======= Actions are functions that take a ``Bot`` object and some arguments, and return -a delayed function that will handle writing the packets to your bot perform the -action. +a map representing the action. + +They return a map instead of actually performing the action to make it easier to unit +test your event handlers and loops. This also makes them pure functions that can be +retried in transactions. Performing Actions ------------------ -If you want to make your bot perform an action immediately you should use ``force`` -to make it happen:: +If you want to make your bot perform an action immediately you should use +``perform!`` to make it happen:: - (force (clojurecraft.actions/jump bot)) - -Technically you don't need to use ``force``, because the REPL's printing will force -the result to be evaluated, but conceptually it's a good habit to get into. + (clojurecraft.actions/perform! (clojurecraft.actions/jump bot)) Available Actions ----------------- diff -r 4693c1d0c903 -r eb53408ae5e0 docs/source/quickstart.rst --- a/docs/source/quickstart.rst Fri Aug 26 19:12:34 2011 -0400 +++ b/docs/source/quickstart.rst Fri Aug 26 19:16:54 2011 -0400 @@ -30,11 +30,11 @@ Now you can go back to your REPL and get started. Import the things you'll need:: - (require '(clojurecraft [core :as cc] [actions :as act] [events :as es])) + (require '(clojurecraft [core :as core] [actions :as actions])) Create a bot connected to your local server:: - (def bot (cc/connect cc/minecraft-local "desired_username")) + (def bot (core/connect core/minecraft-local "desired_username")) Right now Clojurecraft doesn't support authentication, so it's turned off on the bundled server and you can choose any username you like. You can pass ``nil`` @@ -44,9 +44,9 @@ through your Minecraft client. Once your bot is in the world you're all set to play around. At the moment the only -action implemented is basic movement. Move your bot around with ``act/move``:: +action implemented is basic movement. Move your bot around with ``actions/move``:: - (force (act/move bot 2 0 1)) + (actions/perform! (actions/move bot 2 0 1)) The numbers are the x, y, and z distance you wish to move. For now you can't use the ``y`` argument -- you must always pass ``0``. @@ -57,7 +57,7 @@ Now try jumping:: - (force (act/jump bot)) + (actions/perform! (actions/jump bot)) Clojurecraft isn't stable and is evolving quickly, but you can check out these docs to read about some of the design decisions. As soon as you see a ``v1.0.0`` tag