mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2006
Posts: 97
O
Babel fish
OP Offline
Babel fish
O
Joined: Feb 2006
Posts: 97
I thought i saw it somewhere but can't find.
What i'm looking for is how to "watch" a few lines after a ON TEXT is triggerd for specific string (or not if it doesn't come)

Let's say 5 lines would be max to keep track of.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You'd have to set a variable, or something similar...

Code:
on *:text:*:#: {
  if ($1- == original trigger) { set %watch 1 }
  else inc %watch 1
  if ((what you're looking for isin $1-) && (%watch)) { do something }
  if (%watch > 5) { unset %watch }
}


Just as a note, you should probably consider a different variable name (something unique) so it doesn't conflict with other scripts. Also, you may want to specify the channel so it's not counting 5 lines from *any* channel.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2006
Posts: 97
O
Babel fish
OP Offline
Babel fish
O
Joined: Feb 2006
Posts: 97
Thanks for your input.
When some example is there it always looks more simple as i was thinking.
I'm going to modify it so it fit my needs also adding your advice about channel name.

Joined: Feb 2006
Posts: 97
O
Babel fish
OP Offline
Babel fish
O
Joined: Feb 2006
Posts: 97
@Riamus2

I was adding that part to my current script but needed to add it several times so i was thinking making it an alias, can that be done using { return } in it?

example
Code:
on *:text:*:#: {
  if (*sampletext* iswm $strip($1-)) { /watch | /nextstep }
}
alias watch {
  set %watch 1
  else inc %watch 1
  if ((what you're looking for isin $1-) && (%watch)) { return }
  if (%watch > 5) { unset %watch }
}

above piece looks like rubbish i think and isn't gonna work, or is it?

Last edited by ots654685; 21/04/08 06:49 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Yeah, you can use an alias... something like this probably:

Code:
on *:text:*:#: {
  Watch $1-
  if ((what you're looking for isin $1-) && (%watch)) { do something }
}

alias Watch {
  if ($1- == original trigger) { set %watch 1 }
  else inc %watch 1
  if (%watch > 5) { unset %watch }
}


This should give you the idea of how to do it for what you need. It may need some tweaking depending on what you're doing, if course.


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You're correct about it not working.
First off, and if you had tested your code you would've seen this error, you need an if before an else
Here's a suggestion
Code:
on *:text:*:#:{
  if (*sampletext* iswm $strip($1-)) {
    watch $nick $chan $1-
  }
}
alias watch {
  inc $+(%,watch,.,$1,.,$2)
  if $($+(%,watch,.,$1,.,$2),2) > 5 {
    unset $+(%,watch,.,$1,.,$2)
  }
  if (*sampletext2* iswm $3) && $($+(%,watch,.,$1,.,$2),2) {
    ;code to be executed if text is detected while being watched
  }
}

This will keep track of the lines entered on a nick by nick basis as well as a channel by channel basis. This type of tracking is handy for things like detecting who swears in what channels how many times.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You're getting too complicated for what the OP needs. The OP isn't testing specific nicks or channels... just a specific phrase. Also, as was mentioned to you previously, you do not need to send $nick or $chan to an alias. It's unnecessary.

You are also only incrementing the lines if the text is in the line, which isn't what was requested. The increment should happen every line of text in the channel.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard