Random Text

By vegeto079 on Mar 08, 2008

This script will make you type in random capitalization, colors, underlines, and bold.

Typing in any new colors will not override the script.
Typing in underlines will invert it; meaning lines that have been chosen to be underlined will now not be, and vice versa. This is the same with bold.
Typing in bold: see typing in underlines.
Typing in caps will force the letter to be capitalized regardless of the script
Typing in lowercase will make the letter either be capitalized or lowercase, by randomization.
For example:
Typing HELlo everyONE
HEL and ONE will, no matter what, be capitalized, but lo and every may or may not be capitalized.

Type /random in any window and it will turn on (or off) the Random Text script and notify you.
Type /random [channel] and that channel (no others, unless you specify that they will be) will be in random
Type /random [on/off] and it will turn it on/off and notify you.

Warning: This script is very 'edgey' when it comes to background colors other than white (black, as a prime example), so please read the following
To change the script to not show black as a color, and have characters that are meant to be black turned into a random color, the script will be in 'brite' mode. This will made the script, of course, a lot brighter, but easier to see on a black background.
/changerandom brite - changes to brite mode
/changerandom light - see above
/changerandom lite - see above
/changerandom bright- see above

/changerandom normal - changes to normal mode
/changerandom dark - see above
/changerandom black - see above
/changerandom white - see above

/changerandom - toggle which mode you are using

Updates to come. Please post comments/criticism/help/etc

alias changerandom {
  if ($1 == $null) && (%briterandom != yes) {
    set %briterandom yes
    echo -a 13,1Random Text script is now on 1,13Brite Mode
    halt
  }
  if ($1 == $null) && (%briterandom != no) {
    set %briterandom no
    echo -a 13,1Random Text script is now on 1,13Normal Mode
    halt
  }
  if ($1 == brite) || ($1 == light) || ($1 == lite) || ($1 == bright) {
    set %briterandom yes
    echo -a 13,1Random Text script is now on 1,13Brite Mode
    halt
  }
  if ($1 == normal) || ($1 == dark) || ($1 == black) || ($1 == white) {
    set %briterandom no
    echo -a 1,13Random Text script is now on 13,1Normal Mode
    halt
  }
}
alias random {
  if ($1 == yes) || ($1 == on) {
    set %randomtext on
    goto halt
  }
  if ($1 == no) || ($1 == off) {
    unset %randomtext
    goto halt
  }
  if (%# == $left($1,1)) {
    if ($2 == yes) || ($2 == on) {
      set %randomtext [ $+ [ $1 ] ] on
      set %random on
      goto halt
    }
    if ($2 == no) || ($2 == off) {
      unset %randomtext [ $+ [ $1 ] ]
      unset %random
      goto halt
    }
    if ($2 == $null) {
      if (%randomtext [ $+ [ $1 ] ] == $null) {
        set %randomtext [ $+ [ $1 ] ] on
        set %random on
        goto halt
      }
      if (%randomtext [ $+ [ $1 ] ] == on) {
        unset %randomtext [ $+ [ $1 ] ]
        unset %random
        goto halt
      }
    }
  }
  if ($1 == $null) {
    if (%randomtext == $null) {
      set %randomtext on
      goto halt
    }
    if (%randomtext != $null) {
      unset %randomtext
      goto halt
    }
  }
  :halt
  if (%# == $left($1,1)) && (%random == on) {
    echo -a 13,1Random Text Now On For $1 $+ 
    goto halt2
  }
  if (%# == $left($1,1)) && (%random == $null) {
    echo -a 13,1Random Text Now Off For $1 $+ 
    goto halt2
  }
  if (%randomtext == on) {
    echo -a 13,1Random Text Now On
    goto halt2
  }
  if (%randomtext == $null) {
    echo -a 13,1Random Text Now Off
    goto halt2
  }
  :halt2
  unset %random
  halt
}
on *:input:#:{
  if (/ == $left($1,1)) { $1- | HALT }
  haltdef
  set %say $1-
  if (%randomtext [ $+ [ $chan ] ] != $null) || (%randomtext != $null) {
    set %random.max $len($1-)
    set %random.inc 0
    set %random.inc2 0
    :again
    set %random.inc2 0
    inc %random.inc
    set %random.letter $mid(%say,%random.inc,1)
    if (%random.letter == $null) {
      set %random.letter %random.letter $+ -
      goto again3
    }
    if (%random.letter == $chr(32)) {
      set %random.letter %random.letter $+ -
      goto again3
    }
    :again2
    inc %random.inc2
    set %random.1 $rand(0,6)
    if (%random.letter isnum) {
      set %random.1 $rand(0,3)
    }
    if (%random.1 > 3) {
      set %random.2 $rand(02,28)
      if (%random.2 == 15) || (%random.2 == 08) || (%random.2 == 09) || (%random.2 == 11) {
        goto again2
      }
      if (%random.2 > 15) {
        ;black - brite script changes
        set %random.2 1
        if (%briterandom == yes) {
          set %random.2 $rand(2,15)
        }
      }
    }
    if (%random.1 == 0) {
      ;random caps
      if (%random.letter isupper) {
        set %random.letter $capsdown(%random.letter)
      }
      if (%random.letter islower) {
        set %random.letter $capsup(%random.letter)
      }
      if (%random.inc2 < 5) {
        goto again2
      }
    }
    if (%random.1 == 1) {
      ;bold
      set %random.letter  $+ %random.letter $+ 
      if (%random.inc2 < 5) {
        goto again2
      }
    }
    if (%random.1 == 2) {
      ;underlined
      set %random.letter  $+ %random.letter $+ 
      if (%random.inc2 < 5) {
        goto again2
      }
    }
    if (%random.1 == 3) {
      ;nothing
      if (%random.inc2 < 5) {
        goto again2
      }
    }
    if (%random.1 > 3) {
      ;color
      if (%random.2 != 1) {
        set %random.letter  [ $+ [ %random.2 ] ] $+ %random.letter $+ 
      }
      if (%random.inc2 < 5) {
        goto again2
      }
    }
    :again3
    if (%random.inc == 1) {
      set %random.say %random.letter
      goto again
    }
    set %random.say %random.say $+ %random.letter
    if (%random.inc == %random.max) || (%random.inc > %random.max) {
      goto end
    }
    goto again
    :end
    set %random.say $replace(%random.say,-,$chr(32))
    set %say %random.say
    unset %random.*
  }
  msg $chan %say
  halt
}
alias capsup {
  return $replace($1-,a,A,b,B,c,C,d,D,e,E,f,F,g,G,h,H,i,I,j,J,k,K,l,L,m,M,n,N,o,O,p,P,q,Q,r,R,s,S,t,T,u,U,v,V,w,W,x,X,y,Y,z,Z)
}
alias capsdown {
  return $replace($1-,A,a,B,b,C,c,D,d,E,e,F,f,G,g,H,h,I,i,J,j,K,k,L,l,M,m,N,n,O,o,P,p,Q,q,R,r,S,s,T,t,U,u,V,v,W,w,X,x,Y,y,Z,z)
}

Comments

Sign in to comment.
Checkers   -  Dec 12, 2009

Clean code, nice job.

 Respond  
Matt888   -  Nov 29, 2008

Works fine, It would be nice to have a menu instead of having to remember all the aliases. Other than that, it's great.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.