[REL] Alerts Filter v1.0.0 [DISCONTINUED]

Discussion in 'Mod Discussions' started by Raevn, January 8, 2014.

  1. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    This mod allows you to select which unit types generate alerts when built (ready), under attack or destroyed.
    You can select the unit types in the UI tab in settings, hold down shift/control to select multiple types.

    alerts.PNG

    With "Mobile" Ready Alerts selected:
    alert2.png

    (Note: Under attack alerts trigger while the unit is under construction).

    Installation
    Current build: 58772 (version 1.0.0)
    Requires the Settings Manager mod (v1.2.0+)
    Ensure you update Settings Manager if you are using v1.1.1 or earlier.

    Step 1:
    Install the PA Mod Manager: https://forums.uberent.com/threads/rel-ui-mod-manager-v1-2.50726/

    Step 2:
    Launch the Mod Manager and click Install next to "Alerts Filter" on the "Available Mods" page.

    Step 3:
    Tick the box for "Alerts Filter" in the Installed Mods list to enable to mod (Settings Manager will be automatically ticked).
    Last edited: January 8, 2014
  2. proeleert

    proeleert Post Master General

    Messages:
    1,681
    Likes Received:
    1,656
    Now that's very cool
  3. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I have not checked the code yet, but this may conflict withn how PA Stats gathers build/destroy events of everything.
    PA Stats basically calls the methods to ask for nearly all events and does all filtering inside the UI.
    So it might be that PA Stats either calls those methods after this mod does (resulting in this mod having no effect probably) or the other way around resulting in PA Stats failing to see events it should see.
  4. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    I safely hooked the processList function:

    Code:
    model.unitAlertModel.oldProcessList = model.unitAlertModel.processList;
    model.unitAlertModel.processList = function (array) {
      <do non-destructive stuff>
      model.unitAlertModel.oldProcessList(array);
    }
  5. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    That's only a part of the issue. To see some of those events you need to call some engine call to get all alerts.
    Do you just call it with "everything" or only with some parts?
    Also it will matter in what order PA Stats and this mod hook into the processList method.

    PA Stats works like this:

    1.)
    engine.call('watchlist.setCreationAlertTypes', JSON.stringify(['Mobile', 'Structure']));
    engine.call('watchlist.setDeathAlertTypes', JSON.stringify(['Mobile', 'Structure']));



    2.) Hook into the processlist and capture all those events. Filter events to recreate the default behavior so the player does not see the alerts. PA Stats basically has an alerts filter implemented in js, it is just not configurable.

    Your mod calls this:


    setTimeout(function () {
    engine.call('watchlist.setCreationAlertTypes', JSON.stringify(settings["rReadyAlerts"]));
    engine.call('watchlist.setDamageAlertTypes', JSON.stringify(settings["rUnderAttackAlerts"]));
    engine.call('watchlist.setDeathAlertTypes', JSON.stringify(settings["rDestroyedAlerts"]));
    }, 1000);

    So PA Stats wont get the events it wants to get anymore.

    I have not tested it, but I am pretty sure the result will be that PA Stats only sees the events that are not filtered by your mod.

    Since PA Stats uses no timeout 1000 but executes those methods earlier your mod will always be last in setting what alerts will be seen.
    Depending on the load order the filtering by PA Stats will also result in weird behavior of your mod, as it might filter non default events before your mod ever sees them.

    Can the manager somehow mark mods as conflicting? Otherwise we need to combine the mods. The basic problem is that we both depend on the watchlist.setXAlertTypes.
    I think I could merge your settings for the types with PA Stats though, should not be much work.
  6. moldez

    moldez Active Member

    Messages:
    177
    Likes Received:
    110
    cool .. thank u so much for this .. finally i get a alerts for my destroyed scouts !

    keep it up !
  7. ORFJackal

    ORFJackal Active Member

    Messages:
    287
    Likes Received:
    248
    Looks like the UI APIs need some improvement. We need some generic way to subscribe to particular types of events. Something like events.subscribe('StructureCreated', function(event) {...}) which would allow multiple consumers to subscribe to the same events without conflicting with each other. Global variables such as setCreationAlertTypes limit them to only one consumer.
    proeleert and cola_colin like this.
  8. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    @raevn: I am starting on working to integrate this function into PA Stats + make it disable Alerts Filter.
    stormingkiwi and Raevn like this.
  9. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    So PA Stats can now filter by unit types and have inclusions/exclusions for single units.
    Check out the settings, tab "PA Stats".

    Note that PA Stats takes care of disabling this Alert Filter mod completely. I would recommend to deinstall it.
    Also note that you might find this list of unit to type mappings helpful:
    http://pastebin.com/t0J779n8
    Raevn likes this.
  10. sirbostontbagparty

    sirbostontbagparty Member

    Messages:
    69
    Likes Received:
    12
    Thank you so much now I can use these alerts on OS X.(Raevn a OS X version of the mod manager would be very nice. Yes I know there is a OS X version made by DeathByDenim but its not up to date.)
  11. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    It's possible to create such a system, but would need Cola's method of alert filtering as a base.

    DeathByDenim's version is up to date (it uses a different version number, but it's got the same features except for auto updating).
  12. sirbostontbagparty

    sirbostontbagparty Member

    Messages:
    69
    Likes Received:
    12
    Huh then why can't I see this mod in the available mods? Thats the only reason I assumed the OS X version is not up to date.
  13. DeathByDenim

    DeathByDenim Post Master General

    Messages:
    4,328
    Likes Received:
    2,125
    You might want to try to hit the "Refresh"-button when you are in the "Available Mods" tab. Both mod managers retrieve the same mod list. It's probably using the cached version. It should refresh automatically every two days, but I should probably drop that and always load the latest version.
  14. sirbostontbagparty

    sirbostontbagparty Member

    Messages:
    69
    Likes Received:
    12
    Ah ok I didn't notice the "refresh" button but that worked thanks, sorry to waste your guys time.
  15. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    [​IMG]

    Also, endorsed this mod in UI Notifications discussion thread in the main PA forums.

    Also, the repair/build alerting to "attack" is an unintended hook the developers have. Basically, "changing health" is what alerts, while in actuality it should be lowering health (barring the player understands that reclaiming a living structure is a form of "attacking yourself). The commander mod suffers from this too, it alerts to attack and the bar screams red while the commander is being repaired after taking a nuke like he is just dying (big baby, doesn't like the doctor apparently :p)
    Last edited: January 9, 2014
    stormingkiwi likes this.
  16. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    cola_colin likes this.

Share This Page