advice on creating plugin with MSDP from scratch?

Posted by George on Thu 25 Aug 2011 02:54 PM — 2 posts, 15,672 views.

#0
hi, I'm wondering what pointers and tips people have for people writing plugins using MSDP.

Currently I've based things off of KaVir's GW2 plugin, so the stripped down plugin looks like this:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, July 14, 2011, 10:33 PM -->
<!-- MuClient version 4.64 -->

<!-- Plugin "conquest" generated by Plugin Wizard -->

<muclient>
<plugin
   name="conquest"
   author="george"
   id="94bb7c5857d64917248618c6"
   language="lua"
   save_state="y"
   date_written="2011-07-14 22:32:18"
   requires="4.64"
   version="1.0"
   >

</plugin>


<!--  Get our standard constants -->

<include name="constants.lua"/>

<script>
<![CDATA[
--latest
local using_msdp = false
local msdp = {}
]]>

-- MSDP negotiation
local MSDP = 69

function OnPluginTelnetRequest (type, data)
  if type == MSDP and data == "WILL" then
    using_msdp = true
    return true
  else -- another protocol
    return false
  end -- if
end -- function OnPluginTelnetRequest

function OnPluginTelnetSubnegotiation (type, data)
  if type == MSDP then
    endpos=string.len(data)
    for i=endpos,1,-1 do
      if string.byte(data,i) == 1 then
        variable = string.sub(data,i+1,endpos)
        StoreVariable(variable, value)
        endpos = i-1
      elseif string.byte(data,i) == 2 then
        value = string.sub(data,i+1,endpos)
        endpos = i-1
      end -- if
    end -- for   
  end -- if
end -- function OnPluginTelnetSubnegotiation

</script>

</muclient>


The first thing I'd like to figure out is how people generally debug the MSDP packets sent by the mud; I watch the packet stream by selecting debug packets, but is there some other intermediate stream you can inspect or a way to create one so you can see the English translation of the MSDP negotiation and variables sent by the mud (hope that makes sense).
USA #1
George said:

The first thing I'd like to figure out is how people generally debug the MSDP packets sent by the mud; I watch the packet stream by selecting debug packets, but is there some other intermediate stream you can inspect or a way to create one so you can see the English translation of the MSDP negotiation and variables sent by the mud (hope that makes sense).


Assuming i understand you right, I think this might help you.

http://clanscw.brinkster.net/godwars/topic.asp?TOPIC_ID=2522

KaVir has a simple plugin that notes the MSDP info.

Quote:

Note that all this does is display the data that's being sent back and forth - there are no energy bars etc. However it's really easy to add this to existing plugins to replace the trigger they usually use to capture text from the screen.


I recently started looking at MSDP, and what KaVir's plugin can do... But it all is Way beyond me at this point :P

I hope this helps.