Did you put it in your aliases? If you choose to put it in your remote, you need to add an alias as such:
alias hopall { var %x = $chan(0) while (%x) { hop -c $chan(%x) dec %x } }