mIRC Home    About    Download    Register    News    Help

Print Thread
On input event. #180362 08/07/07 09:41 AM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
Yea I'm having problems.

Modified script.

Code:
on *:input:*: {
  if (/* !iswm $1) {
    if ($1 != seen) {
      /write something to file.txt | /HALT
The /HALT above I had to add to fix the problem...
Code:
    }
    if ($1 == seen) && ($2) && ($3 == $null) { 
      /meseen $me $active $2
    }
    if ($1 == seen) && ($2) && ($3 != $null) && ($4 == $null) {
      if ($left($3,1) == $chr(35)) {
        /seenchannel $me $chan $2 $3
      }
      if ($left($3,1) != $chr(35)) {
        /THIS_ALIAS_IS_TRIGGERED $me $chan $2 $3
        ;BUT DOES $1 == SEEN IF I TYPE . ?
        ;WHY DOES EVERYTHING ELSE TRIGGER HERE?
      }
    }
    if ($1 == seen) && ($2) && ($3 != $null) && ($4 != $null) && ($5 == $null) {
      /seenchannelnetwork $me $chan $2 $3 $4
    }
    if ($1 == seen) && ($2) && ($3 != $null) && ($4 != $null) && ($5 != $null) {
      /seentext $me $chan $2 $3 $4 $5-
    }
  }
  if (/* iswm $1) {
    if ($1 == /me) {
      /write something to file.txt | /halt
    }
  }
}


See the capital /HALT? If I remove that, and I start typing, this is what happens.

[July 08 2007 Sunday 04:16:49 AM] <Neal> >.
[July 08 2007 Sunday 04:16:49 AM] <Neal> Neal: I've never seen talk on the IRC network before.
[July 08 2007 Sunday 04:16:52 AM] <Neal> .
[July 08 2007 Sunday 04:16:52 AM] <Neal> Neal: I've never seen talk on the IRC network before.
[July 08 2007 Sunday 04:18:02 AM] <Neal> Seen test.
[July 08 2007 Sunday 04:18:02 AM] <Neal> Neal: I've never seen test in #channel's before.

The aliases (/THIS_ALIAS_IS_TRIGGERED) are triggered.

And so, adding the /HALT stops it. But then, if I have the halt...

I can't type <

But I can type >

Why's that? A bug?

And I don't want to /HALT at the beginning.

So when I type anything besides /* or seen, /THIS_ALIAS_IS_TRIGGERED is triggered, and I had to add the /halt to prevent it, but then, nothing happens if I type > in a channel (but typing < works).

Any ideas what's wrong?

The if statements clearly state that $1 has to be seen, but if I type some other words besides seen, that alias is still triggered, but it shouldn't.

mIRC 6.21.

-Neal.

Re: On input event. [Re: LostShadow] #180368 08/07/07 01:06 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Code:
on *:input:*: {
  if ($1 == seen) {
    if ($2) && ($3 == $null) { 
      meseen $me $active $2
    }
    elseif ($3) && ($4 == $null) {
      if ($left($3,1) == $chr(35)) {
        seenchannel $me $chan $2-
      }
      elseif ($left($3,1) != $chr(35)) {
        /THIS_ALIAS_IS_TRIGGERED $me $chan $2-
      }
    }
    elseif ($4) && ($5 == $null) {
      seenchannelnetwork $me $chan $2-
    }
    else {
      seentext $me $chan $2-
    }
  }
  elseif (/me == $1) {
    write something to file.txt
  }
  if ($1 != seen) {
    write something to file.txt
  }
}


That should work for you. It's cleaned up to remove a lot of unnecessary code. You should always use ELSEIF/ELSE when possible as it increases script speed since the script doesn't have to check every single IF. Also, there's no reason to keep checking $1 when you can do it as shown above.

Note that you may be able to combine the last 2 parts (/me and != seen) if the /write is the same for both.


Invision Support
#Invision on irc.irchighway.net
Re: On input event. [Re: Riamus2] #180413 09/07/07 05:10 AM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
My point wasn't so much to rearrange everything as much as find out what the problems are. I don't see why in my original input code, I can't type < but I can type a >. And then, I also can't /me anything.

Re: On input event. [Re: LostShadow] #180420 09/07/07 08:25 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
sometimes, and I suspect this is the case here, a problem is unable to be spotted (directly identified), yet a small re-arrangement of the code is sufficient to remove the problem.

Re: On input event. [Re: RusselB] #180436 09/07/07 07:12 PM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
Ah okay. That's why I originally put it in the bug forums.

If you have something like (in simplest forms).

on *:input:*: {
if ($1 == this) { do this }
}

And I wish that would work perfectly if you typed something else instead.

Re: On input event. [Re: LostShadow] #180448 09/07/07 09:19 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I don't know what you're getting, but I tried it in this form
Code:
on *:input:*:{
  if ($1 == this) {
    echo -a This
  }
  else {
    echo -a That
  }
}

and it worked exactly as I expected.

Re: On input event. [Re: RusselB] #180449 09/07/07 09:35 PM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
I didn't use an else. My point was was to not use else.

Or should I use..

else { / }

?

Re: On input event. [Re: LostShadow] #180452 09/07/07 09:58 PM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
Originally Posted By: LostShadow

Code:
  if (/* iswm $1) {
    if ($1 == /me) {
      /write something to file.txt | /halt
    }
  }


Found an alternate to fix that. Before, /me doesn't output to channel.
Code:
  if (/* iswm $1) {
    if ($1 == /me) {
      /write something to seen.txt | /describe $active $2- | /halt
    }
  }


Why /describe $active $2-?

If it was /describe $active $1-, and I typed /me test, I get.

* Neal /me test.

So with /describe $active $2-, /me test becomes.

* Neal test.

Re: On input event. [Re: LostShadow] #180453 09/07/07 10:09 PM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline OP
Fjord artisan
OP Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
Oh okay my apologies to everyone. I found out the problem, I didn't add /say $1- after /write to text. But I didn't need that since I have another on input event. It was the other on input event that blocked me from saying < at the start of the line (so my grammar script would not edit logs).

Now my only problem is why is This_Alias_Triggers trigger when I type "test" for if I didn't add the original halt. But that's fine, I'll just have the unnecessary /halt...

It's like..

So I type test..

on input {
if ($1 != seen) { /write }
if ($1 == seen) { typing test goes through here but it shouldn't.. }
}

So adding a unnecessary /halt after /write solves it, which should be fine for me..

Last edited by LostShadow; 09/07/07 10:11 PM.
Re: On input event. [Re: LostShadow] #180467 10/07/07 01:01 AM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Originally Posted By: LostShadow
It's like..

So I type test..

on input {
if ($1 != seen) { /write }
if ($1 == seen) { typing test goes through here but it shouldn't.. }
}


That shouldn't happen and doesn't happen here. Below is my exact test using your example:

Code:
on *:input:*: {
  if ($1 != seen) { echo -a hi }
  if ($1 == seen) { echo -a bye }
}


Typing "test" will echo "hi", which it should do. If you are getting something different, then there's a good chance that you have a different on INPUT script that is causing it somehow.


Invision Support
#Invision on irc.irchighway.net