User Tag List

Results 1 to 7 of 7

Thread: Help with ini files

  1. #1
    No Products Registered

    Join Date
    Nov 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with ini files

    First let me say I am new to this program, in fact I am waiting on mine to come in the mail.
    I am building an instructor lead game. I want to be able to press a button and it will pull a question from an .ini text file and display it on the screen every time the button is pressed a new question gets displayed, once it gets to the end of the questions it cycles back to the first question. I am hoping to use an .ini file so I can simply change the question bank by switching out .ini files to match the subject I am teaching. Any thoughts how I would go about doing this?

  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)

    Re: Help with ini files

    You should find INIs pretty simple to work with - the trick here is to know how to easily get the progression through questions working.

    Let's say your INI is constructed like this for each question:

    [Question1]
    QuestionText = How many fingers am I holding up?
    Answer1 = One
    Answer2 = Two
    Answer3 = Forty-six

    [Question2]
    QuestionText = "What is 2+2?"
    Answer1 = "4"
    Answer2 = "22"
    Answer3 = "A fish"

    You would then have a counter in the program that is incremented when your "change question" button is pressed. Also on each incrementation of the counter, you would read the values of the INI into strings on the screen.

    Set alterable text of String to GroupItemString$("INI Object", "Question" + Str$(value("Counter")), "QuestionText")

    The GroupItemString$ expression of the INI object retrieves the string given a group and item name. This can look rather daunting if you haven't seen it before, but the important part is the group name being constructed from a bit of fixed text and the string generated from the current value of the counter. In this way, the program would read in a different question each time.

    As for how to get it to cycle back to the first question, there are a couple of options I can think of - one is to have a "sentinel" value in the last question that the program looks for when the counter is incremented, and to set the counter back to 1 when it happens.

    [Question94]
    QuestionText = "Wubbleagloop"

    If GroupItemString$("INI Object", "Question" + Str$(value("Counter")), "QuestionText") = "Wubbleagloop": Set counter to 1

    (You'd also need to get it to re-read the question in this case.)

    The alternative is just to have another group that stores general information, and have a value that stores the number of questions in the file.

    [Info]
    Questions = 20

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module

    Join Date
    Jul 2006
    Location
    USA
    Posts
    658
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Help with ini files

    is there a size limit when using INI files? I thought I had heard that there was, so I started using either straight text files or arrays...

  4. #4
    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)

    Re: Help with ini files

    I think it's 65536 characters, or 64KB - so it's not something that you'd normally encounter, but it's not a totally insignificant limit.

  5. #5
    Clicker Multimedia Fusion 2 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    drnebula's Avatar
    Join Date
    Jul 2006
    Location
    Pennsylvania, USA
    Posts
    908
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Help with ini files

    I've been creating educational game making software for several years. I started by storing the questions in an ini file, but now have found it much easier to use array files. The ini files can be read with a simple text editing program and are much more difficult to load and save. They do have an advantage that they can be created by using a simple text editor, while the array files cannot. But there are ways around that. To see an example of a game making program, go to URL:

    http://www.darngoodsolutions.com/mms/gamemakers.htm

    Version 3 used ini files, and version 4 used arrays.

    Steve

  6. #6
    No Products Registered

    Join Date
    Nov 2006
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Help with ini files

    Thanks for the info. However, I still do not quite understand how to use the ini file or arrays. Are there any good tutorials on these for use in MMF2

  7. #7
    No Products Registered

    Join Date
    Nov 2006
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Help with ini files

    Here's a tutorial for INIs: INIs

    And, here's one for arrays: Arrays

    Note that the second tutorial link isn't specifically for arrays, but I think in the last section, it talks about arrays. And also, for the second tutorial, there are files on the page that you can download so you can follow along with what he's saying.

    Hope that helps,

    Neonotso

Similar Threads

  1. "Flash / INI object: now loads INI files stored as binary files in the application."
    By EdibleWare in forum SWF/Flash Export Module Version 2.0
    Replies: 5
    Last Post: 2nd July 2014, 10:22 AM
  2. Loading files such as INI,Text files, List Files?
    By Gibbon in forum SWF/Flash Export Module Version 2.0
    Replies: 3
    Last Post: 21st July 2012, 06:41 AM
  3. INI files versus XML files - which one's better?
    By TheSynapse in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 6th April 2012, 03:14 PM
  4. Conveting mfa. files to swf. files.
    By onewingedangel in forum Multimedia Fusion 2 - Technical Support
    Replies: 16
    Last Post: 22nd September 2008, 03:23 PM

Posting Permissions

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