User Tag List

Results 1 to 5 of 5

Thread: How to read an ini file?

  1. #1
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    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)

    Join Date
    Jul 2011
    Posts
    325
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to read an ini file?

    Hello,

    I know there are some posts about how to make ini works on iOS, XNA, Android, etc.
    I've read them but I can't get it work on Windows Phone...

    I tried with a very simple example :

    I have a file called "Fichier.ini" which contains only two lines :

    []
    test=2

    In my application, I add my Ini file in the binary data : "C:\test\Fichier.ini"

    In my scene I only have 2 objects : an Ini and a counter

    My code contains 3 lines (in this order) :

    -Run this event once : extract binary file "C:\test\Fichier.ini"
    -Run this event once : Ini --> set current file to "C:\test\Fichier.ini"
    -Always : set couter to ItemValue( "Ini", "test")

    When I run the application from MMF2 : it works as expected i.e. : the counter shows "2"
    When I build a windows application (and put it in a different folder) : idem --> the counter shows "2"

    But when I build an XNA Project, load it with Visual Studio 2010 Express for Windows Phone and try it on my windows phone device (Nokia Lumia 800), the counter shows "0". The ini file doesn't seem to be loaded...

    I tried to manually add the file "Fichier.ini" in the ressource folder in Visual Studio, and it doesn't work...

    So, my question is : what am I doing wrong??

    I don't know if it can help, but here is the folder containing the mfa application and the ini file :
    INI.zip

    And I work with BuildR257.12

    Any suggestion?

  2. #2
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,003
    Mentioned
    20 Post(s)
    Tagged
    2 Thread(s)
    No need to use ExtractBinary$ for the exporters, this is PC runtime only.

    Just call:
    -Run this event once : Ini --> set current file to "C:\test\Fichier.ini"

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Francois's Avatar
    Join Date
    Jul 2006
    Location
    Montpellier, France
    Posts
    6,920
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    I do not think INI files appreciate [] : you have to put a name in it.

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleXNA Export Module
    Dobermann's Avatar
    Join Date
    Feb 2009
    Location
    France
    Posts
    630
    Mentioned
    24 Post(s)
    Tagged
    0 Thread(s)
    First, you need a name for your group or it will not work.
    In MMF2, click on the ini object to show its properties. Just setup a name for it, no path directory. (Ex. inifile.ini) The inifile will be stored on your computer in "C:\Windows\", but on Windows phone it will be stored within the installed app folder.
    In your game, when you call the ini value, always use "Get value GROUP NAME, ITEM NAME" (for values) or "Get string GROUP NAME, ITEM NAME" (for strings) if you are not familiarised with the INI object.
    And everything will works.

    PS: I can't see this topic in the topic list of "XNA Export Module" forum. What's going wrong here? I need to follow the link showing "last post" of the "XNA Export Module" forum on the forum's home to view this thread....

  5. #5
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    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)

    Join Date
    Jul 2011
    Posts
    325
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your (very) quick replies!

    François / Dobermann : well done! I just changed the ini file to add a group name, and my code to get a group value (instead of just a value). And it works!

    Danny : thanks for the advice. Actually the ExtractBinary§ has no utility...

Similar Threads

  1. Read ini - external file
    By Matriax in forum Android Export Module Version 2.0
    Replies: 1
    Last Post: 15th October 2013, 09:35 AM
  2. Read Accented characters from INI file
    By madmac in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 13th August 2013, 08:43 AM
  3. How can I read the contents of a text file?
    By RGBreality in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 3rd October 2011, 03:51 PM
  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
  •