I have no idea and have not tried this myself. But...
The ping pong ball is a combat item.
Custom Combat Scripts can use combat items so I might start there if I wanted something simple - if monster is X then use ping pong ball. Hardest part will be choosing a second action if there are no ping pong balls available.
There are also consult scripts (later on the same wiki page) that can be written that give you a lot of control over what to do - doing something different whether the paddle is equipped, or not.
There are also combat macros that could be written but but I have never tried one so would be speaking from more than my usual position of ignorance.
The key, though, is they are a combat item so you need some kind of in combat scripting.