Username:
Password:
  Home About Us Articles Rules Script Library FAQ Help
Not logged in (register
Pig Latin for mIRC

Last Modified: Sep 08 3:41am

alias pig {
  msg $chan $piglatin($1-)
}

alias mepig {
  describe $chan $piglatin($1-)
}

alias piglatin {
  var %i 1 
  var %s
  var %fv 
  var %t 
  var %cap
  var %word
  while ($gettok($1-,%i,32) != $null) { 
    %t = $ifmatch
    %fv = $calc($FirstVowel(%t) - 1)
    %cap = $false 
    if ( %fv > 0 ) {
      if ( $left(%t,1) === $upper($left(%t,1)) ) {
        %cap = $true
      } 
      %word = $lower($right(%t, $calc($len(%t) - %fv)) $+ $left(%t,%fv - 1) $+ ay)
      if (%cap == $true) {
        %word = $upper($left(%word,1)) $+ $right(%word,$calc($len(%word) - 1))
      }
      %s = %s %word
    }
    else {
      %s = %s %t
    }
    inc %i
  } 
  return %s
}

alias FirstVowel {
  var %i 1
  var %t
  while ( %i < $len($1) ) {
    %t = $mid($1,%i,1)
    if ( %t == a || %t == e || %t == i || %t == o || %t == u ) {
      return %i
    } 
    inc %i
  }
  return 0
}

Comments
Franimus
Oct 19 10:05pm
if ( $left(%t,1) === $upper($left(%t,1)) ) {

^that should only be == not ===
it's the first nested if statement in alias piglatin

elsewise it looks like it works to me
Franimus
Oct 19 10:14pm
oh, and are all words that start with a vowel supposed to be unchanged?
Franimus
Oct 19 10:14pm
i'm so forgetful... i forgot to mention punctuation! it puts commas in the middle of the word
 
All content Copyright © 2004 - 2008 UtoNet IRC Network
UtoNet is sponsored and hosted by Datinix Systems