Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tintin:gmcp_setup [2023/04/19 22:39] – created ipeix | tintin:gmcp_setup [2023/04/20 08:15] (current) – Added latency example script ipeix | ||
---|---|---|---|
Line 21: | Line 21: | ||
} | } | ||
</ | </ | ||
+ | With this alias we can send GMCP commands like this: '' | ||
+ | |||
+ | ===== Enable GMCP ===== | ||
+ | |||
+ | When the client connects to the server, there is a telnet level negotiation of capabilities. Amongst many options the server will " | ||
+ | |||
+ | < | ||
+ | #EVENT {IAC WILL GMCP} | ||
+ | { | ||
+ | #NOP Enable GMCP | ||
+ | #SEND {$telnet[iac]$telnet[do]$telnet[gmcp]}; | ||
+ | | ||
+ | #NOP Send some information about the client | ||
+ | gmcp core.hello {" | ||
+ | | ||
+ | #NOP Notify the server about supported packages | ||
+ | gmcp core.supports.set ["Room 1"," | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | From this moment forward, the server will send us GMCP messages. To see these messages, turn on telnet debugging with: | ||
+ | < | ||
+ | #CONFIG {DEBUG TELNET} {ON} | ||
+ | </ | ||
+ | Example debug output: | ||
+ | < | ||
+ | RCVD IAC SB GMCP | ||
+ | SKIP SB (3) | ||
+ | RCVD IAC SB GMCP | ||
+ | SKIP SB (529) | ||
+ | RCVD IAC SB GMCP | ||
+ | IAC SB GMCP Room.Info IAC SE | ||
+ | </ | ||
+ | The last line from the output is exactly the name of the event we are going to create to handle information the server sends | ||
+ | |||
+ | ===== Handling events ===== | ||
+ | |||
+ | Knowing the events we are interested in from debugging telnet, now we can create events and process the information as we see fit | ||
+ | < | ||
+ | #EVENT {IAC SB GMCP Room.Info IAC SE} { | ||
+ | #VAR roominfo {%1}; | ||
+ | } | ||
+ | </ | ||
+ | All GMCP events have the first argument '' | ||
+ | |||
+ | Room info example: | ||
+ | < | ||
+ | #VARIABLE {roominfo} | ||
+ | { | ||
+ | {area} {giedi prime} | ||
+ | {environment} {outdoors} | ||
+ | {exits} | ||
+ | { | ||
+ | {east} {9c5db8bd76cc853faa53631e9d1a4928} | ||
+ | {north} {66a833124afab82ce30f5b3b975bf6ef} | ||
+ | {northeast} {86830bfbf2ab8212807525ca2fbd63dc} | ||
+ | {northwest} {c6d0904a9303b3fd26a8db4d6b84956e} | ||
+ | {south} {2d87f8f423954bbc65b9bc6cbf414b81} | ||
+ | {southeast} {797d375df742b54e1cf72e02ce7cf2b9} | ||
+ | {southwest} {27c28b1106b01e1119a3b4069b0fce4d} | ||
+ | {west} {c07dbd96d862f9d2b5bbc5591bd2d539} | ||
+ | } | ||
+ | {name} {Giedi Prime Astro Port} | ||
+ | {num} {b6c8cc8712e0e855ab4702574e5b8e6d} | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== GMCP Events ===== | ||
+ | |||
+ | Some event names and what they might return | ||
+ | |||
+ | | Char.Vitals | { " | ||
+ | | Char.Name | { " | ||
+ | | Char.Stats | { " | ||
+ | | Char.MaxStats | { " | ||
+ | |||
+ | There are a lot more and as always you can enable even more by tweaking the package names in '' | ||
+ | |||
+ | ===== Examples ===== | ||
+ | === Latency checker === | ||
+ | A rough Round Trip Time measurement for network latency in milliseconds based on Core.Ping GMCP command | ||
+ | < | ||
+ | #ALIAS {latency} { | ||
+ | #FORMAT {LATENCY_TIME_SENT} {%U}; | ||
+ | gmcp Core.Ping; | ||
+ | } | ||
+ | |||
+ | #EVENT {IAC SB GMCP Core.Ping IAC SE} { | ||
+ | #FORMAT {LATENCY_TIME_EVENT} {%U}; | ||
+ | #MATH {LATENCY_TIME_TRIP} {($LATENCY_TIME_EVENT-$LATENCY_TIME_SENT)/ | ||
+ | #SHOWME {Latency: ${LATENCY_TIME_TRIP}ms} | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | | Usage | Output | | ||
+ | | '' | ||
+ | |||
+ | Happy Scripting! | ||
+ |