User Tag List

Results 1 to 7 of 7

Thread: .ini Files

  1. #1
    No Products Registered

    Join Date
    Jul 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .ini Files

    Hello, I've been a huge fan of Clickteam's products for almost a decade now. I've worked on and off on various projects in my free time but have never really decided to finish any...until now. I don't have much experience programming, so everything I know I've learned from this program. So here is my issue:

    I'm trying to make an advanced saving system for my game using an INI object. I have it set up so users can create a game, enter their name, choose their ship (it is space-based), choose upgrades, and maybe more in the future.

    I've tried every way under the sun that I know how to have it show a list of created profiles (using a list item). Various things have worked to some extent...I've tried using an array to access save files by the order in which they were created, setting the save number in the INI file, and other things. The main problem seems to be the list object itself...I can't get it to highlight a name from the list and have it delete a profile by the name referenced in the INI file; it will only delete by line number, which, of course, changes when you delete an item from the list. Gah! So here's ultimately what I want:

    A viewable list of profiles listed by name that you can click on and view/delete. The INI files contain information such as credits, ship type, upgrades, and player name.

    If you need more info or would like my WIP I can reply with either. Thanks in advance!


  2. #2
    No Products Registered

    Join Date
    Sep 2006
    Location
    Germany
    Posts
    861
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini Files

    I have that in my game.

    Use the Combo Box object instead, it supports to access the selected name which makes it much easier then lines and numbers.

    My Game in current state has 6 ini files, all those are named by _default.??? with 6 different extensions.

    When the Player starts a game, it will copy all files named by their name. Like "myname.???" I copy all of them. At the same time I copy them to a subfolder called "temp". This is where I work with them. When I save I just write the values to the "temp" folder INIs and copy them to the Profile folder.

    However my system allows only one savegame per name but this is intentional and you could change it easily.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    koobare's Avatar
    Join Date
    Jun 2006
    Location
    Poland
    Posts
    393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini Files

    I always felt like Arrays are a lot easier to handle than INI's and it's harder to get lost with them if you have a small "what's what" piece of paper anywhere in your production notes (I usually put it in the comments in the event editor)... But that's just me.

    I'm not totally sure if this could help you, but... what about using slots instead of a list? All you'd need are a few buttons (or actives + string objects) and you'll have it ready in no time. I always was quite used to the slot system (I kinda' keep in mind the stone one from "Broken Sword 2" - it just looks kinda' cool, doesn't it?).

    Oh, and have you checked the "Saving and Loading Data" tutorial? It's here: http://www.clickteam.com/eng/learning_resources.php - perhaps it can answer your question, just take a look. There's a simple slot system there too.

    One more thing... If you'd like to use a list object, instead of slots, after all, then - when using an array - this should help:

    IF: Selection on the "List" changes
    THEN: Load a file into the array by List Select$( "List" )+".sav"

    Then all you'll have to do is keep all the profiles in different arrays, saved as "PLAYERNAME.sav", where PLAYERNAME is - for example - Kevin Smith, Steven Spielberg, etc.

    You'll also have to make sure that the only info on the list are player names. Should work, I guess. Didn't really test it now, so you'll have to check it for yourself.

  4. #4
    No Products Registered

    Join Date
    Jul 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini Files

    Thanks for the quick/helpful responses!

    So I went with the list selection using

    IF: Selection on the "List" changes
    THEN: Load a file into the array by List Select$( "List" )+".sav"
    (except it uses .ini for now)

    Everything is working seamlessly, the only problem I have now is getting it to detect the saves when you load up the application. I got this to work before by setting the save names statically so if "Save1" exists it loads that .ini file and accesses the string where the profile name is saved, then adds it to the list.

    What I want to be able to do, is have it load all the saved .ini files into the list. To do this, I've tried to get it to detect how many files exist in the save directory, which is created when you click "new game" and add the file names to the list object. I'm not sure if this is possible using the file object, I haven't succeeded yet.

    (Oh, and to clarify; I want it to be able to load all of the files in one go, instead of having to detect "If 'Save1' exists, add it to the list." "If 'Save2' exists, add it to the list" etc...)

    Maybe using an array file to set up "slots"?

    Creating another .ini file may not be the best idea in this case if I do manage to set it up so that it reads all the .ini files in the directory. I wouldn't want to see all the names + "Profile". Although I could just tell it to ignore that file. I dunno...but my brain is fried at this point, and I would rather get some advice before trying all 3.

    Thoughts? Thanks in advance again.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    koobare's Avatar
    Join Date
    Jun 2006
    Location
    Poland
    Posts
    393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini Files

    Actually, there shouldn't be any problems with this: You can save your list directly, as it has the 'Files > Save list file' action embedded, just save it as "profiles.sav" or whatever you'd like, and then load it at frame's start.

    You can of course use an array to check which profiles have been created and how many of them are there - it wouldn't show up on the list if you'd give the file a different extension than the one used by the profiles themselves (for example: use "filename.ini" for profiles, "filename.prf" for the profile list). You could also use the same extension and then set an action to delete the line "Profiles" from the list right after it loads all the inis. You could also just save it to another subdirectory, or... Well, there's plenty of options, but that shouldn't be neccessary if You'll save the list file directly via it's actions, which is the easiest way.

    Hope this helps.

  6. #6
    No Products Registered

    Join Date
    Jul 2007
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini Files

    Wow...I did not even know that. Apparently I'm still living in the "Kilk and Play" days. I bet you anything that will work, so thanks a ton!

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    koobare's Avatar
    Join Date
    Jun 2006
    Location
    Poland
    Posts
    393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: .ini Files

    Not a prob, just let me know if it works. Glad to help.

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
  •