Instead of on :dialog:message:sclick:: and the same for edit and init, use
on :dialog:message::*: {
if ( $devent == init ) {
commands
}
elseif ( $devent == sclick ) {
if ( $did == ) {
commands
}
elseif ( $did == ) {
commands
}
}
elseif ( $devent == edit ) {
if ( $did == ) {
commands
}
}
}
Also you can use $devent for a menu to: if ( $devent == menu ) {