in_container is a little hard because of the fact that it requires two arguments. mudprog ifchecks, at least the last time I looked at them, only take a single argument. Note that that might have changed in more recent versions like FUSS.
num_in_container is much easier in this respect because you only need one argument: the container to search. But it's a little unclear how to go about specifying the container itself.
I'm not sure if there is a mechanism to stop a command in progress. For starters, it would depend on when the trigger is, well, triggered. If the command has already taken place, then obviously you won't be able to stop it. If the trigger happens when the command is about to be processed, you would in principle be able to stop it. But like I said, I'm not sure if there is any such mechanism in place.
To be frank, issues like these are rather central to my very high frustration with mudprog, and my move toward other languages. I started my own several years ago that helped a lot, and now I'm in the process of moving that to Lua. Even though I am far from finished, things are much better already.