From time to time I get problem reports with a packet debug output in it. To test these in my local copy the data in the packet debug needs a bit of massaging before it can be submitted into Game menu -> Test Trigger.
The plugin below automates that. Just copy the packet output to the clipboard, and then type "convert_packet". This is an alias that scans the text on the clipboard. For each line that appears to be packet debug output, it puts a backslash in front of each hex sequence.
For example, if I see:
I just copy all that to the clipboard, load the plugin and type "convert_packet" and see this in the output window:
(Linebreaks were inserted to make this forum posting easier to read).
Basically you see all the hex codes from the packet debug, without all the spaces and other stuff. Now Shift+double-click to copy that entire paragraph (the hex stuff) and then you can hit Shift+Ctrl+F12 to try that packet out again.
This then shows in the output window:
The plugin below automates that. Just copy the packet output to the clipboard, and then type "convert_packet". This is an alias that scans the text on the clipboard. For each line that appears to be packet debug output, it puts a backslash in front of each hex sequence.
For example, if I see:
Incoming packet: 7 (512 bytes) at Monday, July 20, 2009, 10:40:57 AM
.[1;37mThe Guild 1b 5b 31 3b 33 37 6d 54 68 65 20 47 75 69 6c 64
of Thieves...[1 20 6f 66 20 54 68 69 65 76 65 73 0d 0a 1b 5b 31
;33mYou stand in 3b 33 33 6d 59 6f 75 20 73 74 61 6e 64 20 69 6e
side the main ha 73 69 64 65 20 74 68 65 20 6d 61 69 6e 20 68 61
ll of the Guild 6c 6c 20 6f 66 20 74 68 65 20 47 75 69 6c 64 20
of Thieves. Vel 6f 66 20 54 68 69 65 76 65 73 2e 20 20 56 65 6c
vet couches..lin 76 65 74 20 63 6f 75 63 68 65 73 0a 0d 6c 69 6e
e the walls, no 65 20 74 68 65 20 77 61 6c 6c 73 2c 20 6e 6f 20
doubt stolen fro 64 6f 75 62 74 20 73 74 6f 6c 65 6e 20 66 72 6f
m some wealthy m 6d 20 73 6f 6d 65 20 77 65 61 6c 74 68 79 20 6d
erchant. Painti 65 72 63 68 61 6e 74 2e 20 20 50 61 69 6e 74 69
ngs..and tapestr 6e 67 73 0a 0d 61 6e 64 20 74 61 70 65 73 74 72
ies hang from th 69 65 73 20 68 61 6e 67 20 66 72 6f 6d 20 74 68
e stone walls, d 65 20 73 74 6f 6e 65 20 77 61 6c 6c 73 2c 20 64
isplaying scenes 69 73 70 6c 61 79 69 6e 67 20 73 63 65 6e 65 73
of deception,.. 20 6f 66 20 64 65 63 65 70 74 69 6f 6e 2c 0a 0d
stealth and veng 73 74 65 61 6c 74 68 20 61 6e 64 20 76 65 6e 67
eance. The trai 65 61 6e 63 65 2e 20 20 54 68 65 20 74 72 61 69
ning room is to 6e 69 6e 67 20 72 6f 6f 6d 20 69 73 20 74 6f 20
the east while a 74 68 65 20 65 61 73 74 20 77 68 69 6c 65 20 61
small..the dona 20 73 6d 61 6c 6c 0a 0d 74 68 65 20 64 6f 6e 61
tion room is to 74 69 6f 6e 20 72 6f 6f 6d 20 69 73 20 74 6f 20
the north and a 74 68 65 20 6e 6f 72 74 68 20 61 6e 64 20 61 20
dark alley becko 64 61 72 6b 20 61 6c 6c 65 79 20 62 65 63 6b 6f
ns to the south. 6e 73 20 74 6f 20 74 68 65 20 73 6f 75 74 68 2e
...[1;37mExits: 0a 0d 1b 5b 31 3b 33 37 6d 45 78 69 74 73 3a 20
north east south 6e 6f 72 74 68 20 65 61 73 74 20 73 6f 75 74 68
......[0m.[0;37m 2e 0d 0a 0d 0a 1b 5b 30 6d 1b 5b 30 3b 33 37 6d
<.[1;33m10000hp 3c 1b 5b 31 3b 33 33 6d 31 30 30 30 30 68 70 20
.[1;36m25000m .[ 1b 5b 31 3b 33 36 6d 32 35 30 30 30 6d 20 1b 5b
1;32m109mv.[0;37 31 3b 33 32 6d 31 30 39 6d 76 1b 5b 30 3b 33 37
m> <#21141> .[0m 6d 3e 20 3c 23 32 31 31 34 31 3e 20 1b 5b 30 6d
I just copy all that to the clipboard, load the plugin and type "convert_packet" and see this in the output window:
------------------------------------------------------------
\1b\5b\31\3b\33\37\6d\54\68\65\20\47\75\69\6c\64\20\6f\66\20\54
\68\69\65\76\65\73\0d\0a\1b\5b\31\3b\33\33\6d\59\6f\75\20\73\74
\61\6e\64\20\69\6e\73\69\64\65\20\74\68\65\20\6d\61\69\6e\20\68
\61\6c\6c\20\6f\66\20\74\68\65\20\47\75\69\6c\64\20\6f\66\20\54
\68\69\65\76\65\73\2e\20\20\56\65\6c\76\65\74\20\63\6f\75\63\68
\65\73\0a\0d\6c\69\6e\65\20\74\68\65\20\77\61\6c\6c\73\2c\20\6e
\6f\20\64\6f\75\62\74\20\73\74\6f\6c\65\6e\20\66\72\6f\6d\20\73
\6f\6d\65\20\77\65\61\6c\74\68\79\20\6d\65\72\63\68\61\6e\74\2e
\20\20\50\61\69\6e\74\69\6e\67\73\0a\0d\61\6e\64\20\74\61\70\65
\73\74\72\69\65\73\20\68\61\6e\67\20\66\72\6f\6d\20\74\68\65\20
\73\74\6f\6e\65\20\77\61\6c\6c\73\2c\20\64\69\73\70\6c\61\79\69
\6e\67\20\73\63\65\6e\65\73\20\6f\66\20\64\65\63\65\70\74\69\6f
\6e\2c\0a\0d\73\74\65\61\6c\74\68\20\61\6e\64\20\76\65\6e\67\65
\61\6e\63\65\2e\20\20\54\68\65\20\74\72\61\69\6e\69\6e\67\20\72
\6f\6f\6d\20\69\73\20\74\6f\20\74\68\65\20\65\61\73\74\20\77\68
\69\6c\65\20\61\20\73\6d\61\6c\6c\0a\0d\74\68\65\20\64\6f\6e\61
\74\69\6f\6e\20\72\6f\6f\6d\20\69\73\20\74\6f\20\74\68\65\20\6e
\6f\72\74\68\20\61\6e\64\20\61\20\64\61\72\6b\20\61\6c\6c\65\79
\20\62\65\63\6b\6f\6e\73\20\74\6f\20\74\68\65\20\73\6f\75\74\68
\2e\0a\0d\1b\5b\31\3b\33\37\6d\45\78\69\74\73\3a\20\6e\6f\72\74
\68\20\65\61\73\74\20\73\6f\75\74\68\2e\0d\0a\0d\0a\1b\5b\30\6d
\1b\5b\30\3b\33\37\6d\3c\1b\5b\31\3b\33\33\6d\31\30\30\30\30\68
\70\20\1b\5b\31\3b\33\36\6d\32\35\30\30\30\6d\20\1b\5b\31\3b\33
\32\6d\31\30\39\6d\76\1b\5b\30\3b\33\37\6d\3e\20\3c\23\32\31\31
\34\31\3e\20\1b\5b\30\6d
------------------------------------------------------------
(Linebreaks were inserted to make this forum posting easier to read).
Basically you see all the hex codes from the packet debug, without all the spaces and other stuff. Now Shift+double-click to copy that entire paragraph (the hex stuff) and then you can hit Shift+Ctrl+F12 to try that packet out again.
This then shows in the output window:
The Guild of Thieves
You stand inside the main hall of the Guild of Thieves. Velvet couches
line the walls, no doubt stolen from some wealthy merchant. Paintings
and tapestries hang from the stone walls, displaying scenes of deception,
stealth and vengeance. The training room is to the east while a small
the donation room is to the north and a dark alley beckons to the south.
Exits: north east south.
<10000hp 25000m 109mv> <#21141>
To save and install the Convert_Packet_Debug plugin do this:
- Copy the code below (in the code box) to the Clipboard
- Open a text editor (such as Notepad) and paste the plugin code into it
- Save to disk on your PC, preferably in your plugins directory, as
Convert_Packet_Debug.xml- The "plugins" directory is usually under the "worlds" directory inside where you installed MUSHclient.
- Go to the MUSHclient File menu -> Plugins
- Click "Add"
- Choose the file
Convert_Packet_Debug.xml(which you just saved in step 3) as a plugin - Click "Close"
- Save your world file, so that the plugin loads next time you open it.
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Monday, July 20, 2009, 10:47 AM -->
<!-- MuClient version 4.43 -->
<!-- Plugin "Convert_Packet_Debug" generated by Plugin Wizard -->
<muclient>
<plugin
name="Convert_Packet_Debug"
author="Nick Gammon"
id="cae868ff0b7d205596cf6db7"
language="Lua"
purpose="Converts packet debug lines for Test Trigger"
date_written="2009-07-20 10:45:55"
requires="4.40"
version="1.0"
>
<description trim="y">
<![CDATA[
1. Copy some packet debug to the Clipboard (possibly omitting sent packets)
2. Type: convert_packet
3. Converted packet will be echoed to output.
Extra lines which don't look like packet debug will be ignored.
]]>
</description>
</plugin>
<!-- Aliases -->
<aliases>
<alias
script="convert_packet"
match="convert_packet"
enabled="y"
sequence="100"
>
</alias>
</aliases>
<!-- Script -->
<script>
<![CDATA[
require "getlines"
function convert_packet (name, line, wildcards)
-- get clipboard, remove carriage-returns
local clip = string.gsub (GetClipboard (), "\r", "")
-- starting line of hyphens
print (string.rep ("-", 60))
-- for each line see if it looks like a debug line
-- debug lines have 16 ASCII characters, 3 spaces, and then some hex stuff
for line in getlines (clip) do
local hex = string.match (line, "^................ ([%x ]+)$")
if hex then -- looks OK
for s in string.gmatch (hex, "%x%x") do
Tell ("\\" .. s) -- output without a linebreak
end -- for
end -- seems to be a packet debug line
end -- for loop
print ("") -- new line
print (string.rep ("-", 60))
end -- function convert_packet
]]>
</script>
</muclient>