I'm not sure whether unrealircd allows opers to op themselves, but I suspect it may be possible. --> Yes, you just have to do a /op nick after you made your /oper nick pass...
After it is made an oper, the line you mentioned before (with some subtle modifications should do the trick in identifying your bot as an oper...) --> Too bad I can't make this line work
Now, the problem here, is that you use "/op" as the command.
In most clients, the / is used to signify a internal command, no t a command destined for the server. The client will then, if programmed to, send the real command to the server. Most client will default to send the command to the IRC server, if the command does not exist (though mIRC does not)
Using debug logs, or looking at your scripts, see what command the /op command sends to the server, you will then be in better position to see what to set in a script
Unreal IRCd DOES allow opers to op themselves (I co-own a dual Unreal server network) its simpler than that, define the bot in its OWN user list with a full hostmask not a wildcarded one then add a short timer then a bind join for its own mask so that when it joins a room it will wait a couple of seconds then op itself. I use this successfully on our network although I dont use Eggies instead of services, I use them as well as Auspice services.
Edit: forgot to add, opers can simply use the standard /mode #Channel +o <username> command on themselves on Unreal.
Hope this helps
Regards
Ian-Highlander
"Insanity Takes Its Toll, Please Have Exact Change"