From ab10720260e2c184b319026da89f4dfd338500bb Mon Sep 17 00:00:00 2001
From: Brian Cully First of all, Moxie makes no distinction between triggers, aliases, and macros. We
+ treat all of these things in the same way: as a plugin. All plugins are written in Common Lisp, so you'll have to have some grounding in
+ Lisp to do anything serious at the moment (although I have some ideas for simpler
+ interfaces for the non-programming-minded in the future). There are a few support
+ routines included in the MOXIE package to
+ simplify common plugin tasks, such as triggers and aliases. Because I didn't want to have to write my own language for triggers, aliases, and
+ macros. No matter how much I worked on it, I wasn't going to get the kind of
+ programmability I wanted without embedding a full programming language.
+ I also think it's something of a waste of time to learn a new language just for the
+ purpose of programming a trigger in your MUX client.
+ I could have just used AppleScript as the language of choice, and came very
+ close to doing so a number of times, but I had too much trouble trying to get
+ AS and ObjC talking as well as I'd liked, and, frankly, I don't consider it to
+ be full-featured enough. So I chose to embed a language. There are, theoretically, a fair number
+ of popular languages I could have embedded, however, I chose Lisp for the
+ following reasons:
+ Known Bugs
+
+
+
+
diff --git a/English.lproj/Moxie Help/pages/.svn/text-base/faq.html.svn-base b/English.lproj/Moxie Help/pages/.svn/text-base/faq.html.svn-base
new file mode 100644
index 0000000..a80cde3
--- /dev/null
+++ b/English.lproj/Moxie Help/pages/.svn/text-base/faq.html.svn-base
@@ -0,0 +1,81 @@
+
+
+
+ Frequently Asked Questions
+
+
+
+
There are a number of web sites devoted to Lisp programming. Below, I'll list a few + resources that should get you pointed in the right direction: +
The REPL is your direct + interface to the Lisp sub-system. It is the key to fully interactive programming. Via + the REPL you can input Lisp commands directly and see the results - any Lisp will work + here, including function definitions. This allows you to write a function, test it, and + debug it, all without leaving the REPL, and with a much finer grain of control than with + a compile cycle.
+Syntax:
++ NAME ARG => RETURN-VALUE +
+ +Arguments and Values:
++
ARG---A TYPE.
+RETURN-VALUE---An TYPE.
+ + +Description: None.
+ +Examples:
+CODE+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ FUNCTION +
+ +Notes: None
diff --git a/English.lproj/Moxie Help/pages/.svn/text-base/glossary.html.svn-base b/English.lproj/Moxie Help/pages/.svn/text-base/glossary.html.svn-base new file mode 100644 index 0000000..3606388 --- /dev/null +++ b/English.lproj/Moxie Help/pages/.svn/text-base/glossary.html.svn-base @@ -0,0 +1,27 @@ + + + +These functions are all exported from the MOXIE
+ package.
+
+ Contents: +
Syntax:
+
+ world-var name &optional
(world-id *world*) => result
+
+ (setf (world-var name &optional
(world-id *world*)) new-value)
+
Arguments and Values:
++
name---an object.
+world-id---an object.
+result---an object.
+ + +Description:
++ world-var is used to associate values, which are persistent throughout the application's lifetime, with name for a particular Moxie world, which has the unique identifier, world-id. +
++ setf may be used with world-var to modify the values associated with a given name, or to add a new entry. +
+ +Examples:
+(setf (world-var :foo 0) 'bar) => BAR + (world-var :foo 0) => BAR + (world-var :foo 1) => NIL + (setf (world-var :foo 1) 'YOW) => YOW + (world-var :foo 1) => YOW + (world-var :foo 0) => BAR+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +Notes:
+
+ world-id is available as the *world*
special variable.
+
Syntax:
++ add-hook function mode => hook-list +
+ +Arguments and Values:
++
function--a function designator. +
mode---A keyword.
+hook-list---A list containing the active functions for mode.
+ + +Description:
+add-hook adds function to the list of functions to be run when + the hook mode is executed via run-hook.
+ +Examples:
++ (defun my-printer (string) + (let ((string (if (stringp string) string (car string)))) + (concatenate 'string "TEST: " string))) => MY-PRINTER + (add-hook 'my-printer :output-from-server-hook) => (MY-PRINTER) + (run-hook :output-from-server-hook "foo") => "TEST: foo" + (defun 'do-nothing (&rest args) nil) => DO-NOTHING + (add-hook 'do-nothing :output-from-server-hook) => (MY-PRINTER DO-NOTHING) + (run-hook :output-from-server-hook "foo") => "TEST: foo"+ + +
Side Effects:
+function will be run by run-hook for mode.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ remove-hook + run-hook +
+ +Notes: +
If function is already on the hook list for mode, it will + not be added again.
+ +Syntax:
++ remove-hook function mode => hook-list +
+ +Arguments and Values:
++
function--a function designator. +
mode---A keyword.
+hook-list---A list containing the active functions for mode.
+ + +Description: None.
+ +Examples:
++ (remove-hook 'my-printer :output-from-server-hook) => NIL+ +
Side Effects:
+function is no longer called by run-hook
.
Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
+ + +Notes:
++ If function is not on the hook list for mode, the hook list is + returned without change. You can use this facility to get the current list + of functions for mode by removing NIL from the hook list. +
+ +Syntax:
+
+ run-hook mode &optional
arg
+ => result*
+
Arguments and Values:
++
mode---a keyword.
+arg---an object.
+results---the values returned by the last non-NIL terminating function.
+ + +Description:
++ Applies the + functions for mode to the args. +
++ A hook-list acts as a filter, passing the output of one filter into the input of + the next. If a function on the hook-list returns NIL, it is treated in this iteration + as if it hadn't been on the hook-list in the first place. Thus, the only time + run-hook returns NIL is when every function on the hook-list returns + NIL. +
+ +Examples:
++ (run-hook :output-from-server-hook "Foobar!") => "TEST: Foobar!"+ +
Side Effects: None.
+ +Affected By:
++ The hook list for mode. All the functions on the list are called, in + order. The last function which returns a non-nil value is used as the result + function. +
+ +Exceptional Situations:
++ If a function on the hook list for mode is not a function + designator, an error will be raised. +
+ +See Also:
++ add-hook + remove-hook +
+ +Notes: None.
+ +Syntax:
++ add-keyword function keyword => result +
+ +Arguments and Values:
++
function--a function designator. +
keyword---a string.
+result---the function designator for keyword.
+ + +Description: None.
+ +Examples:
+(defun my-keyword (args) + (format t "Keyword expander: ~S~%" args)) => MY-KEYWORD + (add-keyword 'my-keyword "foo") => MY-KEYWORD+ +
Side Effects:
++ keyword is registered for keyword expansion. +
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ remove-keyword +
+ +Notes:
++ The keyword expander compares keywords in a case insensitive fashion. So "FOO" and + "foo" are equivalent. +
+ +Syntax:
++ remove-keyword keyword => result +
+ +Arguments and Values:
++
keyword---a string.
+result---the T on successful removal. NIL otherwise. +
+ +Description: None.
+ +Examples:
+(remove-keyword "foo") => T + (remove-keyword "foo") => NIL+ +
Side Effects:
++ keyword is no longer expanded by the keyword expander. +
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ add-keyword +
+ +Notes:
++ The keyword expander compares keywords in a case insensitive fashion. So "FOO" and + "foo" are equivalent. +
+ +Syntax:
++ add-keystroke-macro function keystroke => result +
+ +Arguments and Values:
++
function--a function designator. +
keystroke---a keyword.
+result---the function designator for keyword.
+ + +Description: None.
+ +Examples:
+(defun my-keystroke-macro (keystroke) + (format t "Should expand keystroke ~S here.~%" keystroke)) => MY-KEYSTROKE-MACRO + (add-keystroke-macro 'my-keystroke-macro :f1) => MY-KEYSTROKE-MACRO+ +
Side Effects:
++ function is called when keystroke is pressed. +
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
+ + +Notes:
++ Unlike most other functions defined here, keystrokes don't do anything by default. + This means that in order to achieve some user-visible result, you'll have to use + the lower level functions print-to-world, or send-to-mux.. +
+This format is likely to change very soon!
++ Keystrokes, currently, are keywords with the following format: +
+ keystroke := :[<modifier>-]*<keycode> + modifier := cmd|opt|ctrl|shift|numpad + keycode := <fkey>|character + fkey := f1 .. fn .. f35+ So, hitting 8 on the number pad, while the command key is down yields the keyword:
:cmd-numpad-8
+
+
+ Function REMOVE-KEYSTROKE-MACRO
+Syntax:
++ remove-keystroke-macro keystroke => result +
+ +Arguments and Values:
++
keystroke---a keyword.
+result---T, if the keystroke was previously registered, NIL otherwise.
+ + +Description: None.
+ +Examples:
+(remove-keystroke-macro :f1) => T + (remove-keystroke-macro :f1) => NIL+ +
Side Effects:
++ keystroke no longer triggers a function call. +
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
+ + +Notes:
+This format is likely to change very soon!
++ Keystrokes, currently, are keywords with the following format: +
+ keystroke := :[<modifier>-]*<keycode> + modifier := cmd|opt|ctrl|shift|numpad + keycode := <fkey>|character + fkey := f1 .. fn .. f35+ So, hitting 8 on the number pad, while the command key is down yields the keyword:
:cmd-numpad-8
+
+
+ Syntax:
++ send-to-mux world-id string +
+ +Arguments and Values:
++
world-id---an object.
+string---a string.
+ + +Description:
++ This is the low-level function to send data to the MUX server associated with + world-id. Currently, you can only send a string command, which will be + interpreted by the MUX directly. This may change in the future to allow for + attributed strings. +
+ +Examples:
+(send-to-mux *world* (format nil "Wauug!~%"))+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ print-to-world + set-status-buffer +
+ +Notes:
+
+ world-id is available as the *world*
special variable.
+
Syntax:
++ print-to-world world-id arg +
+ +Arguments and Values:
++
world-id---an object.
+string---a string.
+ + +Description:
++ This is the low-level function to send data to the Moxie's world output view + associated with world-id. You can send either a normal string or an + attributed string for printing. +
+ +Examples:
+(print-to-world *world* (format nil "Wauug!~%"))+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ send-to-mux + set-status-buffer + make-attributed-string +
+ +Notes:
+
+ world-id is available as the *world*
special variable.
+
Syntax:
++ set-status-buffer world-id string +
+ +Arguments and Values:
++
world-id---an object.
+string---a string.
+ + +Description:
++ Sets the status buffer of the window associated with world-id to string. +
+ +Examples:
+(set-status-buffer *world* "Hello, world!")+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ send-to-mux + print-to-world +
+ +Notes:
+
+ world-id is available as the *world*
special variable.
+
Syntax:
++ enable-logging world-id +
+ +Arguments and Values:
++
world-id---an object.
+ + +Description:
++ Enables logging for the world associated with world-id. +
+ +Examples:
+(enable-logging *world*)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ disable-logging +
+ +Notes:
+
+ world-id is available as the *world*
special variable.
+
Syntax:
++ disable-logging world-id +
+ +Arguments and Values:
++
world-id---an object.
+ + +Description:
++ Disables logging for the world associated with world-id. +
+ +Examples:
+(disable-logging *world*)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ enable-logging +
+ +Notes:
+
+ world-id is available as the *world*
special variable.
+
Function MAKE-ATTRIBUTED-STRING
+Syntax:
+
+ make-attributed-string string &rest
attribute* => result
+
Arguments and Values:
++
string---a string.
+attributes---a list.
+result---a list.
+ + +Description:
++ Creates a string with attributes applied to it. This allows you to change various display properties of the string, such as the color, font, and style. +
+ +Examples:
++ (make-attributed-string "Wauug!" (make-range 0 (length "Wauug!")) + (make-color 100 100 100) + (make-underline 1)) => ("Wauug!" ((:RANGE 0 6) + (:COLOR 100 100 100) + (:UNDERLINE 1)))+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-range + make-font + make-color + make-super + make-underline + make-link +
+ +Notes:
+
+ The only hook, currently, which can use attributed strings is :output-from-server-hook
, which calls on print-to-world
to display results. Those are the only places within Moxie to which you should be sending attributed strings.
+
Syntax:
++ make-range index length => result +
+ +Arguments and Values:
++
index---a bounding index designator. +
length---a non-negative integer. +
result---a list.
+ + +Description:
++ Creates a range object from index for a length. +
+ +Examples:
+(make-range 0 (length "Wauug!")) => (:RANGE 0 6)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-attributed-string + make-font + make-color + make-super + make-underline + make-link +
+ +Notes:
++ This function is likely to go away in the future as the attributed string mechansism gets cleaned up. +
+ +Syntax:
++ make-font name size => result +
+ +Arguments and Values:
++
name---a string.
+size---a real. +
+result---a list.
+ + +Description:
++ Creates a font object. The font is located by name and is size points high. +
+ +Examples:
+(make-font "apple-monaco" 12.0) => (:FONT "apple-monaco" 12.0)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-attributed-string + make-range + make-color + make-super + make-underline + make-link +
+ +Syntax:
++ make-color red-value green-value blue-value => result +
+ +Arguments and Values:
++
red-value---an integer between 0 and 255. +
green-value---an integer between 0 and 255. +
blue-value---an integer between 0 and 255. +
result---a list.
+ + +Description:
++ Creates a color object with the specified values for red, green, and blue. +
+ +Examples:
+(make-color 100 100 100) => (:COLOR 100 100 100)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-attributed-string + make-range + make-font + make-super + make-underline + make-link +
+ +Syntax:
++ make-super level => result +
+ +Arguments and Values:
++
level---a non-negative integer. +
result---a list.
+ + +Description:
++ Creates a superscript attribute at the specified level. At level 0, the text is inline with normally attributed text, at each level above 0, the text moves higher and becomes smaller, denoting a superscript. +
+ +Examples:
+(make-super 1) => (:SUPER 1)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-attributed-string + make-range + make-font + make-color + make-underline + make-link +
+ +Syntax:
++ make-underline level => result +
+ +Arguments and Values:
++
level---a non-negative integer. +
result---a list.
+ + +Description:
++ Creates an underline attribute with level number of underline strokes. +
+ +Examples:
+(make-underline 1) => (:UNDERLINE 1)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-attributed-string + make-range + make-font + make-color + make-super + make-link +
+ +Syntax:
++ make-link url => result +
+ +Arguments and Values:
++
url---a string.
+result---a list.
+ + +Description:
++ Creates a link attribute, pointing to url. +
+ +Examples:
+(make-link "http://www.spork.org/") => (:LINK "http://www.spork.org/")+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-attributed-string + make-range + make-font + make-color + make-super + make-underline +
+ +Syntax:
++ escape-mux-string string => result +
+ +Arguments and Values:
++
string---a string.
+result---a string.
+ + +Description:
++ This function is used to create pre-formatted strings for a MUX. MUXes normally ignore sequences of white space, and error on newlines, ignoring tab markins except as their capacity for white space. You can get around this by injecting %r, %t, and %b for newlines, tab characters, and white space, respectively. This function does that for you. +
+ +Examples:
+(escape-mux-string "xyzzy plugh") => "xyzzy%bplugh"+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +Notes:
++ This function may only be useful for MUSHes. If your MUX escapes strings differently than a MUSH, then you will need a new function. +
+ +Syntax:
++ map-variables string variable-list=> result-string +
+ +Arguments and Values:
++
string---a string.
+variable-list---a list containing the variable substitutions for string. +
result-string---a string.
+ + +Description:
+
+ map-variables returns a string composed by substituting patterns of
+ the form $number$ from string with those places in variable-list.
+ So, $1$
refers to the first position (i.e., car) of the list
+ variable-list.
+
Examples:
++ (map-variables "one: $1$ two: $2$ three: $3$" '(1 2 3)) => "one: 1 two: 2 three: 3"+
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ + diff --git a/English.lproj/Moxie Help/pages/.svn/text-base/lisp-glossary.html.svn-base b/English.lproj/Moxie Help/pages/.svn/text-base/lisp-glossary.html.svn-base new file mode 100644 index 0000000..6f64434 --- /dev/null +++ b/English.lproj/Moxie Help/pages/.svn/text-base/lisp-glossary.html.svn-base @@ -0,0 +1,68 @@ + + + +(abbrev, "Another System Definition Facility" A way to + package a lisp bundle together. See the CLiki + page for further + details.
A collection of utilities the author (bjc) finds useful, and so, + in order to facilitate his hacking, he has also included within + Moxie.
(abbrev, "Common Lisp HyperSpec") The authoritative + reference for the ANSI ratified Common Lisp.
+ +
You may find a version of the HyperSpec online at: + + LispWorks
(from "Common Lisp" and "Wiki") A Wiki devoted to + Common Lisp.
+ +(abbrev, "Common Lisp Portable Perl Compatible Regular Expression") + A Lisp package with functions to parse and match + with PERL-style Regular Expressions.
+ +(abbrev, "Embeddable Common Lisp") Moxie uses ECL for + its lisp sub-system. More information on ECL can be found on the + SourceForge + project page
Packages are a kind of lisp "library". See the CLHS + Chapter 11.
(abbrev, "Read, Eval, Print Loop") The main loop responsible + for accepting user input, evaluating the input, and printing the results + of that evaluation. The REPL is often used synonymously with + "top level."
The top-most REPL. It is the first loop instantiated + by the lisp sub-system, from which everything else is evaluated.
Moxie is a client for MUX systems. Some of its + notable features are:
+ +You can create sessions ("Worlds" in Moxie) + which contain all your preferences for a given world, as well as configure + global preferences (such as what worlds to start up when Moxie launches).
+ +If you want to learn more about any of this, click a topic on the left.
+ + diff --git a/English.lproj/Moxie Help/pages/.svn/text-base/plugin.html.svn-base b/English.lproj/Moxie Help/pages/.svn/text-base/plugin.html.svn-base new file mode 100644 index 0000000..1f048c1 --- /dev/null +++ b/English.lproj/Moxie Help/pages/.svn/text-base/plugin.html.svn-base @@ -0,0 +1,203 @@ + + + ++ Most MUXes are built off very similar codebases and design patters, but + within those similar roots are an infinite and varied number of worlds. +
++ In order to cope with the almost maddening variety in MUXing, + programmatically, you have to develop some kind of programming language. + For instance, TinyFugue's trigger's are a simple programming language. +
++ So, to allow for the largest amount of flexibility in Moxie, Moxie + includes a full programming language. While inventing one specifically + for Moxie would certainly be the norm, it is not something that should + be valued highly. In fact, by using a standard language, you get a lot + of benefits of useably free code-base. +
++ So, Moxie includes an embedded lisp + interpreter. This gives you the full power of the Lisp language from + within your plugin code. What kind of things you write, and how you want to + interact with Moxie and your MUX are limited only by your imagination. +
++ This does mean you'll have to learn Lisp - at least a little - in order + to write any plugins for Moxie, although I will endeavour to keep things + as simple as possible throughout this document. +
+ ++ The simplest plugins are keyword expansions: when you type + "/foobar baz" into Moxie, it will try to trigger keyword expansion for + the keyword "foobar". +
++ To register a keyword expander, you first have to write the code + for the expander, then register it with the keyword expansion hook. + all the functions referenced here are exported from the MOXIE + package. +
++ First, we'll create a package for our test plugin, and use the moxie + package, as well as the + bjc-utils package. +
++ (defpackage test-plugin + (:use :cl :cl-user :moxie :bjc-utils)) + (in-package :test-plugin) ++
+ Then we define our expander function. We just want to take a name off + of the argument line, and page them with "hello!". For the sake of + debugging, we also want to print out what we got as the argument + to the lisp REPL: +
++ (defun foobar-handler (string) + (format t "foobar-handler got: ~A~%" string) + (map-variables "page $1$ = hello!" + (split string #\Space))) ++
+ The function we've defined returns the string from the map-variables + command. This return value is what's sent to the MUX. If we don't want + to send anything to the MUX you can return an empty string ("") or + nil. +
++ Now that we have the function defined, we want to register it with + the keyword expansion hook: +
++ (add-keyword 'foobar-handler "foobar") ++
+ To test this, first bring up the REPL window so we can see what's + being printed out by the function as it runs. To do this, select + "Lisp REPL" from the "Window" menu. +
++ Now, in Moxie, type "/foobar me", and, assuming you're connected + to a MUX, you should get a page from yourself saying, "hello!". + In the REPL window, however, you'll see: +
++ foobar-handler got: me ++
+ Which means the handler received the string "me" as the argument + string. +
++ If you're curious how the functions map-variables and split work, + in the REPL, type "(documentation 'map-variables 'function)" to view + their documentation. +
++ There are other pre-defined triggers that work in a similar fashion. + There is a list of them in the moxie.lisp file in the + resources directory. +
+ ++ Moxie uses a set of pre-defined symbols to communicate with the lisp + sub-system. Below is a table of symbols, what type they are, and what + they do. +
+Name | +Type | +Description | +
moxie::*moxie-result-stream* | +stream | +The stream for communicating with Moxie. | +
moxie::*world* | +object | +The currently active world-id. This may be 0, if a world hasn't called into + the plugin system. | +
moxie::eval-hook | +function | +Used by Moxie to send data from the REPL window to the + lisp plugin system. | +
moxie::input-to-server-hook | +function | +Used by Moxie to send data to the lisp plugins after receiving + something from the input line. | +
moxie::output-from-server-hook | +function | +Used by Moxie when data is received from the MUX for display + on the screen. | +
moxie::keystroke-hook | +function | +Used by Moxie when a registered keystroke is pressed to call into its + function | +
moxie::world-opened-hook | +function | +Used by Moxie to tell the plugin system a new world has opened. | +
moxie::world-closed-hook | +function | +Used by Moxie to tell the plugin system a world has closed. | +
moxie::start-logging-hook | +function | +Used by Moxie to tell the plugin system it wishes to log transcripts. | +
moxie::stop-logging-hook | +function | +Used by Moxie to tell the plugin system it no longer wishes to log. | +
+ You can find definitions for all the built in functions in the Application
+ bundle: Contents/Resources/*.lisp
. The file startlisp
+ parses the file init-template.lisp
and starts the lisp with the parsed
+ file, loading the rest of the plug in system with it.
+
+ There are certain hooks in tpl.lisp
which the application calls. You
+ can have a look at them, and even change them if you want, but don't
+ rename them or Moxie won't work anymore.
+
+ Also included in the Application Plug-Ins directory are a few pre-supplied plug ins + which you can use as an example. This includes the default logger, numpad movement macros, + and ANSI color support. +
+ + + + +:timer-hook
.clear
+ key on the numeric keypad.world-var
function. These variables differ depending upon
+ which world is calling into the plug in, and can be used to keep state
+ information. See the plug in documentation for further information.First of all, Moxie makes no distinction between triggers, aliases, and macros. We + treat all of these things in the same way: as a plugin.
+ +All plugins are written in Common Lisp, so you'll have to have some grounding in + Lisp to do anything serious at the moment (although I have some ideas for simpler + interfaces for the non-programming-minded in the future). There are a few support + routines included in the MOXIE package to + simplify common plugin tasks, such as triggers and aliases.
+Because I didn't want to have to write my own language for triggers, aliases, and + macros. No matter how much I worked on it, I wasn't going to get the kind of + programmability I wanted without embedding a full programming language. + I also think it's something of a waste of time to learn a new language just for the + purpose of programming a trigger in your MUX client. +
+I could have just used AppleScript as the language of choice, and came very + close to doing so a number of times, but I had too much trouble trying to get + AS and ObjC talking as well as I'd liked, and, frankly, I don't consider it to + be full-featured enough.
+So I chose to embed a language. There are, theoretically, a fair number + of popular languages I could have embedded, however, I chose Lisp for the + following reasons: +
There are a number of web sites devoted to Lisp programming. Below, I'll list a few + resources that should get you pointed in the right direction: +
The REPL is your direct + interface to the Lisp sub-system. It is the key to fully interactive programming. Via + the REPL you can input Lisp commands directly and see the results - any Lisp will work + here, including function definitions. This allows you to write a function, test it, and + debug it, all without leaving the REPL, and with a much finer grain of control than with + a compile cycle.
+Syntax:
++ NAME ARG => RETURN-VALUE +
+ +Arguments and Values:
++
ARG---A TYPE.
+RETURN-VALUE---An TYPE.
+ + +Description: None.
+ +Examples:
+CODE+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ FUNCTION +
+ +Notes: None
diff --git a/English.lproj/Moxie Help/pages/glossary.html b/English.lproj/Moxie Help/pages/glossary.html new file mode 100644 index 0000000..3606388 --- /dev/null +++ b/English.lproj/Moxie Help/pages/glossary.html @@ -0,0 +1,27 @@ + + + +These functions are all exported from the MOXIE
+ package.
+
+ Contents: +
Syntax:
+
+ world-var name &optional
(world-id *world*) => result
+
+ (setf (world-var name &optional
(world-id *world*)) new-value)
+
Arguments and Values:
++
name---an object.
+world-id---an object.
+result---an object.
+ + +Description:
++ world-var is used to associate values, which are persistent throughout the application's lifetime, with name for a particular Moxie world, which has the unique identifier, world-id. +
++ setf may be used with world-var to modify the values associated with a given name, or to add a new entry. +
+ +Examples:
+(setf (world-var :foo 0) 'bar) => BAR + (world-var :foo 0) => BAR + (world-var :foo 1) => NIL + (setf (world-var :foo 1) 'YOW) => YOW + (world-var :foo 1) => YOW + (world-var :foo 0) => BAR+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +Notes:
+
+ world-id is available as the *world*
special variable.
+
Syntax:
++ add-hook function mode => hook-list +
+ +Arguments and Values:
++
function--a function designator. +
mode---A keyword.
+hook-list---A list containing the active functions for mode.
+ + +Description:
+add-hook adds function to the list of functions to be run when + the hook mode is executed via run-hook.
+ +Examples:
++ (defun my-printer (string) + (let ((string (if (stringp string) string (car string)))) + (concatenate 'string "TEST: " string))) => MY-PRINTER + (add-hook 'my-printer :output-from-server-hook) => (MY-PRINTER) + (run-hook :output-from-server-hook "foo") => "TEST: foo" + (defun 'do-nothing (&rest args) nil) => DO-NOTHING + (add-hook 'do-nothing :output-from-server-hook) => (MY-PRINTER DO-NOTHING) + (run-hook :output-from-server-hook "foo") => "TEST: foo"+ + +
Side Effects:
+function will be run by run-hook for mode.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ remove-hook + run-hook +
+ +Notes: +
If function is already on the hook list for mode, it will + not be added again.
+ +Syntax:
++ remove-hook function mode => hook-list +
+ +Arguments and Values:
++
function--a function designator. +
mode---A keyword.
+hook-list---A list containing the active functions for mode.
+ + +Description: None.
+ +Examples:
++ (remove-hook 'my-printer :output-from-server-hook) => NIL+ +
Side Effects:
+function is no longer called by run-hook
.
Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
+ + +Notes:
++ If function is not on the hook list for mode, the hook list is + returned without change. You can use this facility to get the current list + of functions for mode by removing NIL from the hook list. +
+ +Syntax:
+
+ run-hook mode &optional
arg
+ => result*
+
Arguments and Values:
++
mode---a keyword.
+arg---an object.
+results---the values returned by the last non-NIL terminating function.
+ + +Description:
++ Applies the + functions for mode to the args. +
++ A hook-list acts as a filter, passing the output of one filter into the input of + the next. If a function on the hook-list returns NIL, it is treated in this iteration + as if it hadn't been on the hook-list in the first place. Thus, the only time + run-hook returns NIL is when every function on the hook-list returns + NIL. +
+ +Examples:
++ (run-hook :output-from-server-hook "Foobar!") => "TEST: Foobar!"+ +
Side Effects: None.
+ +Affected By:
++ The hook list for mode. All the functions on the list are called, in + order. The last function which returns a non-nil value is used as the result + function. +
+ +Exceptional Situations:
++ If a function on the hook list for mode is not a function + designator, an error will be raised. +
+ +See Also:
++ add-hook + remove-hook +
+ +Notes: None.
+ +Syntax:
++ add-keyword function keyword => result +
+ +Arguments and Values:
++
function--a function designator. +
keyword---a string.
+result---the function designator for keyword.
+ + +Description: None.
+ +Examples:
+(defun my-keyword (args) + (format t "Keyword expander: ~S~%" args)) => MY-KEYWORD + (add-keyword 'my-keyword "foo") => MY-KEYWORD+ +
Side Effects:
++ keyword is registered for keyword expansion. +
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ remove-keyword +
+ +Notes:
++ The keyword expander compares keywords in a case insensitive fashion. So "FOO" and + "foo" are equivalent. +
+ +Syntax:
++ remove-keyword keyword => result +
+ +Arguments and Values:
++
keyword---a string.
+result---the T on successful removal. NIL otherwise. +
+ +Description: None.
+ +Examples:
+(remove-keyword "foo") => T + (remove-keyword "foo") => NIL+ +
Side Effects:
++ keyword is no longer expanded by the keyword expander. +
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ add-keyword +
+ +Notes:
++ The keyword expander compares keywords in a case insensitive fashion. So "FOO" and + "foo" are equivalent. +
+ +Syntax:
++ add-keystroke-macro function keystroke => result +
+ +Arguments and Values:
++
function--a function designator. +
keystroke---a keyword.
+result---the function designator for keyword.
+ + +Description: None.
+ +Examples:
+(defun my-keystroke-macro (keystroke) + (format t "Should expand keystroke ~S here.~%" keystroke)) => MY-KEYSTROKE-MACRO + (add-keystroke-macro 'my-keystroke-macro :f1) => MY-KEYSTROKE-MACRO+ +
Side Effects:
++ function is called when keystroke is pressed. +
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
+ + +Notes:
++ Unlike most other functions defined here, keystrokes don't do anything by default. + This means that in order to achieve some user-visible result, you'll have to use + the lower level functions print-to-world, or send-to-mux.. +
+This format is likely to change very soon!
++ Keystrokes, currently, are keywords with the following format: +
+ keystroke := :[<modifier>-]*<keycode> + modifier := cmd|opt|ctrl|shift|numpad + keycode := <fkey>|character + fkey := f1 .. fn .. f35+ So, hitting 8 on the number pad, while the command key is down yields the keyword:
:cmd-numpad-8
+
+
+ Function REMOVE-KEYSTROKE-MACRO
+Syntax:
++ remove-keystroke-macro keystroke => result +
+ +Arguments and Values:
++
keystroke---a keyword.
+result---T, if the keystroke was previously registered, NIL otherwise.
+ + +Description: None.
+ +Examples:
+(remove-keystroke-macro :f1) => T + (remove-keystroke-macro :f1) => NIL+ +
Side Effects:
++ keystroke no longer triggers a function call. +
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
+ + +Notes:
+This format is likely to change very soon!
++ Keystrokes, currently, are keywords with the following format: +
+ keystroke := :[<modifier>-]*<keycode> + modifier := cmd|opt|ctrl|shift|numpad + keycode := <fkey>|character + fkey := f1 .. fn .. f35+ So, hitting 8 on the number pad, while the command key is down yields the keyword:
:cmd-numpad-8
+
+
+ Syntax:
++ send-to-mux world-id string +
+ +Arguments and Values:
++
world-id---an object.
+string---a string.
+ + +Description:
++ This is the low-level function to send data to the MUX server associated with + world-id. Currently, you can only send a string command, which will be + interpreted by the MUX directly. This may change in the future to allow for + attributed strings. +
+ +Examples:
+(send-to-mux *world* (format nil "Wauug!~%"))+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ print-to-world + set-status-buffer +
+ +Notes:
+
+ world-id is available as the *world*
special variable.
+
Syntax:
++ print-to-world world-id arg +
+ +Arguments and Values:
++
world-id---an object.
+string---a string.
+ + +Description:
++ This is the low-level function to send data to the Moxie's world output view + associated with world-id. You can send either a normal string or an + attributed string for printing. +
+ +Examples:
+(print-to-world *world* (format nil "Wauug!~%"))+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ send-to-mux + set-status-buffer + make-attributed-string +
+ +Notes:
+
+ world-id is available as the *world*
special variable.
+
Syntax:
++ set-status-buffer world-id string +
+ +Arguments and Values:
++
world-id---an object.
+string---a string.
+ + +Description:
++ Sets the status buffer of the window associated with world-id to string. +
+ +Examples:
+(set-status-buffer *world* "Hello, world!")+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ send-to-mux + print-to-world +
+ +Notes:
+
+ world-id is available as the *world*
special variable.
+
Syntax:
++ enable-logging world-id +
+ +Arguments and Values:
++
world-id---an object.
+ + +Description:
++ Enables logging for the world associated with world-id. +
+ +Examples:
+(enable-logging *world*)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ disable-logging +
+ +Notes:
+
+ world-id is available as the *world*
special variable.
+
Syntax:
++ disable-logging world-id +
+ +Arguments and Values:
++
world-id---an object.
+ + +Description:
++ Disables logging for the world associated with world-id. +
+ +Examples:
+(disable-logging *world*)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ enable-logging +
+ +Notes:
+
+ world-id is available as the *world*
special variable.
+
Function MAKE-ATTRIBUTED-STRING
+Syntax:
+
+ make-attributed-string string &rest
attribute* => result
+
Arguments and Values:
++
string---a string.
+attributes---a list.
+result---a list.
+ + +Description:
++ Creates a string with attributes applied to it. This allows you to change various display properties of the string, such as the color, font, and style. +
+ +Examples:
++ (make-attributed-string "Wauug!" (make-range 0 (length "Wauug!")) + (make-color 100 100 100) + (make-underline 1)) => ("Wauug!" ((:RANGE 0 6) + (:COLOR 100 100 100) + (:UNDERLINE 1)))+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-range + make-font + make-color + make-super + make-underline + make-link +
+ +Notes:
+
+ The only hook, currently, which can use attributed strings is :output-from-server-hook
, which calls on print-to-world
to display results. Those are the only places within Moxie to which you should be sending attributed strings.
+
Syntax:
++ make-range index length => result +
+ +Arguments and Values:
++
index---a bounding index designator. +
length---a non-negative integer. +
result---a list.
+ + +Description:
++ Creates a range object from index for a length. +
+ +Examples:
+(make-range 0 (length "Wauug!")) => (:RANGE 0 6)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-attributed-string + make-font + make-color + make-super + make-underline + make-link +
+ +Notes:
++ This function is likely to go away in the future as the attributed string mechansism gets cleaned up. +
+ +Syntax:
++ make-font name size => result +
+ +Arguments and Values:
++
name---a string.
+size---a real. +
+result---a list.
+ + +Description:
++ Creates a font object. The font is located by name and is size points high. +
+ +Examples:
+(make-font "apple-monaco" 12.0) => (:FONT "apple-monaco" 12.0)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-attributed-string + make-range + make-color + make-super + make-underline + make-link +
+ +Syntax:
++ make-color red-value green-value blue-value => result +
+ +Arguments and Values:
++
red-value---an integer between 0 and 255. +
green-value---an integer between 0 and 255. +
blue-value---an integer between 0 and 255. +
result---a list.
+ + +Description:
++ Creates a color object with the specified values for red, green, and blue. +
+ +Examples:
+(make-color 100 100 100) => (:COLOR 100 100 100)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-attributed-string + make-range + make-font + make-super + make-underline + make-link +
+ +Syntax:
++ make-super level => result +
+ +Arguments and Values:
++
level---a non-negative integer. +
result---a list.
+ + +Description:
++ Creates a superscript attribute at the specified level. At level 0, the text is inline with normally attributed text, at each level above 0, the text moves higher and becomes smaller, denoting a superscript. +
+ +Examples:
+(make-super 1) => (:SUPER 1)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-attributed-string + make-range + make-font + make-color + make-underline + make-link +
+ +Syntax:
++ make-underline level => result +
+ +Arguments and Values:
++
level---a non-negative integer. +
result---a list.
+ + +Description:
++ Creates an underline attribute with level number of underline strokes. +
+ +Examples:
+(make-underline 1) => (:UNDERLINE 1)+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-attributed-string + make-range + make-font + make-color + make-super + make-link +
+ +Syntax:
++ make-link url => result +
+ +Arguments and Values:
++
url---a string.
+result---a list.
+ + +Description:
++ Creates a link attribute, pointing to url. +
+ +Examples:
+(make-link "http://www.spork.org/") => (:LINK "http://www.spork.org/")+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +See Also:
++ make-attributed-string + make-range + make-font + make-color + make-super + make-underline +
+ +Syntax:
++ escape-mux-string string => result +
+ +Arguments and Values:
++
string---a string.
+result---a string.
+ + +Description:
++ This function is used to create pre-formatted strings for a MUX. MUXes normally ignore sequences of white space, and error on newlines, ignoring tab markins except as their capacity for white space. You can get around this by injecting %r, %t, and %b for newlines, tab characters, and white space, respectively. This function does that for you. +
+ +Examples:
+(escape-mux-string "xyzzy plugh") => "xyzzy%bplugh"+ +
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ +Notes:
++ This function may only be useful for MUSHes. If your MUX escapes strings differently than a MUSH, then you will need a new function. +
+ +Syntax:
++ map-variables string variable-list=> result-string +
+ +Arguments and Values:
++
string---a string.
+variable-list---a list containing the variable substitutions for string. +
result-string---a string.
+ + +Description:
+
+ map-variables returns a string composed by substituting patterns of
+ the form $number$ from string with those places in variable-list.
+ So, $1$
refers to the first position (i.e., car) of the list
+ variable-list.
+
Examples:
++ (map-variables "one: $1$ two: $2$ three: $3$" '(1 2 3)) => "one: 1 two: 2 three: 3"+
Side Effects: None.
+ +Affected By: None.
+ +Exceptional Situations: None
+ + diff --git a/English.lproj/Moxie Help/pages/lisp-glossary.html b/English.lproj/Moxie Help/pages/lisp-glossary.html new file mode 100644 index 0000000..6f64434 --- /dev/null +++ b/English.lproj/Moxie Help/pages/lisp-glossary.html @@ -0,0 +1,68 @@ + + + +(abbrev, "Another System Definition Facility" A way to + package a lisp bundle together. See the CLiki + page for further + details.
A collection of utilities the author (bjc) finds useful, and so, + in order to facilitate his hacking, he has also included within + Moxie.
(abbrev, "Common Lisp HyperSpec") The authoritative + reference for the ANSI ratified Common Lisp.
+ +
You may find a version of the HyperSpec online at: + + LispWorks
(from "Common Lisp" and "Wiki") A Wiki devoted to + Common Lisp.
+ +(abbrev, "Common Lisp Portable Perl Compatible Regular Expression") + A Lisp package with functions to parse and match + with PERL-style Regular Expressions.
+ +(abbrev, "Embeddable Common Lisp") Moxie uses ECL for + its lisp sub-system. More information on ECL can be found on the + SourceForge + project page
Packages are a kind of lisp "library". See the CLHS + Chapter 11.
(abbrev, "Read, Eval, Print Loop") The main loop responsible + for accepting user input, evaluating the input, and printing the results + of that evaluation. The REPL is often used synonymously with + "top level."
The top-most REPL. It is the first loop instantiated + by the lisp sub-system, from which everything else is evaluated.
Moxie is a client for MUX systems. Some of its + notable features are:
+ +You can create sessions ("Worlds" in Moxie) + which contain all your preferences for a given world, as well as configure + global preferences (such as what worlds to start up when Moxie launches).
+ +If you want to learn more about any of this, click a topic on the left.
+ + diff --git a/English.lproj/Moxie Help/pages/plugin.html b/English.lproj/Moxie Help/pages/plugin.html new file mode 100644 index 0000000..1f048c1 --- /dev/null +++ b/English.lproj/Moxie Help/pages/plugin.html @@ -0,0 +1,203 @@ + + + ++ Most MUXes are built off very similar codebases and design patters, but + within those similar roots are an infinite and varied number of worlds. +
++ In order to cope with the almost maddening variety in MUXing, + programmatically, you have to develop some kind of programming language. + For instance, TinyFugue's trigger's are a simple programming language. +
++ So, to allow for the largest amount of flexibility in Moxie, Moxie + includes a full programming language. While inventing one specifically + for Moxie would certainly be the norm, it is not something that should + be valued highly. In fact, by using a standard language, you get a lot + of benefits of useably free code-base. +
++ So, Moxie includes an embedded lisp + interpreter. This gives you the full power of the Lisp language from + within your plugin code. What kind of things you write, and how you want to + interact with Moxie and your MUX are limited only by your imagination. +
++ This does mean you'll have to learn Lisp - at least a little - in order + to write any plugins for Moxie, although I will endeavour to keep things + as simple as possible throughout this document. +
+ ++ The simplest plugins are keyword expansions: when you type + "/foobar baz" into Moxie, it will try to trigger keyword expansion for + the keyword "foobar". +
++ To register a keyword expander, you first have to write the code + for the expander, then register it with the keyword expansion hook. + all the functions referenced here are exported from the MOXIE + package. +
++ First, we'll create a package for our test plugin, and use the moxie + package, as well as the + bjc-utils package. +
++ (defpackage test-plugin + (:use :cl :cl-user :moxie :bjc-utils)) + (in-package :test-plugin) ++
+ Then we define our expander function. We just want to take a name off + of the argument line, and page them with "hello!". For the sake of + debugging, we also want to print out what we got as the argument + to the lisp REPL: +
++ (defun foobar-handler (string) + (format t "foobar-handler got: ~A~%" string) + (map-variables "page $1$ = hello!" + (split string #\Space))) ++
+ The function we've defined returns the string from the map-variables + command. This return value is what's sent to the MUX. If we don't want + to send anything to the MUX you can return an empty string ("") or + nil. +
++ Now that we have the function defined, we want to register it with + the keyword expansion hook: +
++ (add-keyword 'foobar-handler "foobar") ++
+ To test this, first bring up the REPL window so we can see what's + being printed out by the function as it runs. To do this, select + "Lisp REPL" from the "Window" menu. +
++ Now, in Moxie, type "/foobar me", and, assuming you're connected + to a MUX, you should get a page from yourself saying, "hello!". + In the REPL window, however, you'll see: +
++ foobar-handler got: me ++
+ Which means the handler received the string "me" as the argument + string. +
++ If you're curious how the functions map-variables and split work, + in the REPL, type "(documentation 'map-variables 'function)" to view + their documentation. +
++ There are other pre-defined triggers that work in a similar fashion. + There is a list of them in the moxie.lisp file in the + resources directory. +
+ ++ Moxie uses a set of pre-defined symbols to communicate with the lisp + sub-system. Below is a table of symbols, what type they are, and what + they do. +
+Name | +Type | +Description | +
moxie::*moxie-result-stream* | +stream | +The stream for communicating with Moxie. | +
moxie::*world* | +object | +The currently active world-id. This may be 0, if a world hasn't called into + the plugin system. | +
moxie::eval-hook | +function | +Used by Moxie to send data from the REPL window to the + lisp plugin system. | +
moxie::input-to-server-hook | +function | +Used by Moxie to send data to the lisp plugins after receiving + something from the input line. | +
moxie::output-from-server-hook | +function | +Used by Moxie when data is received from the MUX for display + on the screen. | +
moxie::keystroke-hook | +function | +Used by Moxie when a registered keystroke is pressed to call into its + function | +
moxie::world-opened-hook | +function | +Used by Moxie to tell the plugin system a new world has opened. | +
moxie::world-closed-hook | +function | +Used by Moxie to tell the plugin system a world has closed. | +
moxie::start-logging-hook | +function | +Used by Moxie to tell the plugin system it wishes to log transcripts. | +
moxie::stop-logging-hook | +function | +Used by Moxie to tell the plugin system it no longer wishes to log. | +
+ You can find definitions for all the built in functions in the Application
+ bundle: Contents/Resources/*.lisp
. The file startlisp
+ parses the file init-template.lisp
and starts the lisp with the parsed
+ file, loading the rest of the plug in system with it.
+
+ There are certain hooks in tpl.lisp
which the application calls. You
+ can have a look at them, and even change them if you want, but don't
+ rename them or Moxie won't work anymore.
+
+ Also included in the Application Plug-Ins directory are a few pre-supplied plug ins + which you can use as an example. This includes the default logger, numpad movement macros, + and ANSI color support. +
+ + + + +:timer-hook
.clear
+ key on the numeric keypad.world-var
function. These variables differ depending upon
+ which world is calling into the plug in, and can be used to keep state
+ information. See the plug in documentation for further information.