mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2006
Posts: 50
T
Tw33ty Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Mar 2006
Posts: 50
Code:
on *:input:*:{
  var %i = 1 
  while (%i <= $nick($chan,0)) { 
    if ($left($1,1) != /) && (!$ctrlenter) && ($active != Status Window) && ($status = connected) && ($1 == $nick($chan,%i)) { 
      say my stuffs here | halt
    } 
    inc %i
  } 
}


Everytime I type sumth, there appear two lines, instead of the mainstuff. What's wrong with the code?

Last edited by Tw33ty; 01/08/06 08:22 PM.
Joined: May 2005
Posts: 449
Fjord artisan
Offline
Fjord artisan
Joined: May 2005
Posts: 449
Code:
on ^*:input:*:{
  var %i = 1 
  while (%i <= $nick($chan,0)) { 
    if ($left($1,1) != /) && (!$ctrlenter) && ($active != Status Window) && ($status = connected) && ($1 == $nick($chan,%i)) { 
      say my stuffs here | haltdef
    } 
    inc %i
  } 
}


EDIT-- Forget that. My changes didn't work for me. Am I understanding your code (or what you want) correctly? It looks like it should do stuff if the first word you typed is a nickname in the channel.

Last edited by bwr30060; 01/08/06 08:33 PM.
Joined: Mar 2006
Posts: 50
T
Tw33ty Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Mar 2006
Posts: 50
doesn't work

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
(1) your codes written badly, the initial 4 conditions should not be in the while loop
Code:
on *:input:*:{
  if ($left($1,1) != /) && (!$ctrlenter) && ($active != Status Window) && ($status == connected) && ($chan)) { 
    var %i = 1| while (%i <= $nick($chan,0)) { if ($1 == $nick($chan,%i) { say my stuffs here | halt } | inc %i } 
  }
}


(2) Even more of a problem is that your actually looping at all and doing a INPUT:*
Code:
on *:input:#:{ if ($left($1,1) != /) && (!$ctrlenter) && ($1 ison $chan)) { say my stuffs here | halt } }
;or even just 
on *:input:#:{ if ((!$ctrlenter) && ($1 ison $chan)) { say my stuffs here | halt } }


(3) Its likely the line appears twice becuase some other script also has an on input
locate it and add the & directive

Joined: Mar 2006
Posts: 50
T
Tw33ty Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Mar 2006
Posts: 50
Quote:
(3) Its likely the line appears twice becuase some other script also has an on input
locate it and add the & directive


That was the problem.
Thank you very much :)


Link Copied to Clipboard