grossd's Forum Posts

  • Hi,

    A useful feature for my purposes would be to set the path to one "level' back.

    So, if the path is set as follows:

    JSON: Set Current Path to root@"my","path","to","an","array"

    setCurrentPath_one_back

    would set it as so:

    "my","path","to","an"

    this is very useful for when you loop though complex structures and need to "automatically" back up one step, before going down several path steps again.

    Dan

  • Hi (@Ashley),

    I have quite a bit of trouble with moving data via JSON export from Dictionaries and Arrays to other programs. I need to reparse all my structure to generate "genuine" JSON, and am still working on this code and its brittle. Its all lots of recursive structures, five levels down with an element of dynamism (some are four or three levels down, and some are five).

    It would be really great, if there was a JSON export geared for interoperability without C2s Dictionary and Array wrappers. This could then be imported straight into other programs -- such as Mathematica (where i want to do all the data visualization).

    thanks,

    Dan

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks ggibson1

    Reloading into C2 works very well for me too. Just when I try to load the JSON into mathematica with Import, the nested JSON isn't recognized as an association, but as a string.

    Testing with a number of other JSON parsers, I get similar results.

    Perhaps some JSON parsers are more robust to unusual input than others ...

    p.s. BTW, i just ran my nested JSON through Lint and it only recognizses the top level keys.

  • Hi,

    I explorted into a text file a recursive JSON string I got from a dictionary which includes JSON strings as value. However, JSON parsers have trouble parsing the JSON, including the Mathematica JSON import parser -- sometimes only the first key is recognized, and Mathematica seems to view the whole JSON file as one big string.

    any thoughts on that would be appreciated,

    Dan

  • Perhaps you are right,

    In my case I have a following structure (All are dictionaries, and "varying game section" stats an Array, say, someone drops something X times during a game section, and i capture when (in seconds since game section start) each drop happened):

    User-Groups->Users->UserGamePlayedDate-Time>TotalGameStats->GameSectionsStats->VaryingGameSectionStats

    I need to analyze this data from various perspectives, such as improvements over time of individual users; average comparisons between user goups, etc. and graph it using charts (I am using the canvas chart plugin).

    Programming everything individually with loops can be pretty tedious. I am hoping that a map reduce implementation will make the code shorter and simpler.

    Dan

  • Rex,

    It now occurred to me that it should be pretty easy to rewrite the short MapReduce algorithm with C2. C2 has the ability to pass functions to function, as strings, and have the called. So, beside the neat packaging as a plugin, there seems no need to actually write a plugin for that. A separate event sheet should suffice.

    Dan

  • Thanks Rex,

    what I am thinking about is to create support a simple MapReduce function: https://code.google.com/p/mapreduce-js/

    With the C2 functions passed as parameters.

    I wonder if this can be done. Perhaps its already doable with your javascript function plugin

    Dan

  • I just noticed that Function is actually a plugin.

    So, it should be possible to retrieve all relevant function plugin instance data from another plugin, and thereby refer and also call functions ....

  • Hi,

    Is it possible to program a plugin so that it gets the name of a C2 function passed, and then calls that function, including passing of parameters to the function and retrieving return values?

    If so, is there documentation or examples how to do this?

    thanks,

    Dan

  • All

    I think that the C2 programming "language" and environment is fantastic.

    It's even driven paradigm, and its include sheets, allows programming constructions that are hard to accomplish in "traditional" languages, including Java and the like. It would be great if C3 could build on its strength and selectively (and carefully) add some "software engineering" constructs, to make larger code more maintainable.

    This could include native support for state machines, making functions a first class entity, rather than string only, support and perhaps even named approaches to define, reuse, adapt (inherit?) event expressions.

    I dream of a general purpose web programming environment build on a C3 type of paradigm. Its no-nonsense, and much easier to use than, say, Javascript, with its numerous programming idioms.

    I think a good example to think about is Wolfram's Mathematica, It's a functional language with which you can process list and recursive structures in a very elegant way.

    Instead of say ("procedural code):

    for each (ArrayA): ArrayA.currentValue>5, ArrayB.push(Array.currentValue)

    you write (in functional pseudo code):

    Push(ArrayB ,Select(x >5, ArrayA), ArrayB))

    Or, sometimes, like this (using a pipe function "=>"):

    Select(x >5, ArrayA) => Push(ArrayB)

    Javascript, btw, does support functional programming to some good extent.

    Thanks, the json plugin sounds very promising, to help with a path oriented approach to navigating to relevant data in hierarchical json structures.

    Dan

  • Thanks. Looks interesting, but its just a first step towards what i am looking for.

    What i need, essentially, is a the application of a select function, to generate selected entries (recursively, if needed), and then an apply function that applies to all results another function. The functions could be C2 functions with parameters, and perhaps a special parameter called "this" if needed.

  • ok.thanks. its a feature

  • Thanks for the tip. I had learned about it some time ago in the forum.

    This tip works for all objects that have instances. But objects such as Dictionary or Array, it doesn't work. Also, it would be nice to have for global variables.

  • Hi,

    In my game I have a dictionary that holds the json of another dictionary that holds the json of another dictionary that holds ... you get it ... about 5 levels down ...

    When i export the json of the "root" dictionary and save the generated text in a file I get a backslash "\" (probably escape chars) for each json in json, so i end up with a file that has lots of these \\\\\" \\\\\".

    Is this a bug of a feature? I.e. is this necessary for json export import to work or is this a bug.

  • Hi,

    Often I need to look for a object type use across many event sheets. For example, where was GameDataDictionary used? This is in particularly needed before I want to delete it, to ensure that i have't missed a use of it somewhere.

    It would be great if there was a search that at least lists all the event sheets the object type appears.

    Currently, I am exporting the game as project files and do a grep outside of C2. having this integrated would be much more efficient.