Sorry to keep replying to my own posts here, but I have made some more progress, and now have it working completely (as a stand alone trigger anyway). Im just using a microswitch to detect filament so OP your setup might vary a bit.
M950 J12 C"io8.in" M581 P12 T1 S0 C1 M581 P12 T3 S1 C0So this setup detects running out of filament only when printing, but inserting filament anytime. I made a file, trigger3.g, which runs whenever you insert filament, acts as a filament load script. Filament runs out, print pauses runs pause.g, filament is inserted, it runs trigger3.g, then I click "resume print" and it starts back up. Works like a champ. Still not sure how to use M591, but this is working.