mIRC Home    About    Download    Register    News    Help

Print Thread
1:INPUT:*: Event Script seeking review. #68418 18/01/04 03:49 PM
Joined: Jan 2004
Posts: 10
R
rennir Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Jan 2004
Posts: 10
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

Re: 1:INPUT:*: Event Script seeking review. #68419 18/01/04 11:17 PM
Joined: Aug 2003
Posts: 1,831
I
Iori Offline
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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

Re: 1:INPUT:*: Event Script seeking review. #68420 19/01/04 12:51 AM
Joined: Jan 2004
Posts: 10
R
rennir Offline OP
Pikka bird
OP Offline
Pikka bird
R
Joined: Jan 2004
Posts: 10
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