[PLUGIN] CSV, CSV2Array, CSV2Dictionary

  • rexrainbow

    Many thanks for taking your time to help me.

    The problem wasn't AJAX. It was me not understanding what kind of values CSV.CurRow and CSV.CurCol returns. Yet I know what they do.

    However, there is one thing I still understand.

    What does CSV.CurValue do?

  • ikke2902

    + For each col -> get col name by Expression:CurCol
    + For each row in col -> get row name by Expression:CurRow
    [ul]
    	[li]get value by Expression:CurValue[/code:3cx9x9da][/li]
    [/ul]
    or
    [code:3cx9x9da]+ For each row -> get row name by Expression:CurRow
    + For each col in row -> get col name by Expression:CurCol
    [ul]
    	[li]get value by Expression:CurValue[/code:3cx9x9da][/li]
    [/ul]
  • rexrainbow

    So when I use For each col in row, I can't get row name by Expression:CurRow?

    I still don't understand how/when to use the expression CurValue. Could you explain a bit more in detail?

    I have attached a picture of my problems

  • Try Construct 3

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

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

    Thanks, it is a bug of plugin, I will try to fix it.

    Edit:

    Bug had been fixed. Please redownload plugin then try again. Thank you.

  • rexrainbow

    Glad to have this bug killed. Thanks for the fast fix.

    The expressions are working like a charm

  • rexrainbow, could it be possible to load some csv data created into a project file, not from a file dis time around

  • Dasat

    Generally speaking, csv plugin is created for reading csv data, but it still has some methods to create a csv table -

    "Expression:TableToCSV" could return a csv table, and there are some actions to change a csv table like "Action:Append a column", "Action:Append a row", "Action:Remove a column", "Action:Remove a row".

  • rexrainbow does the CSV plugin have a problem resolving when it comes to picking? i.e Using the System Pick All, or Pick by Comparison, Pick random etc...

    I'm using the CSV to remember every sprite's position last time the Layout was loaded.

    FOR EACH sprite
         PICK gridSprite where  gridSprite.field1 = int(CSV.At("field1",sprite.idnum))[/code:1r7mnxcl]
    
    and this won't work at all.. I finally found a way to make it work using the System Compare two values:
    
    [code:1r7mnxcl]FOR EACH sprite
       Pick ALL gridSprite
          FOR EACH gridSprite
            System gridSprite.field1 = int(CSV.At("field1",sprite.idnum))  THEN Set Position sprite to gridSprite
    [/code:1r7mnxcl]
    does this make any sense?
  • jobel

    I am not sure, you might dump all compared data, to see it.

  • rexrainbow I did a couple days testing on this because when it wasn't working, I thought I had a flaw in my design. I wasn't able to see what the CSV had in memory in the debugger, so I wrote the contents to a Text object as I would use it. Everything seemed okay variable-wise.

    The pick statement with the int(CSV.At("field",sprite.idnum) was NEVER true even though the data was there, so I thought I was doing something wrong. But when I replaced the CSV line with the constant value "3" it worked... which blew my mind! meaning that CSV statement was never giving the argument a "3" even though the data was there. I tried to preface the CSV line with int() or str() both in the Pick reference and in Set Entry to make sure it wasn't something funky like that, but it wasn't as far as I could tell.

  • jobel

    You could try dump csv value by action:log in browser plugin.

    Or provide a simple test case to me.

  • jobel

    BTW, why not use official save feature to save the game?

  • First, thanks rexrainbow for all of your amazing plugins. I'm using a couple of them and they are a lifesaver!

    Now, I'm a total noob with this plugin and I'm trying to understand this very simple problem. Sorry if this is a very basic question.

    I'm loading a csv file using AJAX and then trying to replicate whats in one of rexrainbow exemple capx files.

    This is my code:

    Problem is that if I use AJAX.lastData instead of the line that is disabled, all I get to see in my game screen is 0 instead of the proper col, row answer.

    What am I doing wrong? Thanks in advance!

    Cheers

    ***I forgot to mention, previously I do a system on start of Layout ---- AJAX Request test.csv (tag "test")

  • FraktalZero

    Here is a sample capx about loading csv by AJAX.

  • Ha! Although I had previously used your example, I didn't realize my mistake. I had ''AJAX.LastData'' instead of AJAX.LastData.

    Thanks rexrainbow

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