mIRC Homepage
Posted By: rennir 1:INPUT:*: Event Script seeking review. - 18/01/04 03:49 PM
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
Posted By: Iori Re: 1:INPUT:*: Event Script seeking review. - 18/01/04 11:17 PM
If this is stuff you paste from clipboard, you might like to try //play -b $active 1500
/help /play
Also $cb and $cb(n) /help $cb
Posted By: rennir Re: 1:INPUT:*: Event Script seeking review. - 19/01/04 12:51 AM
No no this is all typed into the main window at real time. so it's not like I'm copying 2000 characters into the input and it fails, it's just when I type in 1000 characters, it seems to instantly stop, dump and complain. A very wierd behavior with the way input is controled. But let me look up that which you just brought up, thanks.

Rennir
© mIRC Discussion Forums