Setting a Flag to an array value

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 it possible to Set a Flag to a value in an array (0 or 1)? I basically am storing the Flag values of objects (when the game saves) so they can be loaded back into the objects at a later time (when the game loads). From what I can tell, there is no way to set a flag to an expression value. Also, this needs to be for all runtimes, so no crazy extensions.

    Please login to see this link.

  • You can use an alterable value instead of a flag. But since you may already be using different alterable values in different objects, you can use an alterable string that can either be "0" or "2". In this case, you should use a text array instead of a numeric array.

    But if that isn't possible, all you can do is do a for each loop for each flag# you need to save and have a condition that tests to see if the flag is on > store '1' to the array position. If you have a ton of flags, you're going to need to have multiple fastloops/foreach loops depending the # of flags for the objects. I think its totally ok to have a bunch of inefficient loops for saving since you only do it once right? Hope this helps!

    Everytime I ask for help in the forums, I must help another member in the forums.<3

    Edited 2 times, last by lootercuster (July 13, 2016 at 7:37 PM).

  • The problem isn't the storing of the ON or OFF, since F2.5 already lets you retreive a Flag as a 0 or 1. The problem was setting a Flag to an integer (0 or 1).

    My current solution is to assume all Flags are OFF by default (since this only loads at the Start of Frame) and do a comparison for each flag like so:

    +Start of Frame
    --Set String Parser string to Array string (each array entry holds all flag values for one object)
    --Start Loop "check" (# of objects) times

    +On loop "check"
    +ID (object) = LoopIndex("check")
    +ListGetAt$ (1)= "1"
    --Set (object)Flag (LoopIndex("check") to ON

    +On loop "check"
    +ID (object) = LoopIndex("check")
    +ListGetAt$ (2)= "1"
    --Set (object)Flag (LoopIndex("check") to ON

    etc... incrementing the element index of the string parser comparison for each additional flag. I only have 7 Flags to compare for each object, but it still feels like bloat.

    Please login to see this link.

Participate now!

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