I was wondering why you just don't use $replacex for this?
Also in your if comparisons, use double equal signs "==" instead of one "="
like if (v1 == v2) { commands }
Usage: $ab(string)
Code:
alias ab return $replacex($$1,a,y,b,p,c,l,d,t,e,a,f,v,g,k,h,r,i,e,j,z,k,g,l,m,m,h,n,s,o,u,p,b,q,x,r,n,s,c,t,d,u,i,v,j,w,f,x,q,y,u,z,w)
So you in your code you'll do something like: //msg $active $ab(my string)
It's advisable to create the function (char replacer) independent from messaging it to the channel, that way you can use that function in multiple situations, like e.g.: