[TxMt] MUSHCode Bundle

Stephen Hansen apt.shansen at gmail.com
Thu Nov 2 03:54:49 UTC 2006


Soo, I saw this tm_dialog thing, and it inspired me to do some fancy stuff
and figure out how to actually make TextMate bundles. And since I code for
MUSHes periodically, and its a royal PITA, I thought I'd fix it to be not
painful anymore.

If anyone's interested in it, you can grab it from
http://ixokai.net/MUSHCode

>From the readme I stuck in the .zip, if anyone's curious :) .....

The MUSHCode TextMate Bundle
----------------------------

1. The Language
    The language specification is currently very simple, but really,
MUSHCode isn't too complicated of a "language" :) Notably, it adds attribute
setting commands to the symbol list as long as they are the first thing to
show up on a line, and are in the format of: &(header)(separator)(footer).
The header must be alphanumeric. The separator must either a period, a dash
or an underscore. The footer can contain any alphanumeric or separator
characters.

2. Integrated Unformatter (Command+Shift+U)
    This will run the selected text or the entire document through the
unformatter included with the bundle and compress the MUSHcode. The
following rules are used by the unformatter process:
    * Any lines beginning with a # are considered comments, and will be
omitted from the file.
    * All insignificant whitespace (including newlines) will be compressed.
    * If a line begins with a -, a newline will be inserted into the output.
This does not have to be the only character on the line, but can be.
    * If a line begins with a ", the line will be processed as raw text. All
whitespace (including newlines) will be preserved and converted into %b
substitutions, unless it is more then 5 characters in a row in which case
the space() function will be used instead. The following characters will
also be escaped: % [ ] ( ) { }
    * Comments can contain 'directives', which contain instructions or
options for other parts of the Bundle. These are in the format of: #
directive: value

    The following directives are currently in use:
        site    --    This indicates the site that this code is for.
Example: # site: yourgame.com 4201
        user    --    This indicates the wizard/user that will contain your
code. Example: # user: Potrzebie
        object    --    This maps a dbref to an alias. Example: # user:
spelldb = #1234

    At present, the above directives are only used by the Grab Text
function, although other features will take advantage of them in the future.

3. Grab Text (Command+Shift+G)
    This is mostly a proof-of-concept more then it is a feature people will
want to use, but it was fun and taught me how to do some things :)
    NOTE: This requires you to install Python 2.4 and PyObjC 1.7 (the only
build that has Universal support)

    The purpose of the Grab Text function is to connect to a game, obtain an
attribute (or attributes), and display it to you (to copy into your current
document).

    When you invoke the function, it will prompt you with a dialog box that
asks for the site, port, username, object and attribute. The site, port and
username will be read from the directives in the current file if present,
but they can be overridden. In the object field, you can specify objects you
have defined in the object directives above instead of remembering the
dbrefs.

    Next, the system will prompt your password to this account. It will only
do this the first time you connect to the specified site with this username.
After you provide the password for the first time, it will be stored in your
Keychain and automatically obtained for any future invocations. If you ever
change your password, you'll have to modify it with the Keychain Access
application in the future.

    Once it has all the connection information it needs, it will connect to
the MUSH and 'grab' the specified attributes. The 'attribute' field can
contain wildcards to obtain more then one. This isn't the fastest operation
in the world, depending on your internet access-- be patient!

    Once it has all the data, it will display it to you in a window. You can
copy/paste from here and then work on the code in your document.

    The display window also has a 'Reformat' button that will run the
MUSHcode through a -very- simple 'prettifier'-- although its not very
pretty. I'm really how to best go about 'formatting' MUSHcode in a pretty
way right... Ideas/implementations? :)

---------

This is just the module so far. I have a lot of ideas, and sorta want to
turn TextMate into a neat little MUSHCode IDE. I have a couple *really* big
coding projects I maintain and.. its all a bit of a pain. So, I'm wanting to
make my life easier :) Some features I am thinking of implementing:

 * A 'quote' or 'put text' feature to take the selected text (or the entire
document), run it through the unformatter and deliver it onto the game
directly. This would make use of the 'object' directives, so you can include
things like:
        &cmd.xp/vote #VoteSystem=$cmd.+xp/vote *:...
    and it will automatically replace "#VoteSystem" with the specified
dbrefs.

 * The ability to split up a large project into multiple files in a single
project, and have it "install" or "quote" the entire project at once.
Perhaps with a specified order; directives to make one file depend on
another and thus affect ordering of the installation/quoting would be fairly
easy.

 * At this point, the combination of Grab and Put gives me some very
interesting possibilities: a 'compare' function to connect to the game and
compare what is online to what is offline and show me what's missing.
Perhaps with pretty HTML diffs even.

Any other ideas? :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20061101/2dfaaca0/attachment.html>


More information about the textmate mailing list