User Tag List

Results 1 to 5 of 5

Thread: ccount total object: particolar function

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleXNA Export Module
    daniele's Avatar
    Join Date
    Nov 2007
    Location
    italy
    Posts
    413
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    ccount total object: particolar function

    I have a problem...I have only one active object. And i clone many of these. I use the directions of active object like graphic. My problem pops up when I have to count a part of the object. Example: I have 3 active objects but they are always the same object. Two of them are red e the other one is green. Is I want to count every red object, How can I do? My problem is that when I make the final count of red objects the total is 3 instead of 2.
    Could you complete this example?
    Attached files Attached files

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    happygreenfrog's Avatar
    Join Date
    May 2011
    Location
    I.L.T.D.O.I.R (I.L.T.D.O.I.R's Location: The Dimension Of Infinite Recursion)
    Posts
    4,307
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Using the ForEach object should make it easy. Just run the ForEach loop, have a counter object called "Count Red objects" or something like that, check to see what color an object is (I haven't looked at your MFA file yet, so I can't tell how you change the color of the objects), add one to the counter if the object is red, and then check the counter's value. You might want to reset the counter's value in an "Always" event placed below everything that checks for the number of red objects, though it isn't necessary (in some circumstances, it might be necessary, which is why I advise you do it) if you reset the counter before running the ForEach loop.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleXNA Export Module
    daniele's Avatar
    Join Date
    Nov 2007
    Location
    italy
    Posts
    413
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Zonacas View Post
    I made a small example with fast loops
    you have been very kind, your example works fine.
    I am making a very powerful software for control of my hardware interface and in the credits, I would put the names of all those who helped me, including you.
    that function allows me to have the state of the quantity of sliders that I have in my timeline and also power to exclude those that should not be seen.
    Thank you again.I hope that this example will be helpful for all

  4. #4
    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)
    Ha ha, ha ha
    I will do this without using loops of any kind!
    In theory at least

    THE IDEA: TOKEN COUNTING METHOD
    The basic idea here is to, instead of trying to count the number of Instances which fit the criteria, we get the Instances which fit the criteria to shoot an Object ( Token ), and we simply count the number of Tokens.

    THE APPARENT SOLUTION: TOKEN COUNTING METHOD
    So the logical flow would go alittle something like this:

    + If Active AltValueA = 0
    - Create Token at Active
    - Set Counter1 to 'Nr Of Tokens'
    - Destroy Token

    + If Active AltValueA = 1
    - Create Token at Active
    - Set Counter2 to 'Nr Of Tokens'
    - Destroy Token

    + If Active AltValueA = 2
    - Create Token at Active
    - Set Counter3 to 'Nr Of Tokens'
    - Destroy Token

    This looks like it could work!
    On paper at least, however...

    THE PROBLEM: OBJECTS AND DESTRUCTION
    This is one of the quirks of MMF2.
    When you destroy an Active Object in MMF2, it is only marked for destruction, it is not relly destroyed before the end of the frame/ all Events have finished running.

    If you think about the 'Token Counting Method' ( above ) in this light, it doesnt really work at all.
    Only the first Event will work providing accurate results.

    THE SOLUTION A: INDEVIDUAL TOKEN COUNTING METHOD
    To avoid this problem, one could create 1 Token Object for each Thing that needs counting.
    The result would be something like this:

    + If Active AltValueA = 0
    - Create Token0 at Active
    - Set Counter1 to 'Nr Of Token0s'
    - Destroy Token0

    + If Active AltValueA = 1
    - Create Token1 at Active
    - Set Counter2 to 'Nr Of Token1s'
    - Destroy Token1

    + If Active AltValueA = 2
    - Create Token2 at Active
    - Set Counter3 to 'Nr Of Token2s'
    - Destroy Token2

    This would work, YAY!
    But its a bit tedious to create an entirely new Object for each Thing that needs counting, it can become somewhat of a pain.

    THE SOLUTION B: TOKEN COUNTING METHOD ADVANCED
    This is imo the best solution.

    First
    designate a safe area, well outside the Frame, this will be the Counting Area.

    Second
    Instead of simply Counting the total number of Tokens, we are going to count the total number of Objects inside the Counting Area.

    Third
    We create Token Objects inside the Frame Area when we need counting, we move them out of the Counting Area when we are done with them.
    This way the Token destruction problem doers not affect us!
    It looks alittle something like this:

    + If Active AltValueA = 0
    - Create Token at -300, -300

    + Count nr of Objects in zone <Counting Area>
    - Set Counter0 to 'Nr Of Tokens'
    - Token set possition to -1000, -1000
    - Token destroy

    + If Active AltValueA = 1
    - Create Token at -300, -300

    + Count nr of Objects in zone <Counting Area>
    - Set Counter1 to 'Nr Of Tokens'
    - Token set possition to -1000, -1000
    - Token destroy

    + If Active AltValueA = 2
    - Create Token at -300, -300

    + Count nr of Objects in zone <Counting Area>
    - Set Counter2 to 'Nr Of Tokens'
    - Token set possition to -1000, -1000
    - Token destroy

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleXNA Export Module
    daniele's Avatar
    Join Date
    Nov 2007
    Location
    italy
    Posts
    413
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    This is my first tutorial for This Forum.
    I created a version for everyone because it can be useful. I modified the file by adding the functions. I hope that this example can be of help to everyone.
    Attached files Attached files

Similar Threads

  1. Function Eggtimer problem // Power Function for MMF2 Android?
    By ogrgkyle in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 24th May 2013, 03:17 AM
  2. particolar MATRIX display
    By daniele in forum Multimedia Fusion 2 - Technical Support
    Replies: 17
    Last Post: 24th October 2008, 11:37 PM
  3. PARTICOLAR RANDOM number
    By daniele in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 21st October 2008, 10:54 AM
  4. Global Function Object?
    By IsaacBoy in forum Extension Development
    Replies: 37
    Last Post: 25th July 2006, 09:52 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
  •