Think you will find the on open event triggers before the on text event, try this.

Code:

on ^*:open:?:test*: { echo -ag open event $1- | haltdef }
on ^*:text:test*:?: { echo -ag on text event $1- | haltdef }


then from the status type "//msg $me test to see which event triggers first." then open a query window to yourself and send the message again.