User Tag List

Results 1 to 5 of 5

Thread: what's a good way of testing if an object DOESN'T have a particular qualifier?

  1. #1
    Clicker 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)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,159
    Mentioned
    78 Post(s)
    Tagged
    0 Thread(s)

    what's a good way of testing if an object DOESN'T have a particular qualifier?

    What's the best way to locate all objects that don't have a particular qualifier?

    This is an issue I've come up against a number of times. In the specific situation I'm in now, it looks like this: I have a whole bunch of objects with Qualifer A. Many (but not all) of those objects also have Qualifier B. I want to isolate all objects that do have qualifier A but don't have qualifier B, and move them to a different layer. So Objects that have A & B should stay where they are, while objects that are only A should move layers.

    It would be really nice if we could have a (negatable) condition that can test for whether a particular object has a particular qualifier or not (hint hint, @Yves ). But I don't think we can at the moment, so I've come up with the following solution which works ok, but I don't like it. It's cumbersome and surely not very performant:

    step 1: I first record the current layer of ALL objects with qualifier A.
    step 2: Then I move ALL objects that have qualifier A to a different layer.
    step 3: Then I check whether those objects which have a qualifier of A also have a qualifier of B (using the only way I know how - by checking to see whether the fixed value of an A object is also the fixed object of a B object). If so, then I move that object back to the layer it was originally on (because steps 1 and 2 turned out to be unnecessary for that object, so I need to undo them).



    Is there a better method than this for testing whether or not an object has (or doesn't have) a particular qualifier? There are many programmers here who area smarter than me, so I'm hoping that there is a more straight-forward they can show me that I just haven't thought of.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS 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)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,344
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    One solution could be to add a flag to all Qualifier A and B objects, or even to all objects, and name it Runtime_I_Have_Qualifier_B. Don't set the value in the editor.
    Before moving objects, run a ForEach on Qualifier B and on each loop set Runtime_I_Have_Qualifier_B on.
    Finally run a ForEach object on Qualifier A and add the condition Runtime_I_Have_Qualifier_B = Off. On each loop, move the object to the new layer.

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLC
    Tek's Avatar
    Join Date
    Jul 2007
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm...good question. In my own project I don't think I've encountered this situation yet. Most of the times that I need to check for multiple qualifiers is with collisions, and then I can just use multiple overlap conditions to test for more than one qualifier. Because of this I can't say I know which way of testing for this is "good" or the best, but here's one idea.

    Assign a value to each object in one of their Alt Value slots. This value will be specific to what qualifier(s) the object has.

    So for example lets say there are 3 types of qualifiers (Qualifier A, Qualifier B, and Qualifier C). Objects with the Qualifier A will be assigned a value of 1, objects with Qualifier B a value of 2, and objects with Qualifier C a value of 3. Objects with multiple qualifiers will have a different number which is simply the numbers of both or all their qualifiers placed next to each other (not added up).

    Since qualifiers cannot be assigned or removed at runtime, it seems to me that these values could be set within the objects manually in the frame editor.

    Qualifier A: 1
    Qualifier B: 2
    Qualifier C: 3
    Qualifier A+Qualifier B: 12
    Qualifier A+Qualifier C: 13
    Qualifier B+Qualifier C: 23
    All three: 123

    Once all the objects have an Alt Value that identifies which qualifiers they have, your events could simply compare the objects Alt Value to see whether or not they have A and B or just A.

    The downside to this is obviously that you are using an additional Alt Value per object just to determine what qualifiers are already stored in the object.

    Just in case applying these values manually is impractical or wouldn't work for some reason, here is an idea of how to go about it with events.
    To make this happen with events, you could go through all the potential qualifiers in order to assign the values. First check for all Qualifier As and set their value to 1. After that, check all Qualifier Bs and either set their value to 2, OR, if their value is already 1 because they're also Qualifier A, run an event that appends the "2" next to the "1" value so that it becomes 12. Do this sort of thing for all the combinations, or at least the ones you expect to need. I suppose you would need to convert the values into strings and then back into values in order to append the two values into one number rather than adding them up. The downside to this is that it will take more events and time to set this ID system up than your foreach loop method. In that case, if you cannot set the values in the objects manually from the frame editor, then your existing method is probably much, much faster and better than this.

    Anyways, that's just a thought. There's probably a far better way to do this, possibly the one you're already using.

  4. #4
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    642
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Here's something simple using a string. Just replace the "set scale to 2.0" to "run your foreach loop moving layers".

    qo0Qh8d.png
    UTewma1.png

    vol qualifiers1.mfa

    EDIT: You can just set the first qualifier's string to "A" instead of CurrentString+"A" to save a few cycles. Qualifier B is all that needs the "+" part. This means the new setup would look like this:

    UD4hXDd.png

    max optimization

    detect qualifiers of actives.mfa

  5. #5
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    642
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    my "solution" doesn't work with duplicate objects i found. It can be fixed by using foreach loops to set the string instead but then it isn't much different than your original method. I think popcorn's is probably best in this case.

Similar Threads

  1. Many overlapping sounds doesn't sound very good
    By KLiK-iT in forum Fusion 2.5
    Replies: 13
    Last Post: 4th May 2016, 11:08 AM
  2. Good cheap low spec device for testing?
    By DistantJ in forum Android Export Module Version 2.0
    Replies: 8
    Last Post: 29th August 2012, 06:03 PM
  3. Motorola DROID A855-Good for testing?
    By UrbanMonk in forum Android Export Module Version 2.0
    Replies: 3
    Last Post: 3rd August 2011, 09:50 PM
  4. Object folder and Object qualifier in Global event
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 27th December 2009, 04:28 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
  •