In short, yes, that is very possible.
To lay out simply what my process would be for something like what you are talking about, I would use an alias for "affect" such that in addition to sending "affect" to the game (it would need to use send("affect") in addition to the rest of what it does), it would turn on some triggers. Those triggers would capture each of the affects you see from the command being sent, as well as a trigger that detects when the list is finished. The affect triggers would simply store whatever affect was captured in a table, thereby creating the list you would be comparing to the list you have made in advance that you want to check against. When the trigger that says all the affects are done fires, you would compare the two tables to see what was missing from the captured list, and then do whatever you wanted based on that. The easiest way to make such a comparison is to use the table.n_complement function, which will take two tables with nearly identical entries and return all the items present in the first one that aren't present in the second one, which I think is exactly what you want to do.
So, to sum up, and lay out some code examples, the alias would be something like this:
enableTrigger("affect trigger")
enableTrigger("affect end trigger")
send("affect")
The trigger that captured each of the affects would have a capture group in it that let you identify the affect reliably, and its code would look something like this:
affects_table = affects_table or {}
table.insert(affects_table,matches[2])
And the trigger that let you know you were done with the affects would have code that looks something like this:
disableTrigger("affect trigger")
disableTrigger("affect end trigger")
local affects_list = {'affect 1','affect 2', etc...}
local missing = table.n_complement(affects_list,affects_table)
for _,v in ipairs(missing) do
-- do something here, this loop will step through the missing affects, which each one being stored in the variable "v"
end