Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Xinbei

Pages: 1
Thanks Merrak, if you have the spare time  I would greatly appreciate the extension and I'll help you in any way I can. In the meantime, I'm going to look into the reflect class and your XML iterator to see if there's any option there.

Thanks for the responses,

Seems like there's no easy way to convert JSON to a map attribute. Look like my options at this point are:

1. Convert the JSON to a CSV and use the text split function to convert CSV into a map somehow (not ideal since I'll have to create a different split event for each type of JSON)

2. Convert the JSON to XML and use the XML API in haxe to iterate over every single node and somehow setup  a map during the iterations

3. Hire a coder who knows how to use haxe to write me a JSON to Map attribute converter (any suggestion to where I can find  and hire a coder for this?)

None of these options are ideal and hopefully in the future Stencyl will have a direct converter for JSON to map attribute like in Game Maker Studio 2. I think JSON is incredibly useful and convenient and if I could convert one into a global map attribute it would allow me to easily create a complex yet accessible database for my games.

If anyone has any other work around method, please let me know I would greatly appreciate any suggestions that would allow me to convert JSON or even XML into a map attribute


I want to convert JSON strings/files into map attributes in my game. I have only used drag and drop thus far but I have figured out how to use the code block to parse a JSON string. I set the parsed JSON result as an anything attribute. My problem is that I can't convert the anything attribute into a map nor can I use map blocks on it despite it looking exactly like a map when I print it.

 How can I either directly convert the JSON into a map with nested arrays/maps or convert the Anonymous Structure from the parse function into a map?

An example of a JSON I want to convert into a map is:

Code: [Select]
  "apple": {
    "value": 10,
    "health": 15,
    "tags": [
  "lemon": {
    "value": 5,
    "health": 10,
    "tags": [
  "ham": {
    "value": 50,
    "health": 50,
    "tags": [

Attached is the block I've been trying and the results of printing the anything attribute.


Edit : Solution:
It appears that I made two errors in example  2.
Error 1: I forgot to calibrate the list
Error 2: "For each actor in region" doesn't work with simple actors but when I switch to normal actors it works as intended.

     I want to add all actors (as text) in a specific regions into a list by using the "For Each Actor in Region" block but whenever I try, the game crashes.

     In the first attached image I simply increment a counter by the number of actors inside the region and everything works as intended. Unfortunately, in the second attachment when I try to add the "actor inside region" as text into a list, the game will crash.

     I have searched the forum for similar issues and have found two threads with similar issues but neither are resolved. I have also found a post regarding "For Each Actor on Screen" in the issue tracker and I'm wondering if its possible that my situation might be related to it.

Thanks in advance for your help!

Ask a Question / Re: [Solved] How do you add Map/List to a Map Attribute?
« on: September 09, 2016, 02:13:42 pm »
Thanks Justin, my maps are now functioning as intended!

Ask a Question / [Solved] How do you add Map/List to a Map Attribute?
« on: September 09, 2016, 01:46:57 pm »

     I would like to know if it is possible to add a map attribute or a list attribute (maybe even a 2D list attribute) to a map attribute as a value to a key. I am under the impression that it should be possible since the Map Attribute page of the Stencylpedia contains images of what seems like maps inside other maps. However; from my own testing I found that when I attempt to add a list/map to a map using the "set key to value" block, the game will crash.

Am I missing something obvious or is there a specific procedure for how this can be done?

Thank you in advance for any input this would be very helpful for my game!

Resolved Questions / Re: How to Import Text Files Into Map Attributes?
« on: September 01, 2016, 10:40:43 pm »

Resolved Questions / [Solved] How to Import Text Files Into Map Attributes?
« on: September 01, 2016, 08:52:48 pm »

How do you import text files into a map attribute without using any extensions?

I have tried adding text files into a map attribute by using the "Import from text file..." button but I can't  get it to work. I have tried formatting the txt. file in various formats such as: "key:value" or "key value" on each line but no matter how I organize the text file I can't submit the txt. file into the map attribute.

Thanks in advance for your input!

Pages: 1