User Tag List

Results 1 to 10 of 10

Thread: [REQ] Set flag by expression

  1. #1
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    3,000
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)

    [REQ] Set flag by expression

    I can't remember if I already requested this. Among other things, it would be very useful to better sync/pair objects together. We can already do it with alterable values/strings, but it's currently not possible with flags.

    What we can do:
    Code:
    • Always
    --> "Active.child" Set Alterable Value A to Alterable Value A("Active.parent")
    --> "Active.child" Set Alterable String A to Alterable String A("Active.parent")
    What we can't do:
    Code:
    • Always
    --> "Active.child" Set internal flag 0 to Flag("Active.parent", 0)

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)
    Not tried it, but perhaps something like this would work:
    Code:
    • If Flag( "Active.parent", 0) <> Flag( "Active.child", 0)
    --> Active.child: Toggle internal flag 0
    You could also try Looki's Object Flagger extension.
    .:::.Joshtek.:::.

  3. #3
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Just use an alterable value instead of a flag. The fact that you can't rename flags is a far bigger issue - and reason in itself to use alterable values instead.

  4. #4
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    3,000
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)
    Joshtek, your suggestion does work if there is only one instance of Active.parent and Active.child. When more instances are involved, you code will ony work with the last instance created. This is because flag comparison can only be done via "Compare two general values" which annihilates object filtering. I have tried other methods without success. I also avoid using extensions which aren't cross-platform, but thanks for the tip.

    Of course I could use an alterable value like MuddyMole suggested. But I already use a lot of them, and being unable to sync these 32 flags makes me mad.

  5. #5
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,546
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Olivier View Post
    Joshtek, your suggestion does work if there is only one instance of Active.parent and Active.child. When more instances are involved, you code will ony work with the last instance created. This is because flag comparison can only be done via "Compare two general values" which annihilates object filtering.
    Would object filtering be annihilated if you set an alterable value to the relevant flag state and then used the object's "Compare to one of the alterable values" to determine whether to flip the flags? Could you simply do "If flag is on (active.parent)" -> "Set flag on (active.child)" / "If flag is off (active.parent)" -> "Set flag off (active.child)"? If you used a fastloop then you could perhaps just loop through all 32 flags, although this might need to be inside another loop to cycle through all of the parents.
    .:::.Joshtek.:::.

  6. #6
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    3,000
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Joshtek View Post
    Would object filtering be annihilated if you set an alterable value to the relevant flag state and then used the object's "Compare to one of the alterable values" to determine whether to flip the flags?
    That's very clever Joshtek! Using an alterable value to pass a flag state between the child and the parent does work. The same alterable value can be used for the 32 flags, one after the other. Thanks a lot for the brilliant idea.

    Quote Originally Posted by Joshtek View Post
    Could you simply do "If flag is on (active.parent)" -> "Set flag on (active.child)" / "If flag is off (active.parent)" -> "Set flag off (active.child)"? If you used a fastloop then you could perhaps just loop through all 32 flags, although this might need to be inside another loop to cycle through all of the parents.
    This would work by using a fastloop indeed. But then I tend to avoid fastloops as much as possible.

  7. #7
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    3,000
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)
    Here's a simple commented example demonstrating how to pair/sync objects by using flags and one alterable value. No fastloops involved.
    Attached files Attached files

  8. #8
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,016
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)
    Here's the same rendition using far less events... just my 2 cents.

    lol I have a blank 'always' in there too, unsure where that popped up from o.0
    Attached files Attached files
    Want to learn Clickteam Fusion 2.5?




  9. #9
    Clickteam Clickteam
    Olivier's Avatar
    Join Date
    Jun 2006
    Posts
    3,000
    Mentioned
    9 Post(s)
    Tagged
    1 Thread(s)
    Thanks Danny, your code is nicely optimized indeed. Probably more difficult to understand at first glance tho.

  10. #10
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    An AltValue called Temp_ is quite usefull and can save you from running out of AltValues.
    Im many cases you define AltValues which most of the time act idle and waste perfectly good AltValue slots.
    Its a good idea to create a comment describing what the Temp_ value is used for when you use it, in the Event Editor.

Similar Threads

  1. high flag # bug
    By Ahiru in forum iOS Export Module Version 2.0
    Replies: 3
    Last Post: 4th April 2015, 06:28 AM
  2. I need more flag
    By MEHRDAD in forum Multimedia Fusion 2 - Technical Support
    Replies: 24
    Last Post: 23rd January 2012, 06:37 PM
  3. Flag Frenzy
    By Kisguri in forum iOS Released Games & Apps
    Replies: 0
    Last Post: 24th August 2011, 08:03 PM
  4. What is flag?
    By Nyc in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 9th June 2011, 02:49 PM
  5. Flag and arrays expression help
    By Bruto in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 30th March 2008, 02:44 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
  •