Preloaded arrays

0 favourites
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • > The idea is to make editing the data file easier since xml and json are tedious.

    >

    Easier to have your own format/parser?

    XML tedious?

    Disagree.

    One example of a xml dictionary that I'm using right now:

    <?xml version='1.0' encoding='utf-8'?>

    <dictionary version='1.0' selected_language='eng'>

    <word key='hi'>

    <translation language='spa'>Hola</translation>

    <translation language='eng'>Hello</translation>

    </word>

    <word key='bye'>

    <translation language='spa'>Adios</translation>

    <translation language='eng'>Good bye</translation>

    </word>

    </dictionary>

    What kind of file would be clearer than that?

    The XML parser in C2 is about 10 lines.

    Not trying to compete here! I know any syntax is better than mine, that's why I'm looking for alternatives.

  • Not trying to compete here! I know any syntax is better than mine, that's why I'm looking for alternatives.

    Don't see the problem in your file or syntax.

    "size": [2,23,1] is nothing. Really. Even ten times that is nothing in terms of filesize (kbs) and parsing time.

  • > Yeah, that's what I meant, only one lastdata at a time.

    >

    Don't understand your problem.

    You can have:

    - 10 different file requests.

    - 10 different "AJAX on complete" with AJAX.lastdata inside.

    I stated earlier that I want to access all this data from different containers (arrays) instantly, I'd rather not risk it by loading files on runtime, which isn't instant... XML is nice, though, thanks!

  • >

    > > Yeah, that's what I meant, only one lastdata at a time.

    > >

    >

    > Don't understand your problem.

    > You can have:

    > - 10 different file requests.

    > - 10 different "AJAX on complete" with AJAX.lastdata inside.

    >

    I stated earlier that I want to access all this data from different containers (arrays) instantly, I'd rather not risk it by loading files on runtime, which isn't instant... XML is nice, though, thanks!

    I understand, but web games always have a "load time" with a "loading layout" with loading bar. In its event sheet you can load all your config files to your arrays so "in runtime" you don't have to load external files anymore. Your arrays already have your data.

  • Major loading time (99%) will be for images and audio, not your config files. Even if you have 10 different files with 100 lines each.

  • Here's an example of doing parsing of a custom format:

    https://dl.dropboxusercontent.com/u/542 ... ormat.capx

    The advantage is you can customize it any way you'd like to make creating the data file easier. For example this one does without the xml tags or the need for all the comments and symbols of json. Also you can omit unused parameters.

    weapon
       id 0
       name sting
       perk glows when orcs are near
       damage 100
    weapon
       id 2
       name rusty sword
       damage 10[/code:1z5snhwy]
    
    To each his own though.  Personally I love creating something like this and dislike using xml or json unless I have to.  Another option could be to make your own editor to set the array data.
  • nice one R0J0hound I could definitely use something like that... easier to edit the .txt file

    I;d rather use a TAB instead of 3 spaces, is there a way in C2 to reference the ascii char of a tab? x09 or something?

  • jobel

    To use tab I usually copy paste it over from notepad. I guess you could also javascript with the browser object too.

    The event 8 condition would be changed to:

    left(curline, 1) = tab

    And the 3's in it's actions would become 1's.

  • Here's an example of doing parsing of a custom format:

    https://dl.dropboxusercontent.com/u/542 ... ormat.capx

    The advantage is you can customize it any way you'd like to make creating the data file easier. For example this one does without the xml tags or the need for all the comments and symbols of json. Also you can omit unused parameters.

    weapon
       id 0
       name sting
       perk glows when orcs are near
       damage 100
    weapon
       id 2
       name rusty sword
       damage 10[/code:6f6ung7e]
    
    To each his own though.  Personally I love creating something like this and dislike using xml or json unless I have to.  Another option could be to make your own editor to set the array data.
    

    This is THE BEST! I can't thank you enough for this Rojo...

  • Here's an example of doing parsing of a custom format:

    https://dl.dropboxusercontent.com/u/542 ... ormat.capx

    Hello,

    Does anyone know where I can find this file? The link does not seem to work.

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)