User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16

Thread: How do you load a CSV file in mmf and read from it?

  1. #1
    Clicker Fusion 2.5Fusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    blurymind's Avatar
    Join Date
    Feb 2014
    Location
    Huddersfield, United Kingdom
    Posts
    493
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    How do you load a CSV file in mmf and read from it?

    Sorry, i just couldnt find a good tutorial on this. CSV file with comma separated values - created in google docs spreadsheet.
    Do you use the string parser?
    How?

    In construct2 all you have to do is load the csv file and then point to the name of the row and the name of the column- that is enough to get it to spill the string that is contained in that cell!
    "Expression:At(Col, Row)"
    Col and Row are string values you entered in your google docs spreadsheet
    173106798.png
    http://c2rexplugins.weebly.com/rex_csv.html

    Now how the hell do we get this functionality in mmf?
    It would be a better solution than the ini file in many cases for me.
    I suppose that is way more complicated. Do we write the csv table to an array? I suppose that would be more memory efficient?

  2. #2
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The Named Variable Object can parse CSV files - I haven't seen it being used a whole lot by the community, but I've found it very useful.

    Edited: Now that I think about it, it parses CSV files in a very specific way - variable name, associated value and associated string, which probably isn't what you want. Reading into an array object would be the nearest thing that I could think of, but I'd like to see an easier method as well.

  3. #3
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleInstall Creator Pro

    Join Date
    Dec 2010
    Location
    United Kingdom
    Posts
    960
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As Snail pointed out, the DataGrid Object can process CSV files (via File → Load ascii = odd naming) but this extension only works for Developer.

    And the List View extension also can load and read a CSV, and can read cells at specific co-ordinates... which is what you are probably looking for. But again, it's a Developer only extension. Sorry about that (I see you have Standard)

    Not all hope can be lost, you could manually do this by reading and converting a CSV using the List object and String Tokenizer (String Parser might work too)

    You'll first need to load the CSV into the List object (as it's just plain text), and line by line use the delimiter "," to save each element on the line to the Array object (or other storage object). Repeat this for each line. That's the basic outline of how you could do it. If you need help, I can make an example.

  4. #4
    Clicker Fusion 2.5Fusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    blurymind's Avatar
    Join Date
    Feb 2014
    Location
    Huddersfield, United Kingdom
    Posts
    493
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Ah I see. Is there any straightforward way of doing it in the personal license edition of mmf?
    The named variable object (and all the other PRO solutions) unfortunatelly work only for windows games. I want to come up with a multiplatform solution.

    I cant currently afford the developer edition. Cant even afford any of the mobile exporters.
    It's unfortunate they only work for developer.

    I want to use CSV files. As far as I know google docs spreadsheets cant export xml.

    I am not sure how to do it manually. I couldnt find any good examples of the string tokenizer/parser, nor any simple CSV reading example mmf files that work.
    It is so damn easy to do in construct2 (cheaper personal license+no limitations) - works in html5 too. Seems that right now there is no good solution for csv files in multimedia fusion personal license.

  5. #5
    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator ProUnicode Add-on

    Join Date
    Jun 2011
    Posts
    628
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Just load it to editbox and parse it by string parser object.

  6. #6
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleInstall Creator Pro

    Join Date
    Dec 2010
    Location
    United Kingdom
    Posts
    960
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Here's my example.

    Here you go. I wrote you an example for you based on what I said in post #4.

    It uses the List Object, String Tokenizer and Array object (which are all cross-platform). But since this is tailored towards Windows, I used the Common Dialog object to show a file selector.

    The comments on the frame and event editor should be self-explanatory, and will accomplish your needs to import a CSV to use in Fusion.
    Attached files Attached files

  7. #7
    Clicker Fusion 2.5Fusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    blurymind's Avatar
    Join Date
    Feb 2014
    Location
    Huddersfield, United Kingdom
    Posts
    493
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    I can't open your file:
    dgy3KOl.png
    is this due to you using the developer's edition by any chance?

    I am using the string tokenizer from the extension manager. There is no unicode version listed there.

  8. #8
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleInstall Creator Pro

    Join Date
    Dec 2010
    Location
    United Kingdom
    Posts
    960
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Non-Unicode Example

    Hmm. At first I thought "There was a Unicode version?!" - The whole Unicode option is oblivious to me. I am guessing the Standard version doesn't support Unicode.

    Don't worry, there's a character encoding option in the application options, so I saved it as ANSI, so it should open for you (hopefully!)

    Here you go:
    Attached files Attached files

  9. #9
    Clicker Fusion 2.5Fusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    blurymind's Avatar
    Join Date
    Feb 2014
    Location
    Huddersfield, United Kingdom
    Posts
    493
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    This is loading them into an array , which is awesome, but it cannot return a string from a cell via its corresponding row name and column name. That is the main advantage of CSV files.

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    I had similar issues weeks ago, trying to use CSV files as quick databases,
    and came up to a similar solution as the one kindly generated from lh37,
    making a small utility for loading that data into an array.

    That works really well,
    but if you need to reference to the objects by their column name (first row of array)
    and row name (first cell of each row)
    and you can't use windows-only solutions (SQL is great for that)
    i think you could think of a sort of sub-application to build over the work done by lh37
    that joins each row number/col number to the related first string in the array
    it could be a INI or wathever else can store and let you reference to its object
    that can be used like some sort of "legend", to initialize when loading any of your CSVs

    So you when you need to load data, you first call the column string name in the "legend", get its related number, and then reference to it in the array.

    Just a bit of overprogramming in the beginning, but i think it should work, and then you would be done forever

Page 1 of 2 1 2 LastLast

Similar Threads

  1. read patterns from ini file
    By biokuta7 in forum Fusion 2.5
    Replies: 1
    Last Post: 20th October 2014, 12:53 AM
  2. How to read an ini file?
    By BenjaminG in forum XNA Export Module Version 2.0
    Replies: 4
    Last Post: 18th September 2013, 06:10 PM
  3. A way to load the whole INI at once and read from memory?
    By BrashMonkey in forum iOS Export Module Version 2.0
    Replies: 13
    Last Post: 3rd March 2013, 12:20 AM
  4. Read a file off the internet
    By clankfan1 in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 3rd January 2011, 06:30 PM
  5. How do I read from a file?
    By LittleMysterio in forum The Games Factory 2 - Technical Support
    Replies: 1
    Last Post: 15th September 2008, 07:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •