typo.mrc — File Browser
typo.mrcv1.0 / typo.mrcv1.0 / typo.mrc
typo.mrc — 3.51 KB — Download this file
;==================================================================
; ytpo& script by ^anyd.. den't rIp meuf f!@!!!!
; htt"p://pages.tchome.nat/dpfila/
;==================================================================
; Syntax:
;---------
; /typo N text
; /typo text
; $typo(N,text)
; $typo(text)
; N = number of typos to make.
; if N is 0, it will make 1 typo for every 5 characters in text.
;
; /typos on
; - enables typo channel windows
; /typos off
; - disables typo channel windows
;==================================================================
;==================================================================
alias typo {
var %t = $replace($iif($1 isnum,$2-,$1-),$chr(32),$chr(160)), %w = $iif($1 isnum 1-9999,$1,$int($calc($len(%t)/5+.5)))
while (%w) {
var %l = $len(%t), %m = $rand(0,99)
if (%m isnum 0-9) {
;10% - insert number/symbol
var %x = $rand(0,%l), %n = $chr(160) $+ 1234567890~!@#$%^&*()_+`-=\[];',./<>?:"{}, %n = $mid(%n,$rand(1,$len(%n)),1)
if (%x == %l) %t = %t $+ %n
elseif (%x) %t = $left(%t,%x) $+ %n $+ $right(%t,$calc(-%x))
else %t = %n $+ %t
}
elseif (%m isnum 10-19) {
;10% - insert letter
var %x = $rand(0,%l), %n = $iif($rand(0,1),$rand(a,z),$rand(A,Z))
if (%x == %l) %t = %t $+ %n
elseif (%x) %t = $left(%t,%x) $+ %n $+ $right(%t,$calc(-%x))
else %t = %n $+ %t
}
elseif (%m isnum 20-29) {
;10% - delete char
var %x = $rand(1,%l)
%t = $left(%t,$calc(%x -1)) $+ $right(%t,$calc(-%x))
}
elseif (%m isnum 30-39) {
;10% - change char case
var %x = $rand(1,%l), %n = $mid(%t,%x,1)
%t = $left(%t,$calc(%x -1)) $+ $iif($isupper(%n),$lower(%n),$upper(%n)) $+ $right(%t,$calc(-%x))
}
elseif (%m isnum 40-64) {
;25% - switch two chars
var %x = $rand(1,$calc(%l -1)), %y = %x + 1
%t = $left(%t,$calc(%x -1)) $+ $mid(%t,%y,1) $+ $mid(%t,%x,1) $+ $right(%t,$calc(-%y))
}
elseif (%m isnum 65-99) {
;35% - change vowel
var %a = $replace(%t,e,a,i,a,o,a,u,a), %x = $pos(%a,a,$rand(1,$count(%a,a))), %b = $mid(%t,%x,1)
if (a !isin %a) continue
%a = $mid($remove(aeiou,%b),$rand(1,4),1)
%t = $left(%t,$calc(%x -1)) $+ $iif($isupper(%b),$upper(%a),%a) $+ $right(%t,$calc(-%x))
}
dec %w
}
%t = $replace(%t,$chr(160),$chr(32))
if ($isid) return %t
editbox -a %t
}
;==================================================================
;==================================================================
alias typos {
if ($1 == on) enable #typos
elseif ($1 == off) disable #typos
else echo $colour(i) *** typos are $+ $group(#typos)
}
#typos off
on *:input:@typo *:{
if (/me * iswm $1-) {
var %t = $typo(0,$2-)
describe $right($target,-6) %t
echo $colour(action) $target * $me %t
}
else {
var %t = $typo(0,$1-)
msg $right($target,-6) %t
echo $colour(own text) $target < $+ $me $+ > %t
}
halt
}
alias -l typowin var %typo = @typo $+ # | if ($window(%typo) == $null) window -ek0 %typo | return %typo
on ^*:text:*:#:echo $colour(normal) $typowin < $+ $nick $+ > $typo(0,$1-)
on ^*:action:*:#:echo $colour(action) $typowin * $nick $typo(0,$1-)
#typos end
;==================================================================
;==================================================================
; typo.mrc by Andy Dufilie
; http://pages.cthome.net/pdufilie/
;==================================================================