[Plugin] Hash table

0 favourites
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • i've been playing a little with it.

    the preview export's performance gets slower and slower within a very short time..

    is that because the loop keeps going on?

    <font color=orange>dropbox.com/s/n2uy0zr91yqw5fy/tmdbapitest.capx</font> since i cannot post links

  • AlanSmithee

    In this capx, you use AJAX to get data from network. It need some times (not immediately).

  • sure, but should it get slower and slower even if you don't make new requests?

  • AlanSmithee

    Hum... I run this capx many times , but I can not feel it become slower, do I miss something?

  • So I can't have multiple json's loaded into multiple hash objects? each hash object having a different name.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ah sorry got it.. had my hash names wrong. :)

  • I'm trying to figure out something I'm using the new websocket plugin to communicate with a C# websocket server (which only communicates in JSON)

    so I'm using a Hashtable to load the JSON so I can work with it

    and example of what the server sends would be:

    {"Command":0,"Data":{"Value":somevalue,"anotherValue":anothervalue}}

    Hashtable is named MessageQue

    now if I use MessageQue.At("Data.Value") I get somevalue returned

    but if I try to do MessageQue.At("Data") I get 0 returned.

    how can I get the full "{Value":somevalue,"anotherValue":anothervalue}"

    reason I need this is because I have JSON formatted for the array load function in the Data section and I need to pull the entire string or the array load fails.

    eg {"Command":3,"Data":{"c2array":true,"size":[1,1,2],"data":[[[2,7]]]}}

    I need to pull out just the {"c2array":true,"size":[1,1,2],"data":[[[2,7]]]} part

    Thanks in advance

  • Update

    Expression:At, expression:AtKeys will return a JSON string if the item is an object.

    briermay

    Download this plugin, and try MessageQue.At("Data") again, you could get "{"Value":somevalue,"anotherValue":anothervalue}"

  • Thank you works perfectly was pulling my hair out how to get the array data out of the message.

    loads a 900x900x20 array in 14 seconds so not bad :)

  • briermay

    Call event 900x900x20 times in "1" tick is very crazy.

  • I'm not I'm simply loading a JSON array into a construct 2 array via the load function so that I can deal with the data later.

    its basically a map grid

  • How do I iterate through the following JSON using this plugin?

    [{id:"ab", name:"cd"}, {id:"fh", name:"ef"}, {id:"nm", name:"gh"}]

  • RedDragon

    I need to add expression:"length" into this plugin, to iterate array structure.

  • RedDragon

    I make another solution by my function ext plugin.

    It could iterate any kind of object by using javascript programming.

  • I have similar problem like RedDragon, my data looks like this:

    {"Question": [{"Sentence": "It is over there.","RightWord": "there"},{"Sentence": "Mr. Smith went to Washington.","RightWord": "Mr. Smith"},{"Sentence": "Hi my name is Jake.","RightWord": "hi"},{"Sentence": "We celebrate Christmas.","RightWord": "Christmas"},{"Sentence": "He wanted to climb Mt. Everest.","RightWord": "Mt. Everest"},{"Sentence": "I'm hungry.","RightWord": "I'm"}]}

    But I am not able to iterate through it as I do not know the length. Only way I can think about is to use Hash.AtKeys("Question", i, "Sentence") and loop through i and check for null.

    Do you think there is a better way ?

    -Thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)