home *** CD-ROM | disk | FTP | other *** search
/ napalm.napnet.hu / 2015-02-12.napalm.napnet.hu.tar / napalm.napnet.hu / programok / kommunikacio / mpp700.exe / formatstr.mrc < prev    next >
Text File  |  2002-10-03  |  4KB  |  150 lines

  1. on *:start:{
  2.   ^formatstr.loadprofiles
  3. }
  4.  
  5.  
  6. alias ^formatstr.version { return 2.2a }
  7.  
  8. alias ^formatstr.help { run $scriptdirformatStr.hlp }
  9.  
  10. alias ^formatstr.loadprofiles {
  11.   $iif($hget(^formatstr.profiles),hfree ^formatstr.profiles)
  12.   echo -s Loaded $findfile($scriptdirProfiles,*.hsh,0,0, loadprofile.appendtomaster $1-) FormatString Profile(s)
  13. }
  14.  
  15. alias -l loadprofile.appendtomaster {
  16.   $iif(!$hget(^formatstr.profiles),hmake ^formatstr.profiles 100)
  17.   hload ^formatstr.profiles " $+ $1- $+ "
  18.   hadd ^formatstr.profiles profiles $addtok($hget(^formatstr.profiles,profiles),$hget(^formatstr.profiles,_name),44)
  19.   echo -s Loaded $hget(^formatstr.profiles,_name) profile for the Phoenix FormatString Parser
  20.   hdel ^formatstr.profiles _name
  21. }
  22.  
  23. alias parse_formatstr {
  24.   ; $1 == word to format
  25.   ; $2 == format string
  26.  
  27.   var %counter = 1
  28.   %formattedstr = $2
  29.   while (%counter <= $hget(^formatstr.profiles,0).item) {  
  30.     %formattedstr = $replace(%formattedstr,$hget(^formatstr.profiles,%counter).item,$eval($hget(^formatstr.profiles,$hget(^formatstr.profiles,%counter).item),2))
  31.     inc %counter
  32.   }
  33.   %formattedstr = $regex_stylefn(%formattedstr)
  34.   if ($nickComp(stripcolor)) { %formattedstr = $strip(%formattedstr,c) }
  35.   return %formattedstr $+ 
  36. }
  37.  
  38. alias -l ^R {
  39.   ;RandomStyle
  40.  
  41.   %counter = 1
  42.   unset %randomstyle_output
  43.   while (%counter <= $len($1-)) {
  44.     %randomstyle_code = $gettok(>>,$rand(1,3),62)
  45.     ;$iif(%randomstyle_code == , %randomstyle_code = %randomstyle_code $+ $rand(0,15))
  46.     %randomstyle_output = %randomstyle_output $+ %randomstyle_code $+ $iif($mid($1-,%counter,1) == $chr(32),$chr(1),$mid($1-,%counter,1))
  47.     inc %counter
  48.   }
  49.   return $replace(%randomstyle_output,$chr(1),$chr(32)) $+ 
  50. }
  51.  
  52. alias -l ^C {
  53.   ;CycleStyle
  54.  
  55.   %counter = 1
  56.   unset %cyclestyle_output
  57.   while (%counter <= $len($1-)) {
  58.     %cyclestyle_code = $gettok(>>,$calc((%counter % 3) + 1),62)
  59.     %cyclestyle_output = %cyclestyle_output $+ %cyclestyle_code $+ $iif($mid($1-,%counter,1) == $chr(32),$chr(1),$mid($1-,%counter,1))
  60.     inc %counter
  61.   }
  62.   return $replace(%cyclestyle_output,$chr(1),$chr(32)) $+ 
  63. }
  64.  
  65. alias -l ^M {
  66.   ;RandomCase
  67.  
  68.   %counter = 1
  69.   unset %randomcase_output
  70.   while (%counter <= $len($1-)) {
  71.     %randomcase = $rand(1,2)
  72.     if (%randomcase == 1) {
  73.       %randomcase_output = %randomcase_output $+ $iif($mid($1-,%counter,1) == $chr(32),$chr(1),$upper($mid($1-,%counter,1)))
  74.     }
  75.     else {
  76.       %randomcase_output = %randomcase_output $+ $iif($mid($1-,%counter,1) == $chr(32),$chr(1),$lower($mid($1-,%counter,1)))
  77.     }
  78.     inc %counter
  79.   }
  80.   return $replace(%randomcase_output,$chr(1),$chr(32))
  81. }
  82.  
  83. alias -l ^N {
  84.   ;CycleCase
  85.  
  86.   %counter = 1
  87.   unset %cyclecase_output
  88.   while (%counter <= $len($1-)) {
  89.     inc %cyclecase
  90.     if ($calc(%cyclecase % 2) == 1) {
  91.       %cyclecase_output = %cyclecase_output $+ $iif($mid($1-,%counter,1) == $chr(32),$chr(1),$upper($mid($1-,%counter,1)))
  92.     }
  93.     else {
  94.       %cyclecase_output = %cyclecase_output $+ $iif($mid($1-,%counter,1) == $chr(32),$chr(1),$lower($mid($1-,%counter,1)))
  95.     }
  96.     inc %counter
  97.   }
  98.   return $replace(%cyclecase_output,$chr(1),$chr(32))
  99. }
  100.  
  101. alias -l ^U {
  102.   return $upper($1-)
  103. }
  104.  
  105. alias -l ^L {
  106.   return $lower($1-)
  107. }
  108.  
  109. alias -l ^E {
  110.   ;l33tstyle
  111.  
  112.   %leetstyle =  $replacecs($1-, $&
  113.     AE,$chr(198), $&
  114.     f,F, F,ph, $&
  115.     ck,x0r, $&
  116.     cks,x0rz $&
  117.     )
  118.   %leetstyle = $replacecs(%leetstyle, $&
  119.     a,A, A,4, $&
  120.     B,$chr(223), $&
  121.     c,$chr(162), C,$chr(169), $&
  122.     d,D, D,| $+ $chr(41), $&
  123.     e,E, E,3, $&
  124.     H,$chr(124) $+ - $+ $chr(124), $&
  125.     i,I, I,1, $&
  126.     K,$chr(124) $+ $chr(139), $&
  127.     l,L, L,$chr(163), $&
  128.     M,$chr(40) $+ \/ $+ $chr(41), $&
  129.     N,$chr(124) $+ \ $+ $chr(124), $&
  130.     o,$chr(248), O,0, $&
  131.     p,P, P,$chr(182), $&
  132.     Q,$chr(40) $+ $chr(44) $+ $chr(41), $&
  133.     S,5, $&
  134.     t,+, T,7, $&
  135.     u,$chr(181), U,$chr(124) $+ _ $+ $chr(124), $&
  136.     W,`//, $&
  137.     x,$chr(215) $&
  138.     )
  139.   return %leetstyle
  140. }
  141.  
  142. alias -l regex_stylefn {
  143.   .echo -q $regsub($1-,/\\}/g,$chr(1),%stylefn)
  144.   %stylefn = $replace(%stylefn, $chr(32),$chr(5))
  145.   while ($regex(%stylefn,/{([CRULMNE]):(.*?):\1}/i)) {
  146.     .echo -q $regsub(%stylefn,/{([CRULMNE]):(.*?):\1}/gi,$chr(32) $+ $cr $lf $+ \1(\2) $cr $+ $chr(32),%stylefn)
  147.   }
  148.   return $replace($eval($replace(%stylefn, $cr,$!+, $lf,$!^, $chr(1),$chr(125)),2),$chr(5),$chr(32))
  149. }
  150.