Events based on checking if .ini file is present?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Is there a way to check for the presence of an ini file to trigger events? I've got my games options set up to save to an ini and load upon changes/starting the game. What im trying to do is, set the sound effects and volume levels to 50% each upon initial play, then after the player adjusts the levels it saves them to the ini. The problem is, at least for what im trying to do, is that i have the title screen that deals with saving these changes set with a start of frame event that automatically sets them both to their saved ini values. Hopefully that makes sense lol. Realistically, i could just set them both to be at 50% each and just have the players adjust them each time, but i'd like that all to be nice and neat with the ini.

    Developer/Composer :

    Vamprotector

    Castlevania Chronicles 2 - Simon's Quest

    Castlevania Chronicles 3 - Dracula's Curse

  • One way you could do it would be to use the File object to check if the ini file exists in whichever directory you specify.

    Please login to see this attachment.

    In the above example, the File object checks to see if the file "example.ini" exists in the 'C:\Users\<USERNAME>\AppData\Roaming\FusionExample' directory.

    If the file exists, have it load the volume data from the ini file. If it doesn't exist, then have it go with default volume levels.

  • Another way to do it is check a value in the ini file on startup. If the ini object can't find a value, it will give you a "0" as the value with a couple of events, so something like

    Start of frame
    - If value "HasRun" in 'somefile.ini = 1'
    -- then load the volume data from the ini file

    Start of frame
    - If value "HasRun" in 'somefile.ini = 0'
    -- then set the value of "HasRun" to 1
    -- use the default audio volume

  • Yes, absolutely. The INI is pretty deep at what all it can do. The File object is what you're looking for to verify existence of a file.

    A little more on what the INI can do... I built a dialog text blitting system that performs certain actions based on special characters before the dialog is blitted. I used the Left and Len functions in the expression editor to extract these from the ini and perform a function based on what's there. For example, a number in the INI before the dialog is to automatically designate the name of the character speaking. An asterisk before a number in my INI is a delay in milliseconds. Not sure how far you can go with this in Fusion, but there's definitely potential for this.

    Please login to see this link.

  • Well, im not sure if im entering the line wrong for the file object, but this is how i have it;
    Please login to see this attachment.

    No matter what I do, if i have the event 4 in the game it always defaults to those amounts. If i just have the top line it, it loads the settings from the ini file without any problems. Am I missing something?

    Developer/Composer :

    Vamprotector

    Castlevania Chronicles 2 - Simon's Quest

    Castlevania Chronicles 3 - Dracula's Curse

  • Another way to do it is check a value in the ini file on startup. If the ini object can't find a value, it will give you a "0" as the value with a couple of events, so something like

    Start of frame
    - If value "HasRun" in 'somefile.ini = 1'
    -- then load the volume data from the ini file

    Start of frame
    - If value "HasRun" in 'somefile.ini = 0'
    -- then set the value of "HasRun" to 1
    -- use the default audio volume

    Thanks marbenx , that method worked out perfectly!!
    for anyone that has troubles with the same thing, reference this ^^^^, just make sure you add "Compare between two general values" line after the Start of Frame event. Thanks again!

    Developer/Composer :

    Vamprotector

    Castlevania Chronicles 2 - Simon's Quest

    Castlevania Chronicles 3 - Dracula's Curse

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!