How to make something happen only on the first time my application is launched?

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.
  • Hello,

    So in my game, I want something to happen when a player first opens the application.
    Afterwards, though, if the player closes and starts the application back up again, the thing will no longer happen anymore.

    I have it where there is a blank frame at startup, if variable "First_Startup" is greater than 1, then it jumps to a special frame.
    If "First_Startup" is less than or equal to 1, then it jumps to a regular frame.

    I have it where "First_Startup" is set equal to 2 on a later frame, in order to make any subsequent launches go straight to the regular one.

    My issue is: how do I store this value so it is less than or equal to 1 when the application launches for the first time?

    Is it possible to do this?

    Also, is there a different way to do this whole thing that might be easier?

  • As defisym said, INI or Registry is the best way to go, depends how much you want to protect the flag... Simply:

    Check if INI Value = 0:
    - Do this
    - Do that
    - Set Value to 1

    Game Launcher Creator V3 - Please login to see this link.
    Bespoke Software Development - Please login to see this link.
    Learn Clickteam Fusion 2.5 - Please login to see this link.

    Danny // Clickteam

  • Alright! I managed to do it. Here's what I did:

    Please login to see this attachment.

    This is my list of frames.
    The "Hold" frame is where the player always starts at, and its where the code decides where the player is sent.
    The "Construction_Rare..." frames are the special, one-time use, frames.
    The "Warning" frame is the regular frame I talked about.
    And the "Menu" frame is where I checkpoint the players progress.

    What I did:

    Please login to see this attachment.

    At the start of frame "Hold", I start a timer at 0 seconds. I then bring up the save file and group I store the variable "First_Startup" in. I then set the counter object, (which is in the frame along with the ini object), to the value of "First_Startup".

    Since at this point, the variable "First_Startup", (I'll call it V), hasn't received a set value by my code, the frame disregards the condition of V being greater than 1, and sends the player to the special frames due to the timer.

    Once the player gets through those, he is taken to a "Warning" frame, and then to the "Menu" frame.

    Please login to see this attachment.

    Here, the save file and group are called again, and sets V to 2, fulfilling one of the conditions in the "Hold" frame. (I then set the counter's value to V, but I'm not sure if this is important)

    Now:

    When I start this application the first time, it runs through this process. Once the player reaches the "Menu" frame, they essentially get a checkpoint.
    If the application is restarted, (or closed and ran again), then the value given to V by the "Menu" frame will be present. Therefore, it will satisfy the counter condition, and the code will send the player straight to the "Warning" frame and then the "Menu", skipping the special frames.

    Important:

    Clickteam doesn't appear to "start fresh" every time you run the application again, so after the first time you go through this procedure, it will no longer send the player to the special frames on subsequent runs. This will also carry over when the application is built and ran; so in order to reset the values to go through the whole procedure again: Set V to 0 instead of 2 in "Menu", and then run the application through the frames. Afterwards, V will be saved as zero. Make sure to change the code back to set V to 2 when building the application to test this.

Participate now!

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