User Tag List

Results 1 to 5 of 5

Thread: Trigger Event When Objects in Group Share Same Value

  1. #1
    Clicker Fusion 2.5 DeveloperiOS Export Module

    Join Date
    Jun 2013
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Trigger Event When Objects in Group Share Same Value

    I’d like to trigger an event when all the objects in the group, ‘Good’, share the same ‘Alternate Value A’. I can’t just compare ‘Good’ Value A with ‘Good’ Value A, as that conflicts and doesn’t work. Does anyone have any suggestions?

    Thanks in advance.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module

    Join Date
    May 2012
    Location
    NSW, Australia
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you pick an object of that group at random, get its alterable value and store it somewhere (counter/global value).
    Then do some kind of loop (ie. forEach) that runs through the total amount of "Good" objects and on each iteration compares the stored value to each objects alterable value A.
    If they match add 1 to a counter, if they don't, set counter to 0. Then If the counter value = the number of objects in group "Good" trigger an event.

    This is just how i would first go about trying to accomplish this, i'm not sure if it actually works and i'm assuming theres a better way but i think it would do!

    EDIT: just tried making an example and i can't do it haha! i'm not too good with multiple instances of objects and ForEach, going to try and figure this out but! hopefully someone else can help

  3. #3
    Clicker Fusion 2.5 DeveloperiOS Export Module

    Join Date
    Jun 2013
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your ideas mecca02. A loop seems like it could be the right path. I've been playing around with that but still no luck.

  4. #4
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    You don't need a loop:

    + Whenever...
    -> Set Global Value A to 0
    -> Set Global Value B to Alterable Value A("Good")

    + Whenever...
    + Alterable Value A of Good <> Global Value B
    -> Set Global Value A to 1

    + Whenever...
    + Global Value A = 0
    -> Do something...


    nb: Unless you actually need values to be global (which you don't in this case), it's better to create another active to store the values in, instead of using global values - I just used globals for the sake of clarity.

  5. #5
    Clicker Fusion 2.5 DeveloperiOS Export Module

    Join Date
    Jun 2013
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks MuddyMole. Works Great. I'm having trouble with an event to set Global Value A Back to 1 when Value A of group "Good" are not all the same. Any suggestions?

Similar Threads

  1. Trigger event on Windows shutdown?
    By Ryan in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 3rd July 2013, 10:46 AM
  2. Share Active objects across frames
    By Keith in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 12th August 2011, 04:42 AM
  3. Search inside edit box for text, trigger event.
    By Kingoftaurus in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 13th May 2010, 04:33 AM
  4. trigger event when all enemies are same state
    By ionside in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 20th January 2010, 10:07 AM
  5. How would you trigger an event after a fastloop?
    By BREK in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 28th April 2009, 11:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •