13 Sep, 2011, Scandum wrote in the 21st comment:
Votes: 0
David Haley said:
It's no different in the case of JSON, except that there are oodles of JSON parsers out there.

C doesn't natively support associative arrays, so a C JSON parser is pointless without the ability to store the data. You'd have to settle for a non nesting parser, which is the equivalent of about 30 lines of basic code for MSDP which most people are capable of writing, from what I gathered 5 people already have.
13 Sep, 2011, Twisol wrote in the 22nd comment:
Votes: 0
My personal favorite JSON parser is Jansson: http://www.digip.org/jansson/doc/2.2/ . I've used it and it has a very clean API, and yes, it supports associative arrays. It parses JSON data and presents them to you as data structures, so it's more like DOM than SAX, for example. And recent versions added json_unpack(), so you can make a call like json_unpack(myObject, "{s:s, s:o}", "type", &type, "data", &data) to extract values quickly.

There's also YAJL if you prefer a more SAX-like event stream: http://lloyd.github.com/yajl/ . I imagine it's more like a typical MSDP parser because you process each value as it's parsed, rather than via an in-memory data representation, but I've never actually seen an MSDP parser.
13 Sep, 2011, Runter wrote in the 23rd comment:
Votes: 0
I think whether or not C has a native associative array implementation is irrelevant. There's ways to make mappings using primitives that act as associative arrays. And that's just what these (many) C json parsers do.
13 Sep, 2011, Cratylus wrote in the 24th comment:
Votes: 0
Scandum said:
It's unfortunate most people can't write the 50 odd lines of code to deconstruct an MSDP table and reconstruct it in the local structured data format.


It's almost like they don't deserve to use it, really.
13 Sep, 2011, Lyanic wrote in the 25th comment:
Votes: 0
Cratylus said:
Scandum said:
It's unfortunate most people can't write the 50 odd lines of code to deconstruct an MSDP table and reconstruct it in the local structured data format.


It's almost like they don't deserve to use it, really.

lolCrat
13 Sep, 2011, Scandum wrote in the 26th comment:
Votes: 0
Twisol said:
There's also YAJL if you prefer a more SAX-like event stream: http://lloyd.github.com/yajl/ . I imagine it's more like a typical MSDP parser because you process each value as it's parsed, rather than via an in-memory data representation, but I've never actually seen an MSDP parser.

The two server side MSDP snippets and KaVir's MC plugin process the data as it's parsed, TinTin++ offers an in-memory data representation. In-memory is definitely the way to go for clients.
26 Jun, 2012, Splork wrote in the 27th comment:
Votes: 0
Here is a working example for cmud with msdp, it works on our test port currently, as we are still working out some issues before moving MSDP to the live port. It only handles straight variables right not, not tables but its a good start, creates a couple of gauges and what not. Hopefully somebody can figure out the parsing of the tables…

In order to use this script for cmud:
1) open up file
2) import xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<button name="hp1" type="Gauge" autosize="false" width="150" height="16" inset="true" toolstyle="true" color="#00B300" gaugelowcol="red" gaugebackcol="silver" priority="3">
<caption>%if(@OPPONENT_HEALTH = 0, No Target, @OPPONENT_NAME is @OPPONENT_HEALTH_PCT ~% Alive)</caption>
<value>#show @OPPONENT_NAME is @OPPONENT_HEALTH_PCT % alive</value>
<expr>@OPPONENT_HEALTH</expr>
<gaugemax>@OPPONENT_HEALTH_MAX</gaugemax>
<gaugelow>@OPPONENT_HEALTH_MAX/3</gaugelow>
</button>
<button name="hp" type="Gauge" autosize="false" width="150" height="16" inset="true" toolstyle="true" color="#00B300" gaugelowcol="red" gaugebackcol="silver" priority="5">
<caption>%if(@HEALTH = 0, @CHARACTER_NAME is @HEALTH_PCT ~% Alive, @CHARACTER_NAME is @HEALTH_PCT ~% Alive)</caption>
<value>#show @HEALTH_PCT % alive</value>
<expr>@HEALTH</expr>
<gaugemax>@HEALTH_MAX</gaugemax>
<gaugelow>@HEALTH_MAX/3</gaugelow>
</button>
<trigger type="Telnet" param="69" priority="20" trigontrig="false" newline="false" prompt="true">
<pattern><![CDATA[<IAC><WILL><69>]]></pattern>
<value>#SENDRAW %char(255)%char(253)%char(69)</value>
</trigger>
<trigger type="Telnet" param="69" priority="5920">
<pattern>(@MSDPVAR)([%w|_])(@MSDPVAL)(*)</pattern>
<value>#var {%trim(%2)} {%trim(%delete(%4,1,1))}
#MATH HEALTH_PCT ((@HEALTH * 100)/@HEALTH_MAX)</value>
</trigger>
<alias name="Vreport">
<value>#SENDSB 69 %CHAR(1)REPORT%CHAR(2)MSDP_SERVER_ID%CHAR(2)WORLD_TIME%CHAR(2)CHARACTER_NAME%CHAR(2)LEVEL%CHAR(2)CLASS%CHAR(2)HEALTH%CHAR(2)HEALTH_MAX%CHAR(2)MANA%CHAR(2)MANA_MAX%CHAR(2)MOVEMENT%CHAR(2)MOVEMENT_MAX%CHAR(2)AC%CHAR(2)HONOR%CHAR(2)DRACHMA%CHAR(2)ALIGNMENT%CHAR(2)EXPERIENCE%CHAR(2)MONEY%CHAR(2)STR%CHAR(2)CON%CHAR(2)DEX%CHAR(2)WIS%CHAR(2)INT%CHAR(2)STR_PERM%CHAR(2)DEX_PERM%CHAR(2)CON_PERM%CHAR(2)WIS_PERM%CHAR(2)INT_PERM%CHAR(2)HITROLL%CHAR(2)DAMROLL%CHAR(2)OPPONENT_HEALTH%CHAR(2)OPPONENT_HEALTH_MAX%CHAR(2)OPPONENT_LEVEL%CHAR(2)OPPONENT_NAME%CHAR(2)AREA_NAME%CHAR(2)ROOM_NAME%CHAR(2)ROOM_VNUM%CHAR(2)TERRAIN%CHAR(2)CONTINENT</value>
</alias>
</cmud>

Enjoy,
Splork
07 Jul, 2012, Tijer wrote in the 28th comment:
Votes: 0
Have noticed that the crawler doesnt appear to be updating autmatically from mudconnector anymore? is there any reason for this?
07 Jul, 2012, Tijer wrote in the 29th comment:
Votes: 0
damnit posted in the wrong thread sorry!!! :(
20.0/29