Difference between revisions of "Manual:Supported Protocols"
(→ATCP) |
|||
Line 96: | Line 96: | ||
=== Mudlet-specific ATCP === | === Mudlet-specific ATCP === | ||
See [[Manual:ATCP_Extensions|ATCP Extensions]] for ATCP extensions that have been added to Mudlet. | See [[Manual:ATCP_Extensions|ATCP Extensions]] for ATCP extensions that have been added to Mudlet. | ||
+ | |||
+ | ==Aardwolf’s 102 subchannel== | ||
+ | |||
+ | Similar to ATCP, Aardwolf includes a hidden channel of information that you can access in Mudlet since 1.1.1. Mudlet deals with it in the same way as with ATCP, so for full usage instructions see the ATCP section. All data is stored in the channel102 table, such that you can do: | ||
+ | |||
+ | <lua> | ||
+ | display(channel102) | ||
+ | </lua> | ||
+ | |||
+ | ... to see all the latest information that has been received. The event to create handlers on is titled channel102Message, and you can use the [[Manual:Lua_Functions#sendTelnetChannel102|sendTelnetChannel102(msg)]] function to send text via the 102 channel back to Aardwolf. | ||
==MXP== | ==MXP== |
Revision as of 03:08, 5 January 2013
Supported Protocols
Mudlet supports GMCP, ATCP, Telnet Client Protocols and the MXP Protocol.
GMCP
GMCP is a protocol for MUD servers to communicate information with MUD clients in a separate channel from the one which carries all of the text that makes up the game itself. Mudlet can be configured to use GMCP by clicking on the Settings button (or Options->Preferences in the menu, or <alt>p). The option is on the General tab. Once GMCP is enabled, you will need to reconnect to the MUD so that Mudlet can inform the server it is ready to receive GMCP information. Mudlet will automatically enable some GMCP modules for you once GMCP has been enabled. To get an idea of what information is available, you can use <lua> display(gmcp) </lua>
When working with GMCP on IRE games, their GMCP reference is a useful tool.
Using GMCP
Receiving GMCP Data
To use the GMCP messages you'll need to create a new script and give it a name. Now register an event handler for the module you want to use. Now you'll need to create a function with exactly the same name as the script file. This function will be called each time you get the GMCP message. The information itself will be saved in the corresponding field of the gmcp table.
Here's a screenshot of the setup you need:
Sending GMCP Data
Certain modules will only send data when a request is made by your client. In Mudlet, you can make such a request using the command sendGMCP("command"). Read your MUD's relevant documentation, such as the IRE document on GMCP, for information about specific modules.
- See Also: sendGMCP
Managing GMCP Modules
While some GMCP modules are enabled by Mudlet by default when you connect with a GMCP enabled MUD, others may not be 'standard' modules and are instead specific to the MUD itself. In order to provide a way to manage GMCP modules without scripts causing modules in use by other scripts to be disabled. Note: The gmod lua module has been included with Mudlet (rc2.0+).
Registering User
While this step is no longer strictly required, you can register your 'user' with gmod using <lua> gmod.registerUser("MyUser") </lua> Where MyUser is your plugin/addon/whatever name. However, your user will be automatically registered if you enable or disable any modules using it. Which leads us to...
Enabling Modules
Enabling a GMCP module is as easy as: <lua> gmod.enableModule("MyUser", "Module.Name") </lua>
If MyUser has not been registered previously, then they will be automatically registered when you call this function. An example of a module which would need to be enabled this way is the IRE.Rift module provided by IRE MUDs. <lua> -- add this to a login trigger, or anything that will get done just once per login gmod.enableModule("<character name>", "IRE.Rift") </lua>
Another example would be the Combat module in Lithmeria, which isn't enabled by default: <lua> -- add this to a login trigger, or anything that will get done just once per login gmod.enableModule("<character name>", "Combat") </lua>
Disabling Modules
Disabling a GMCP module is just as easy as enabling it: <lua> gmod.disableModule("MyUser", "Module.Name") </lua> The main difference being that the module will be turned on as soon as you enable it if it is not already enabled. If you disable it, it will not be disabled with the server until every user of that module has disabled it. This prevents script A from disabling modules that script B may still be using.
Through GMCP tutorial
A good GMCP tutorial that walks you through receiving and sending GMCP data is available here - take a read!
ATCP
Since version 1.0.6, Mudlet includes support for ATCP. This is primarily available on IRE-based MUDs, but Mudlets impelementation is generic enough such that any it should work on others.
The latest ATCP data is stored in the atcp table. Whenever new data arrives, the previous is overwritten. An event is also raised for each ATCP message that arrives. To find out the available messages available in the atcp table and the event names, you can use display(atcp).
Note that while the typical message comes in the format of Module.Submodule, ie Char.Vitals or Room.Exits, in Mudlet the dot is removed - so it becomes CharVitals and RoomExits.
- Example
<lua> room_number = tonumber(atcp.RoomNum) echo(room_number) </lua>
Triggering on ATCP events
If you’d like to trigger on ATCP messages, then you need to create scripts to attach handlers to the ATCP messages. The ATCP handler names follow the same format as the atcp table - RoomNum, RoomExits, CharVitals and so on.
While the concept of handlers for events is to be explained elsewhere in the manual, the quick rundown is this - place the event name you’d like your script to listen to into the Add User Defined Event Handler: field and press the + button to register it. Next, because scripts in Mudlet can have multiple functions, you need to tell Mudlet which function should it call for you when your handler receives a message. You do that by setting the Script name: to the function name in the script you’d like to be called.
For example, if you’d like to listen to the RoomExits event and have it call the process_exits() function - register RoomExits as the event handler, make the script name be process_exits, and use this in the script:
<lua> function process_exits(event, args)
echo("Called event: " .. event .. "\nWith args: " .. args)
end </lua>
Feel free to experiment with this to achieve the desired results. A ATCP demo package is also available on the forums for using event handlers and parsing its messages into Lua datastructures.
Mudlet-specific ATCP
See ATCP Extensions for ATCP extensions that have been added to Mudlet.
Aardwolf’s 102 subchannel
Similar to ATCP, Aardwolf includes a hidden channel of information that you can access in Mudlet since 1.1.1. Mudlet deals with it in the same way as with ATCP, so for full usage instructions see the ATCP section. All data is stored in the channel102 table, such that you can do:
<lua> display(channel102) </lua>
... to see all the latest information that has been received. The event to create handlers on is titled channel102Message, and you can use the sendTelnetChannel102(msg) function to send text via the 102 channel back to Aardwolf.
MXP
MXP is based loosely on the HTML and XML standards supported by modern web browsers. It is only "loosely" based upon these standards because MUDs require dynamic, streaming text, rather than the page-oriented view of web browsers. Also, the existing standards are needlessly verbose for use on a MUD where text efficiency is important.
In addition, there are additional security concerns to worry about with MXP. While support for HTML tags within a line is desired, players on a MUD can exploit this power and cause problems. Certain HTML functions need to be restricted so that MUD players cannot abuse them. For example, while it might be desirable to allow players to change the font or color of their chat messages, you would not want to allow them to display a large graphics image, or execute script commands on the client of other users. MXP handles this by grouping the various tags and commands into secure and open categories, and preventing the secure tags from being used by MUD players.
Note: Mudlet doesn't support the full set yet.