mIRC Home    About    Download    Register    News    Help

Print Thread
on input: "halt" doesn't work #154865 01/08/06 08:15 PM
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.
Re: on input: "halt" doesn't work #154866 01/08/06 08:26 PM
Joined: May 2005
Posts: 449
bwr30060 Offline
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.
Re: on input: "halt" doesn't work #154867 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

Re: on input: "halt" doesn't work #154868 01/08/06 09:23 PM
Joined: Sep 2003
Posts: 4,230
D
DaveC Offline
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

Re: on input: "halt" doesn't work #154869 01/08/06 09:42 PM
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 :)