Page 1 of 1

Moblist

PostPosted: Fri Jul 01, 2016 4:22 am
by Akaya
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: http://www.slothmud.org/wp/equipment/eqlist?dl=07&dlk=9cb66283451c196d54bc117e2c1b369c&lua=0&mobs=1

Here's the error I recieve:
Code: Select all
 Lua syntax error:InvalidJSONInput: parse error: trailing garbage
          ":"Weylyn","AREA_VNUM":"76"} {"MOB_VNUM":"130146","MOB_NAME"
                     (right here) ------^

Re: Moblist

PostPosted: Fri Jul 01, 2016 4:33 am
by Akaya
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.

Re: Moblist

PostPosted: Sat Jul 02, 2016 6:24 pm
by *Breeze*
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.

Re: Moblist

PostPosted: Sat Jul 09, 2016 7:33 pm
by *Breeze*
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.

Re: Moblist

PostPosted: Wed Jul 13, 2016 11:04 pm
by Akaya
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...
Code: Select all
function initMoblist()
  dofile(getMudletHomeDir().."/moblist.lua")
  moblist = yajl.to_value(MOBS)
end

initMoblist()


I do the same with eqlist which seems to work fine...
Code: Select all
function initEqlist()
  dofile(getMudletHomeDir().."/eqlist.lua")
  eqlist = yajl.to_value(EQLIST)
end

initEqlist()

Re: Moblist

PostPosted: Thu Jul 14, 2016 12:14 am
by *Breeze*
try again...

made a small change.

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

Re: Moblist

PostPosted: Thu Jul 14, 2016 2:04 am
by Akaya
Works! Awesome. Thank you! I can do some cool stuff with this now...

Re: Moblist

PostPosted: Thu Jul 14, 2016 2:10 am
by *Breeze*
viel Spass damit

Re: Moblist

PostPosted: Thu Jul 14, 2016 2:13 am
by Akaya
Ich werde. Vielen Dank.

Re: Moblist

PostPosted: Thu Jul 14, 2016 2:18 am
by Akaya
Now if we could just get the AREA_VNUM added to the MSDP, I can tie this in with a map :)

Re: Moblist

PostPosted: Thu Jul 14, 2016 2:32 am
by *Breeze*
Email me