I would use $reptok
Syntax /topix originalvalue newvalue
Script detects if your op before change and checks to see if original value matches in topic before.
Note: Must be on the channel in question does $active check.
alias topix {
if ($me isop $active) && ($$1 isin $chan($active).topic) {
.topic $active $reptok($chan($active).topic,$$1,$$2,32)
}
}