Usage:
/rtext_add <word> <translation> /rtext_del <word> /rtext_list* Right click in a channel window to enable/disable the script.
* The script will trigger not only in channel windows, but also in pm.
* You can use this script as an Acromancer as well, as it allows you to specify a multi-word translation. In other words:
/rtext_add lol Laughing Out Loud will work.
* The replacement code allows for punctuation, in other words:
Input: this is divine--wonderful,+*)and,divine() again
Output: this is goddelijk--schitterend,+*)and,goddelijk() again
* The script is off right now. To enable it, you have to right click in a channel window.
Important, suppose the script is off: If you add/del/list words, the database will be loaded, but the script will not trigger on channels/pm's, until you right click in a channel to enable it.
* Script designed for mIRC 6.16, due to the $v1 identifier.
Start -> Run -> wordpad -> paste code -> copy code to Scripts Editor, tab Remote (alt+r).
menu channel {
-
$iif($group(#reptext) == on,Disable,Enable) Replace Text:{
if $group(#reptext) == on { .disable #reptext | rtext_unload }
else { .enable #reptext | rtext_load }
}
}
[color:red] [/color]
#reptext off
on *:START: rtext_load
on *:EXIT: rtext_unload
on ^*:TEXT:*:*: echo -mbflirt $iif(#,#,$nick) $+(<,$nick,>) $rtext_put($1-) | haltdef
#reptext end
[color:red] [/color]
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
}
[color:red] [/color]
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-
}
[color:red] [/color]
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
}
[color:red] [/color]
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
}
}
[color:red] [/color]
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.
}
[color:red] [/color]
alias rtext_unload {
if $hget(rtext) {
rtext_save
hfree rtext
echo -ac info * Replacement Text database unloaded.
}
}
[color:red] [/color]
alias rtext_save hsave -o rtext rtext.txt
Enjoy.