0

So I'm working on a Javascript gamemode for fun in an IP.Board Group. The game would be similar to a RPG Text based game. I had it in python using Json.loads & Json.dumps to read and write the values, (exp,level,HP) but I cannot find a similar way to do this in Javascript. Is there any way to have a similar kind of layout? Thanks.

I did look at the alternative ways others did it, but unfortunately that would not work for me as they read an already set variable. Mine would be constantly changing, the reason for Json.dumps and Json.loads in python reading and writing the data. For example, in Python, If you won a battle within the RPG game you would be awarded XP, json.dumps and json.loads would then load your current level from the buffer, add XP etc, then resave it with the new amount. So a solid variable or definition would not work for this. Hence why I asked about a json.dumps or json.loads version in Javascript.

I Must also note that it's not just local sided, it's set to be used by clients too so printing the values would be no good either.

LordYusei
  • 19
  • 2
  • Parsing JSON: http://stackoverflow.com/q/4935632/218196 ... Please use the search before you ask a new question. – Felix Kling Nov 02 '15 at 14:58
  • @FelixKling I have updated with why those solutions are no use to me. The values are changing with everything you do. So having a solid variable would be no good for the game mode. – LordYusei Nov 02 '15 at 15:04
  • I'm not sure what you mean. `loads` and `dumps` simply convert a value to a string containing JSON and vice versa. That's exactly what `JSON.parse` and `JSON.stringify` are doing. Where the value comes from doesn't matter. – Felix Kling Nov 02 '15 at 15:45
  • Ah alright. I was slightly confused by the posts you gave because I didn't think it was similar to what I asked, Thanks for clarifying. – LordYusei Nov 03 '15 at 18:05

0 Answers0