[PLUGIN] CSV, CSV2Array, CSV2Dictionary

  • Hmmm, here's a demo of what I'm doing - right now it's stored in an array - it's just a question of how to save it out and load it in as elegant a fashion as possible without too many complications. <img src="smileys/smiley1.gif" border="0" align="middle">

    http://www.johnnysix.net/games/BangEdit/

    In my haste I created a completely new project for the editor, and I don't think it'd be that easy to copy/paste it all across, or if it's possible at all.

    I guess saving to an external file, then opening of a url from the editor and sending a variable via the url to tell the page/game loaded to grap the corresponding .csv/.xml is what I'll be doing.

    <img src="http://www.johnnysix.net/games/Bang/Preview07.png" border="0">

  • JohnnySix

    Official array plugin now could save data to string/file ( array <-> JSON string ). So you might still use array object.

  • I'll give it a go, thanks! I was hoping to use CSV as it'd mean data as easily editable outside the program, but not a massive issue.

    Keep up the awesome work. :)

  • rexrainbow

    I'm having trouble with this plugin. I have made a very simple capx and it work perfectly. Then i put the same code in a already made game and it doesn't work.

    When i say it doesn't work, i mean that 4 instances of the sprite are created at cordinates in the table when it works and all of them at 0,0 when it doesn't.

    <img src="http://www.ishopcart.com/e1.jpg" border="0" />

  • rfisher

    try this.

    dl.dropbox.com/u/5779181/csv_create_sprite.capx

    In your capx, the problem might be that:

    variable "l" is started at 0. However, the csv table seems not have "0" entry.

    Edit:

    It might be useful if there has "condition: for each row", I will think about that.

  • Update:

    Add "condition:For each row".

    Now there have two kinds of "for each":

    • For each col
    • For each row

    You could use one of them to retrieve csv table.

  • Hello rexrainbow

    Is it possible to load the data in directly from a .csv file in the same directory ?

    Thanks in advance

  • egos

    Try ajax plugin for loading external files.

  • For a project i'm working on i was wondering if i could load a column, but not specify what the content of the row is. Eg.

          Column 1, Column 2,

    Sprite       1,        3,

    Then use

                                     Column1

                               Sprite      1

    System > Compare two Values / if csvData = 1 Then Create Sprite1

  • Update:

    Add expression: ColName, RowName to get col name by number.

    You might use these new expressions to get a col name, or using "condition:For each col" to get each row name in order.

  • I'm trying to use this with the new internal files, so I request the file test.csv with AJAX, which return this (AJAX.LastData):

    ;dmg;range

    item;1;2

    How do I import this to the CSV plugin? I tried load from json string AJAX.LastData but it doesn't work

  • 7Soul

    ;dmg;range
    item;1;2

    Sorry, CSV plugin uses "," to split items, I will try to add action to change this setting.

    Or you could replace ";" to ",". It should work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Update:

    Add "Delimiter" setting at properties table, and add "action:set delimiter". This could change delimiter from "," to other character.

    7Soul

    Try to set Delimiter = ";" at properties table by latest CSV plugin, it could parse

    ;dmg;range
    item;1;2

    now.

  • Thx, that worked ^^

    Also, I was using "Load from JSON string" because I didn't see the "Load table" action

  • Update:

    Fix bugs in "condition: for each row in col", "for each col in row"

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