Jump to content
Sign in to follow this  
You need to play a total of 1 battles to post in this section.
OlliN

CheckBox filter problem

1 comment in this topic

Recommended Posts

Modder
300 posts
5,079 battles

When I have 3 checkbox filters and save their condition as userPrefs, I can access the saved values with a watch bind as below.

        <bind name="watch" value="'Value1'; (userPrefs.elementsGroupExpand.Value1== null) ? false : userPrefs.elementsGroupExpand.Value1"/>
        <bind name="watch" value="'Value2'; (userPrefs.elementsGroupExpand.Value2== null) ? false : userPrefs.elementsGroupExpand.Value2"/>
        <bind name="watch" value="'Value3'; (userPrefs.elementsGroupExpand.Value3== null) ? false : userPrefs.elementsGroupExpand.Value3"/>
        <bind name="watch" value="'Value4'; (userPrefs.elementsGroupExpand.Value3== null) ? false : userPrefs.elementsGroupExpand.Value4"/>

 

To show the objects I (don't) want to filter, it is possible to use the 'visible' bind:

        <bind name="visible" value="Value1"/>
        <bind name="visible" value="Value2"/>
        <bind name="visible" value="Value3"/>
        <bind name="visible" value="Value4"/>

 

It's working as intended with only 1 option, all or none selected.

 

The problem is when two (or more) options are selected, the game messes up the filtered objects probably because of the 'visible' binds. A workaround is to declare additional conditions, which is quite easy with only 3 filters (4 possible conditions). But with increased filter counts (>3) it becomes a mess. 4 filters require 9 conditions (example below), 5 require 16, 6 require 25 and so on.

        <bind name="visible" value="Value1 && Value2 && Value3 && Value4"/>
        <bind name="visible" value="Value1 && Value2 && Value3"/>
        <bind name="visible" value="Value1 && Value2 && Value4"/>
        <bind name="visible" value="Value1 && Value3 && Value4"/>
        <bind name="visible" value="Value2 && Value3 && Value4"/>
        <bind name="visible" value="Value2 && Value3"/>
        <bind name="visible" value="Value2 && Value4"/>
        <bind name="visible" value="Value3 && Value4"/>
        <bind name="visible" value="!Value1 && !Value2 && !Value3 && !Value4"/>

 

Is there a simpler way? Did I miss something? Any help appreciated.

  • Cool 1

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×