mIRC Home    About    Download    Register    News    Help

Print Thread
Text Event with colon #232178 23/05/11 08:42 AM
Joined: May 2011
Posts: 3
N
Nikoleye Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: May 2011
Posts: 3
I am trying to use a text event that will trigger anytime someone posts an ip address in the channel, but if i use a colon in the text parsing slot it will break....

ON *:TEXT:*ipaddresshere*:*: {
set %ipline $1-
}

Honestly I was origonally just going to make it save the current line ($1-) anytime someone had a colon in it, but basically i want any arbitrary ip to trigger the event....

this is my first time scripting so i have been unsure how to do so

your help is appreciated!

-Nick

Re: Text Event with colon [Re: Nikoleye] #232188 23/05/11 06:29 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Code:
on *:text:*:#:{
  var %i = 1
  while ($eval($ $+ %i,2) != $null) {
    if ($iptype($strip($v1))) { do stuff... }
    inc %i
  }
}

Re: Text Event with colon [Re: hixxy] #232204 23/05/11 09:51 PM
Joined: May 2011
Posts: 3
N
Nikoleye Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: May 2011
Posts: 3
actually sorry the colon isn't really relevant...

the ip address would be something like 172.16.254.1

I tried your code and it actually freezes up IRC, i don't really understand the code very well...




Re: Text Event with colon [Re: Nikoleye] #232210 24/05/11 12:12 AM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
As to the freezing maybe something got mixed up on your side - either while pasting the code, or while modifying it?
As to understanging hixxys code just ask what particular part of troubles you if the comments below don't help smile
Code:
; text event, no specific matchtext
on *:text:*:#:{

  ; loop all the $N "words" of text $1-
  var %i = 1
  while ($eval($ $+ %i,2) != $null) {

    ; check the "word" (with control codes stripped) for being a valid IP
    if ($iptype($strip($v1))) {

      ; if so, do stuff (like echo, check further, save...).
      ; $v1 is now the IP-type, and $strip($eval($ $+ %i,2)) will be the IP itself 
      echo -a "Word" No. %i is a $v1 IP address: $strip($eval($ $+ %i,2))

    }
    inc %i
  }
}


Re: Text Event with colon [Re: Horstl] #232213 24/05/11 12:49 AM
Joined: May 2011
Posts: 3
N
Nikoleye Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: May 2011
Posts: 3
the if statement is never evaluating to be true... when i post an ip for example:

; text event, no specific matchtext
on *:text:*:#:{

; loop all the $N "words" of text $1-
var %i = 1
while ($eval($ $+ %i,2) != $null) {

; check the "word" (with control codes stripped) for being a valid IP
if ($iptype($strip($v1))) {

; if so, do stuff (like echo, check further, save...).
; $v1 is now the IP-type, and $strip($eval($ $+ %i,2)) will be the IP itself
.msg $chan if statement is true!

}
inc %i
}
}

Last edited by Nikoleye; 24/05/11 12:49 AM.
Re: Text Event with colon [Re: Nikoleye] #232214 24/05/11 01:02 AM
Joined: Nov 2006
Posts: 1,559
H
Horstl Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Do you use an older mIRC version? $iptype was introduced in v7.0.

Re: Text Event with colon [Re: Nikoleye] #232230 25/05/11 03:53 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Just so you know, if you ever have trouble because a character you need to parse or whatever is a character mIRC uses for a delmiter or command prefix or whatever, all y ou have to do is use the $chr equivalent.

: = $chr(58)

You can use $asc to fine the character value. $asc(:) = 58.