Well, you can take control from the player... I think it's computer.control() or something (It's been a couple years since I did AGI programming). Then, after the pooping animation is finished, you use player.control() to give control back to the player.
All of this is in the excellent help files found in AGIStudio. Study them, learn them, sleep with them under your pillow.