Yes you can.
First of all, the idea of an bot is, that it is a separate client, dedicated to performing things.
So, I would suggest setting up a second version of mIRC that will eighter be the bot (dedicated to performing stuff), or that it will be your main client.
Anyway, the on text events only trigger when other people type something. That's why its also called remote scripts.
If you want it to work for yourself as well, you should use on input. Since that will trigger when you type something yourself.
ON 1:TEXT:*Your spies all return safely to your camp*:#endlos:{
koc-set-sab $$1-
}
on 1:INPUT:#endlos:{
if (*Your spies all return safely to your camp* iswm $1-) {
koc-set-sab $1-
}
}