menu channel { - $iif($group(#reptext) == on,Disable,Enable) Replace Text:{ if $group(#reptext) == on { .disable #reptext | rtext_unload } else { .enable #reptext | rtext_load } } } #reptext on on *:START: rtext_load on *:EXIT: rtext_unload on ^*:TEXT:*:*: echo -mbflirt $iif(#,#,$nick) $+(<,$nick,>) $rtext_put($1-) | haltdef #reptext end alias rtext_put { set -ln %a $1 var %b = $hfind(rtext,%a,0,R), %c while %b { %c = $hfind(rtext,%a,%b,R) !.echo -q $regsub(%a,/\b %c \b/gix,$hget(rtext,%c),%a) dec %b } return %a } alias rtext_add { if !$hget(rtext) { rtext_load } if $1 == $null { echo -ac info * You have to specify a word to add. | return } if $2 == $null { echo -ac info * You have to specify a replacement for the word: $1 | return } hadd rtext $1- rtext_save echo -ac info * Added word: $1 with replacement: $2- } alias rtext_del { if !$hget(rtext) { rtext_load } if $1 == $null { echo -ac info * You have to specify a word to delete | return } if !$hget(rtext,$1) { echo -ac info * There is no such word: $1 | return } hdel rtext $1 rtext_save echo -ac info * Deleted word: $1 } alias rtext_list { if !$hget(rtext) { rtext_load } echo -ac info * Listing words with according translation. var %a = 1 while $hget(rtext,%a).item != $null { echo -a %a - $v1 -> $hget(rtext,$v1) inc %a } } alias rtext_load { if !$isfile(rtext.txt) { echo -ac info * Error: missing file rtext.txt. Creating new file...Done. write rtext.txt } if $hget(rtext) { hfree rtext } hmake rtext hload rtext rtext.txt echo -ac info * Replacement Text database loaded. } alias rtext_unload { if $hget(rtext) { rtext_save hfree rtext echo -ac info * Replacement Text database unloaded. } } alias rtext_save hsave -o rtext rtext.txt