Public Macros Macro to save and/or load filter window settings
Reply
Macro to save and/or load filter window settings
It doesn't happen often but it does happen to me often enough that it can be annoying....sometimes my filter settings reset to default. EZServer is a bot heavy server with most active players playing 12+ characters at a time and have 2 directories they play from...one for their control toon and another skinny directory for their alts. On the skinny directory, you generally want almost everything filtered out and even on the main directory there are things that are effectively useless spam so you end up setting a lot of the options to hide. That being said, this macro should work on any server, live or EMU.

What this macro offers is a way to quickly save all of your filter settings into an INI file that you can load on any of your other characters. Once you save a filter set, you can run this macro and tell it to apply the settings from a saved profile to any character. You could save a filter set that shows all the different message types for when you are logging stuff to parse then swap to a filter set with non essential stuff filtered out.

When this macro starts, it checks the macro directory for it's associated INI file...if it doesn't exist yet, it parses your current settings and saves a profile as the character's name. You can update profiles whenever you want, just save the filter set as the same name of the profile you are updating. Make as many profiles as you want, name them anything you want and load them whenever you want. There's some error logic, you won't be able to save or load a filter set with a blank name, but if there are other issues post here and they'll be addressed.

Macro
More +

|==== dum_as_f for use on EZServer

|==== FilterSets.mac
|==== Use this macro to save or load your filter configuration on the
|==== Options Window.  Sometimes filters seem to revert to the default
|==== settings, this allows you to apply your saved filter settings
|==== to a character by having MQ2 iterate through each setting and
|==== choosing your desired setting for that filter.

|==== /echo savefilters NameToSaveAs will write the current settings to an INI file.

|==== /echo loadfilters NameToLoad will load the settings for NameToLoad from the INI
|==== and iterate through them and apply the corresponding setting.

        #Event Help "[MQ2] filtersets help"
        #Event SaveNewFilterSet "[MQ2] savefilters #1#"
        #Event ReadFromIni      "[MQ2] loadfilters #1#"
       
|==== Sub Main
        Sub Main
                /echo FilterSets macro is running...please [/echo filtersets help] for help information.
                /call CreateIni
                :LoopLogic
                        /doevents
                /goto :LoopLogic
        /return
|==== End Sub Main

|==== Sub CreateIni
        Sub CreateIni
                /declare thisFilterSet          string  outer
                /varset thisFilterSet ${Me}
               
                /if (${Ini[FilterSets.ini].Length}) /return
               
                /echo No Ini file found, creating a new one with ${Me} as default filter setting
                /call FilterSetLoop
        /return
|==== End Sub CreateIni

|==== Event_SaveNewFilterSet
        Sub Event_SaveNewFilterSet(Line, SetName)
                /if (${SetName.Length}) {
                        /echo Attempting to save filter set ${SetName}
                        /varset thisFilterSet ${SetName}
                        /call FilterSetLoop
                } else {
                        /echo You need to supply a name for a filter set before you can save it, try again.
                }
        /return
|==== End Event_SaveNewFilterSet

|==== Sub FilterSetLoop
        Sub FilterSetLoop
                /declare i int local
                /for i 1 to ${Window[OptionsWindow].Child[OFP_FilterList].Items}
                        /notify OptionsChatPage OFP_FilterList listselect ${Window[OptionsWindow].Child[OFP_FilterList].List[=${Window[OptionsWindow].Child[OFP_FilterList].List[${i}]}]}
                        /echo Setting ${Window[OptionsWindow].Child[OFP_FilterList].List[${i}]} to: ${Window[OptionsChatPage].Child[OFP_FilterList].List[${i},2]}
                        /ini "FilterSets.ini" "${thisFilterSet}" "${i}. ${Window[OptionsWindow].Child[OFP_FilterList].List[${i}]}" "${Window[OptionsChatPage].Child[OFP_FilterList].List[${i},2]}"
                        /delay 3
                /next i
                /echo [ ${thisFilterSet} ] filter set has been created and/or updated in the FilterSets.ini file
        /return
|==== End Sub FilterSetLoop

|==== Sub Event_ReadFromIni
        Sub Event_ReadFromIni(Line, FilterSetName)
                /echo Reading from Ini file
                /if (!${Defined[filterDescription]}) /declare filterDescription string  outer
                /declare i                                              int     local
                /declare thisDescription                string  local
                /declare descriptionSubstring   string  local
                /declare filterSetting                  string  local
                /declare loadFilterSet                  string  local   ${FilterSetName}
               
                /if (${FilterSetName.Length}) {
                        /varset filterDescription ${Ini[FilterSets.ini,"${loadFilterSet}"]}
                        /echo Accessing values from FilterSet ${loadFilterSet}
                        /for i 1 to ${Window[OptionsWindow].Child[OFP_FilterList].Items}
                                /varset thisDescription ${filterDescription.Arg[${i},|]}
                                /varset descriptionSubstring ${thisDescription.Mid[4,${Math.Calc[${thisDescription.Length}-3]}]}
                                /notify OptionsChatPage OFP_FilterList listselect ${Window[OptionsChatPage].Child[OFP_FilterList].List[=${descriptionSubstring}]}
                                /varset filterSetting ${Ini[FilterSets.ini,${loadFilterSet},${thisDescription}]}
                                /notify OptionsChatPage OFP_FilterComboBox listselect ${Window[OptionsChatPage].Child[OFP_FilterComboBox].List[=${filterSetting}]}
                                /echo Setting ${descriptionSubstring} to ${filterSetting}
                                /delay 3
                        /next i
                } else {
                        /echo You need to supply a name for a filter set before you can load it, try again.
                }
        /return
|==== End Sub Event_ReadFromIni

|==== Sub Event_Help
        Sub Event_Help
                /echo Macro will build a default filter set based on current filter values if no INI file is found.
                /echo [/echo savefilters NameToSaveAs] is the syntax for saving current settings to the INI, NametoSaveAs can be whatever you want to name the filter set.
                /echo
                /echo [/echo loadfilters NameToLoad] to load a filter set named NameToLoad from the INI
        /return
|==== End Sub Event_Help
Last edited by dum_as_f on Thu Apr 18, 2019 11:37 am; edited 1 time in total
Wed Apr 17, 2019 7:07 pm
Good idea, thanks for sharing
Thu Apr 18, 2019 8:21 am
Project Lead
Public Macros Macro to save and/or load filter window settings
Reply