So by adding the "If Output AFpump = OFF Then OFF" line the feeder is only on when the pump is on even if the code tells it to turn on for 30 seconds every hour? I like that, the number of feedings can be controlled by the pump programming, "AFpump" in your case.
That is correct both by adding that line and putting it after the lines that turn it on I ensure that the feeder while not be turned on by code if the pump is off