msdp.AFFECTS not getting populated

Post Reply
Buck
Posts: 19
Joined: Tue Aug 30, 2016 8:11 pm

msdp.AFFECTS not getting populated

Post by Buck »

I'm having some issues getting msdp AFFECTS through.

msdp gets populated with HEALTH, HEALTH_MAX and all the other variables I asked it to report, but msdp.AFFECTS remains nil.

I can tell from the console where I launched mudlet that it's getting the AFFECTS information:
<MSDP>< AFFECTS001,1,invisibility,-1001,1,detect invisibility,-1001,1,see invis,2587 >
<MSDP>< AFFECTS001,1,invisibility,-1001,1,detect invisibility,-1001,1,see invis,2586 >
<MSDP>< AFFECTS001,1,invisibility,-1001,1,detect invisibility,-1001,1,see invis,2585 >
<MSDP>< AFFECTS001,1,invisibility,-1001,1,detect invisibility,-1001,1,see invis,2584 >
but msdp.AFFECTS never gets populated, it remains nil. The appropriate event handler is called every time i see an update on the console, but there's no data to be read. All the other reported variables are working fine. I tried only requesting AFFECTS information and nothing else, but that didn't work either.

Is this possibly a known issue?

Buck
Posts: 19
Joined: Tue Aug 30, 2016 8:11 pm

Re: msdp.AFFECTS not getting populated

Post by Buck »

I believe I found the cause of the problem:
<Lua error:InvalidJSONInput: lexical error: invalid character inside string.
"001,1,invisibility,-1001,1,detect invisibility,-1"
(right here) ------^
at ../src/lua_yajl.c line 343>

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: msdp.AFFECTS not getting populated

Post by SlySven »

What IS the invalid character (is it actually shown) in that error message "InvalidJSONInput: lexical error: invalid character inside string." I do not know enough about that area of things to be much help in this... :(

Buck
Posts: 19
Joined: Tue Aug 30, 2016 8:11 pm

Re: msdp.AFFECTS not getting populated

Post by Buck »

The ascii char code is 7, which is the BELL ascii character.

I've overwritten the json_to_value function in order to fix it:
function json_to_value(data)
return string.sub(data,2,-2)
end
Which was sufficient to get everything running properly in the 4D MUD. I'm not sure what the json_to_value function does, so it may not work on other MUDs.

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: msdp.AFFECTS not getting populated

Post by SlySven »

I do not know enough to say but is it valid to have ASCII Control Codes (other than say line-feed, carriage-return or tab) in that data?

Buck
Posts: 19
Joined: Tue Aug 30, 2016 8:11 pm

Re: msdp.AFFECTS not getting populated

Post by Buck »

No, it's not a valid JSON value. I presume only this MUD uses it, though I haven't checked out other (Circle) muds.

User avatar
SlySven
Posts: 1019
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: msdp.AFFECTS not getting populated

Post by SlySven »

It might be worth contacting the SysOp as perhaps they were editing a source/system file and accidentally included that character which - as it is has no visible representation - they did not spot before they saved the file.

As it happens you will have to be a bit roundabout if you need to check for it yourself (assuming it makes it as far as a user/scripter's package) as - of course - you cannot include that raw ASCII control code in Mudlet scripts (all the stuff that makes up a profile is stored as an Xml file and the Xml 1.0 specification prohibits all of the ASCII control characters except Tab, Line-Feed and Carriage-Return IIRC)...

Buck
Posts: 19
Joined: Tue Aug 30, 2016 8:11 pm

Re: msdp.AFFECTS not getting populated

Post by Buck »

SlySven wrote: as - of course - you cannot include that raw ASCII control code in Mudlet scripts
You wouldn't have to store it as a raw ASCII control code - you would just generate it as you would in any other scripting language:

Code: Select all

local affects = string.split( msdp.AFFECTS, string.char(7))

Post Reply