$chan(#Channel).topic - will give you whats in the topic.
You would have to do something like this which would check if the topic is whatever text...
On me:*:Join:#Channel:{ var %topic = If this topic is this then... if ($chan($chan).topic == %topic) { set %chgonop 1 } else { unset %chgonop } }
Then you would have to have something like this for when you are op'd to change the topic:
On *:op:#Channel:{ if (($opnick == $me) && (%chgonop == 1)) { topic $chan Your new topic text }
However, that may seem a little inefficent since you can just do it ON OP using the following:
On *:op:#Channel:{ var %topic = If this topic is this then... if (($chan($chan).topic == %topic) && ($opnick == $me)) { topic $chan Your new topic text } }