↓ Skip to main content

Moblist

·365 words·2 mins

I noticed there was a JSON file for mobs on the webpage. Though I can’t seem to parse it with Mudlet like I can with the eqlist. I recieve a malformed JSON error. I’m familiar with JSON. But not enough so to detect an error it seems. Could anyone lend a hand? Maybe I’m doing something wrong.

The mob JSON file can be found here: <LINK_TEXT text=“http://www.slothmud.org/wp/equipment/eq … a=0&mobs=1”>http://www.slothmud.org/wp/equipment/eqlist?dl=07&dlk=9cb66283451c196d54bc117e2c1b369c&lua=0&mobs=1</LINK_TEXT>

Here’s the error I recieve:

 Lua syntax error:InvalidJSONInput: parse error: trailing garbage
          ":"Weylyn","AREA_VNUM":"76"} {"MOB_VNUM":"130146","MOB_NAME"
                     (right here) ------^

Did a bit of research and it seems that each line is valid JSON, but it needs to be placed into an array. So to turn it into a proper array you’d separate each object with a “,” and wrapping that up in an array with “[]"’s ?

Does this sound familiar Breeze? I know you helped me sort out eqlist. Did you have to do this with that one too?

It’s 12,000+ lines of code so manually doing this is daunting.

Let me get back to you on that. That file was there for an alt eq list and me meant to be parsed with php. Will add a Lua switch like I did for the eqlist.

try that… new entry “LUA MOBS” same place as the rest.

i think i got it right.

make sure i didnt break eqlist export in lua too, if you can please.

The Lua file for eqlist still works as expected. But the LUA MOBS file is still returning the same error mentioned above.

Here’s a snippet of what I use to parse the LUA MOBS file within Mudlet if it helps with debugging…

function initMoblist()
  dofile(getMudletHomeDir().."/moblist.lua")
  moblist = yajl.to_value(MOBS)
end

initMoblist()

I do the same with eqlist which seems to work fine…

function initEqlist()
  dofile(getMudletHomeDir().."/eqlist.lua")
  eqlist = yajl.to_value(EQLIST)
end

initEqlist()

try again…

made a small change.

http://json.parser.online.fr/ and json decode in php both handle the huge string properly.

Works! Awesome. Thank you! I can do some cool stuff with this now…

viel Spass damit

Ich werde. Vielen Dank.

Now if we could just get the AREA_VNUM added to the MSDP, I can tie this in with a map :)

Email me