All pastes #163149 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-09-07 06:52 UTC
rendered paste body
on 1:Input:*:{
  if (!$ctrlenter) && (!$cmdbox) && (($mid($1-,1,1) != /) || ($mid($1-,1,3) == /me) || ($mid($1-,1,9) == /describe) || ($mid($1-,1,4) == /say)) {    var %text [ $1- ]
    ; COLOR replacement (Ctrl+F color to replace it with colour if needed)
    var %eth 1
    var %curpos = $pos(%text,color,%eth)
    while (%curpos) {
      if ($curpos <= 1) || ($mid(%text,%curpos - 1,1) !isin /$) {
        ; Replace this occurrence of "color". But first see
        ; if this "color" is within "colors"...
        if ($mid(%text,$calc(%curpos + 5),1) == s) {
          %text = $left(%text,$calc(%curpos - 1)) $+ $clr($mid(%text,%curpos,6)) $+ $right(%text,$calc(-%curpos - 5))
        }
        ; Or "colorful"
        else if ($mid(%text,$calc(%curpos + 5),3) == ful) {
          %text = $left(%text,$calc(%curpos - 1)) $+ $clr($mid(%text,%curpos,8)) $+ $right(%text,$calc(-%curpos - 7))
        }
        else {
          %text = $left(%text,$calc(%curpos - 1)) $+ $clr($mid(%text,%curpos,5)) $+ $right(%text,$calc(-%curpos - 4))
        }
      }
      else {
        inc %eth
      }
      %curpos = $pos(%text,color,%eth)
    }

    var %dummy = $regsub(%text, /(\\\^\^\/)/g, $chr(3) $+ 15\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b(?<!dark )(bl(?:ue|[0o]{2}))\b/ig, $chr(3) $+ 12\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b(dark +bl(?:ue|[0o]{2}))\b/ig, $chr(3) $+ 2\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b(red)\b/ig, $chr(3) $+ 4\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b(pink(?: +sugar)?|magenta)\b/ig, $chr(3) $+ 13\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b(?<!lime )(green)\b/ig, $chr(3) $+ 3\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b(lime +green)\b/ig, $chr(3) $+ 9\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b((?:brow|maroo)n)\b/ig, $chr(3) $+ 5\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b(purple|violet)\b/ig, $chr(3) $+ 6\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b(orange)\b/ig, $chr(3) $+ 7\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b(yello[ew]|gold(?:en)?)\b/ig, $chr(3) $+ 8\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b(cyan|aqua(?:marine))\b/ig, $chr(3) $+ 11\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b(gr[ae]y(?:scale)?|silver)\b/ig, $chr(3) $+ 14\1 $+ $chr(3), %text)
    %dummy = $regsub(%text, /\b(teal)\b/ig, $chr(3) $+ 10\1 $+ $chr(3), %text)

    ; Rainbow -> color as a rainbow
    var %eth 1
    var %curpos = $pos(%text,rainbow,%eth)
    while (%curpos) {
      %text = $left(%text,$calc(%curpos - 1)) $+ $clr($mid(%text,%curpos,7)) $+ $right(%text,$calc(-%curpos - 6))
      inc %eth
      %curpos = $pos(%text,rainbow,%eth)
      haltdef
    }

    ; Skittles -> a rainbow
    var %eth 1
    var %curpos = $pos(%text,Skittles,%eth)
    while (%curpos) {
      %text = $left(%text,$calc(%curpos - 1)) $+ $clr($mid(%text,%curpos,8)) $+ $right(%text,$calc(-%curpos - 7))
      inc %eth
      %curpos = $pos(%text,Skittles,%eth)
    }
    ; ???? colored
    var %eth 1
    var %curpos = $pos(%text,???,%eth)
    while (%curpos) {
      %text = $left(%text,$calc(%curpos - 1)) $+ $clr($mid(%text,%curpos,8)) $+ $right(%text,$calc(-%curpos - 7))
      inc %eth
      %curpos = $pos(%text,????,%eth)
    }

    ; Output the result
    if ($mid($1-,1,3) == /me) || ($mid($1-,1,9) == /describe) || ($mid($1-,1,4) == /say) {
      %text
    }
    if ( $me == RedniC ) { say $chr(3) $+ 05 $+ $1- | halt }
    if ( $me == GreeniC ) { say $chr(3) $+ 03 $+ $1- | halt }
    if ( $me == Bl00niC ) { say $chr(3) $+ 12 $+ $1- | halt }

    else {
      say %text
    }
    haltdef
  }
}