mIRC Home    About    Download    Register    News    Help

Print Thread
#207084 05/12/08 06:23 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
A script I'm working on performs /ison for one or more nicks.
The return from /ison is a space separated list.
The names I'm checking are stored in a comma separated list.
Currently I'm using the following code to check if one or more of the nicks returned from the /ison are in the comma separated list.
Code:
on *:snotice:ison*:{
  if $replace($2-,$chr(32),*) iswm $hget(Invite,$+($network,.,%invite.channel,.Invites)) {
    .msg $replace($2-,$chr(32),$chr(44)) $hget(Invite,$+($network,.,%invite.channel,.Decline))
    haltdef
  }
}

What I would like to do is to ensure that there's an exact match of the nick(s) returned from the /ison in the hash table

something like going through the list of nicks that are returned from the /ison and checking if the nick is in the hash table entry, as a $istok would do.

Just thought of this code as I was writing this post.
Code:
on *:snotice:ison*:{
  tokenize 32 $2-
  var %a = 1, %b = $0
  while %a <= %b {
    if $istok($hget(Invite,$+($network,.,%invite.channel,.Invites)),$($+($,%a),2),44) {
      ;send message
      %a = %b 
    }
    inc %a
  }
}


While this looks like it would work, and I'll test it later, if someone has an alternative suggestion, or can see why this wouldn't work, I'd appreciate hearing.

RusselB #207087 05/12/08 03:10 PM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I'm not sure exactly what you are asking for here. It sounds like you want to make sure that every space-delimited nick in %ison.return is present in comma-delimited %invite.list .

If that is the case, your code should work, in theory. You could use a single regex to show that each of the names in %ison.return is in %invite.list, but you wouldn't be able to act on the fact that each individual nick is in the list.

-genius_at_work

RusselB #207088 05/12/08 07:09 PM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
I only wonder why you /tokenize the ison reply first. I'd have framed it like:
Code:
; or raw 303 (?)

on *:snotice:ison*:{
  var %i = $hget(Invite,$+($network,.,%invite.channel,.Invites)), %n = 1
  while ($gettok($2-,%n,32)) {
    if ($istok(%i,$v1,44)) { 
      ; send message to $gettok($2-,%n,32) 
    }
    inc %n
  }
}

Last edited by Horstl; 05/12/08 07:19 PM.

Link Copied to Clipboard