This is for a text based game I've been playing for years and wanted to create a bot to help my team. I've got it working as is, but every time the game is over, I have to recode parts of it and it's gotten very tedious as the bot has gotten much more complicated.

Every team in the game has a value that is attached to anything that affects them and my bot watches for our value and the values of our allies when the irc newsfeed posts what is going on in the game.

My event currently looks like this:
on 1:TEXT:*CM*[DKNIGHTS]*[*:#:{

[DKNIGHTS] is the value associated with my team and my bot lets us know we've just attacked someone. The problem is that [DKNIGHTS] is not always assigned to us, and the same goes for the tags assigned to our friends. The second [ is there to check to see if we are first in the line of text or second. If there isn't a [ after our tag, then it is us who have just been attacked.

I wanted to use ISIN to watch all newsfeed items that indicate an attack, but that doesn't allow me to find out what order the brackets are in and it can't tell us if we are attacking or being attacked. There is a lot of functionally meaningless gibberish between the brackets and I can't try to include that in the isin.

To try to curb this a little, I wrote a small script that lets me assign our value to a variable called %ourtag

I tried running it through like this:
on 1:TEXT:*CM*%ourtag*[*:#:{

But when I do that, mIRC reads %ourtag literally instead of the value assigned to %ourtag. Adding spaces before and after %ourtag did not help. The only way I can even get the bot to read the value is to make it not look for any other text with it.

on 1:TEXT:%ourtag:#:{

The newsfeed will never just spit out our tag, and if it did, it would be the most useless bit of info it has ever told us.

Basically, I'm looking for a way to have the script tell me when %ourtag appears in a line of text with a bracket after it and when certain letters appear at the beginning (the letters tell us what kind of attack it is and whether or not we need to worry).

Any help would be greatly appreciated.