Code:
on 1:input:*: { 
  %usertext  = $1-
  %textlen   = $len(%usertext)
  %firsttime = 1
  if (%textlen > 400) {
    while (%textlen > 400) { 
      %pos = 400 
      :loop 
      if %pos < 370 goto end | 
      %chara = $mid(%usertext, %pos, 1) 
      if $asc(%chara) == 32 goto end | 
      %pos = %pos - 1 
      goto loop 
      :end 
      %outtext = $left(%usertext, %pos - 1) 
      if (%firsttime == 0) { 
        /say <-cont-> %outtext <-next-> 
      }
      if (%firsttime == 1) { 
        %prefix = $left(%outtext, 4) 
        %mtch = { /me  } 
        if (%prefix == %mtch) {
          %outtext <-next->
        } 
        if (%prefix != %mtch) {
          /say %outtext <-next->
        }
        %firsttime = 0 
      } 
      %cuttext  = $remove(%usertext, %outtext) 
      %usertext = %cuttext
      %textlen  = $len(%usertext)
    } 
    /say <-cont-> %usertext <-end->
    /halt
  }
}  


I really could use some help here optimizeing this script. I'm a coder, but never really worked with mIRC scripts before, which seems very touchy about just what your doing.

What this script does: Cuts up your input into multiple enteries if it finds your single entery to be too large to send to the server in one pass, It also tags on <-Next-> <-cont-> and <-end-> tags to tell the other readers if the authors post indeed is a multi-part post. The script also prevents the default posting action from takeing place so that the author can see how his posting truely looks like to all users on the recieveing end.

Please, help me optimize this script. It seems so very rough right now around the edges and i'm afraid it may not work for anything but /say and /me commands. I want it to be more generic then that if possable.

Rennir