You have to change the order of the code. mIRC will not process next event if it is already matched.
~editcom is matched to this event
on $*:text:/^~(\S+)/:#:{
...
}
thus next event will be ignored.
Try move the code quoted above to the bottom of the script.