Skip to content

Latest commit

 

History

History
158 lines (124 loc) · 8.39 KB

README.md

File metadata and controls

158 lines (124 loc) · 8.39 KB

Watson Macro/Keybind Support

This is a Minecraft mod that allows Watson to be controlled using the Macro/Keybind Mod.

Downloads and Installation Instructions

For Minecraft 1.7.2 and later, see the releases page for this project for downloads and installation instructions.

If you're running Minecraft 1.6.4 or earlier, Watson has the Macro/Keybind Mod support built-in. You just need to download and install the appropriate version of LiteLoader and Macro/Keybind Mod and you're done.

Features

Script Actions

Watson defines a WATSON(command) script action, which performs any command supported by the Watson command line interface. To invoke a script action using the Macro/Keybind Mod, the code needs to be wrapped up in $${ }$$ delimiters. For example, the Macro/Keybind Mod code to toggle the Watson display is:

$${ WATSON(/w display); }$$

Script Variables

Watson defines the following global, read-only variables for interrogating its current state:

Variable Description
WATSON_DISPLAY True if the Watson display is currently enabled. False if not.
WATSON_OUTLINE True if the Watson outline display is currently enabled. False if not.
WATSON_VECTOR True if the Watson vector display is currently enabled. False if not.
WATSON_LABEL True if the Watson ore label display is currently enabled. False if not.
WATSON_ANNOTATION True if the Watson annotation display is currently enabled. False if not.
WATSON_PLAYER The name of the player who performed the most recently selected edit.
WATSON_ACTION The action performed on the block (either "created" or "destroyed").
WATSON_BLOCK The name of the type of block that was edited.
WATSON_ID The numeric ID of the block type.
WATSON_DATA The numeric data value of the block type, most often 0.
WATSON_X The X coordinate of the edit.
WATSON_Y The Y coordinate of the edit.
WATSON_Z The Z coordinate of the edit.
WATSON_XYZ The 3-D coordinates of the edit, of the form "X, Y, Z".
WATSON_DATE The date of the edit, of the form YYYY-MM-DD.
WATSON_TIME The time of the edit, of the form hh:mm:ss (24 hour clock).
WATSON_DATETIME The concatenation of WATSON_DATE and WATSON_TIME, separated by a single space.

Events

Watson provides two custom events to the Macro/Keybind Mod.

Event Description
onWatsonDisplay Sent whenever the Watson display is hidden or shown, either by command (/w display) or when Watson enables the display automatically (when entering ModMode). Use the value of the WATSON_DISPLAY variable to ascertain whether the display is currently visible in scripts bound to these events.
onWatsonSelection Sent whenever the currently selected position (WATSON_X, WATSON_Y, WATSON_Z) or edit (position plus WATSON_PLAYER, WATSON_ACTION, WATSON_BLOCK, WATSON_DATETIME, etc.) is changed or cleared. This may occur either as a result of inspecting a block or performing a query, or as a result of the "/w clear" command.

Custom Macro/Keybind Mod buttons.

Sample Configurations

Sample Macro/Keybind Mod configuration files are provided for the latest version here and for versions prior to 1.7 here.

To install the sample configuration, download the two files, .gui.xml and .macros.txt, and place them in your Macro/Keybind Mod configuration folder, .minecraft/mods/macros/. These will replace your current Macro/Keybind Mod configuration. If you already have custom keybinds or on-screen elements that you want to preserve, you will need to merge these files into your existing configuration with a text editor. If merging, take particular care to include the changes to the events.layout setting, since without it, the controls to edit the custom Watson events will not be displayed.

The provided configuration includes an on-screen display with custom buttons. To display it, press the Macro key, which by default is the backwards quote character (` - the key above Tab). This is what the display looks like:

Custom Macro/Keybind Mod buttons.

The function of most of these buttons should be self-explanatory. Directly underneath the Moody and Bright buttons, which switch between the two extremes of brightness setting, there are some labels that display information about the most recently selected edit. It would be possible to use the Macro/Keybind Mod to show this information all the time (as opposed to only showing it when the Macro key is pressed) but due to current limitations of the Macro/Keybind Mod, there would be no way to hide that display. The "Mod Mode" button issues the /modmode command to toggle between Moderator and normal player roles. If you are using a different server plugin for this function, it is of course easy to rebind or remove this button.

The sample configuration also binds the following key combinations:

Event Action
Ctrl-o Toggle the Watson overlay on or off.
Ctrl-n Run "/lb next" to request the next page of LogBlock query results.
Ctrl-c Query all edits by the most recently selected player in a 30 block radius. Use the LogBlock inspector tool to select the player by querying a single edit first. The Macro/Keybind script is: $${ECHO(/lb coords player %WATSON_PLAYER% area 30);}$$
Ctrl-t Query the total number of constructive and destructive edits by the most recently selected player in a 30 block radius. Use the LogBlock inspector tool to select the player by querying a single edit first. The bound Macro/Keybind script assumes a /trace-r <player> <range> command. Roughly equivalent code that runs LogBlock directly would be: $${ECHO(/lb player %WATSON_PLAYER% area 30 time 28d sum blocks);}$$
Ctrl-y Query the total number of constructive and destructive edits by the most recently selected player with no distance restriction. Use the LogBlock inspector tool to select the player by querying a single edit first. The bound Macro/Keybind script assumes a /trace <player> command. Roughly equivalent code that runs LogBlock directly would be: $${ECHO(/lb player %WATSON_PLAYER% area 10000 time 28d sum blocks);}$$
Ctrl-m Toggle ModMode (issue the /modmode command).
Ctrl-1 through Ctrl-9 Issue the commands /check p:1 through /check p:9, for use with the ModReq plugin.

Note that as of version 0.12.0, Watson itself supports configurable keybinds for some common Watson commands.

Contact Details

If this mod's not working for you or you want to suggest improvements, I'm happy to help. You can contact me directly in the following ways:

You can also raise bug reports or feature requests via GitHub, here.