mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
hello again,

i'm trying to find out out why this alias wont work..

Code:
alias nickfind { 
  if ($hfind(usertrack,$1,0,W),$1,32) { 
    return $remtok($hget(usertrack,$hfind(usertrack,$1,W)),$1,1,32) 
  } 
} 
  


i can't figure this out.. it's supposed to locate the match text and list the remianing portion w/o the initial target match.. but all i get is nothing..

can anyone help with this??

Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
heh, sorry i posted the wrong version of the alias..

Code:
nickfind { 
  if ($hfind(usertrack,$1,0,W)) { 
    return $remtok($hget(usertrack,$hfind(usertrack,$1,0,W).data),$1,1,32) 
  } 
} 
  

this is the one correct one blush

Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Hello guys!

Hey clutz mate, not too sure what you meant. Here's a little alias I come up with.

Code:
alias nickfind {
  if ($hfind(usertrack,$1,0,W)) { 
    var %x = $hget(usertrack,0).item
    while (%x) {
      var %nicks = $remtok($addtok(%nicks,$hget(usertrack,%x).item,32),$1,32)
      dec %x
    }
    echo -a $1 removed from %nicks
  }
}


Supposing we have 7 items in our table.

Bob
Roger
Tom
Andy
Clutz
Jim
Elvis

If $1 is matched it puts all the nicknames on one line stored in a var (%nicks) removes $1 (matched nick) and would look like clutz removed from Elvis Jim Andy Tom Roger Bob

/nickfind <nick>

Hope this is what you wanted or helped in some way.
Nice seeing you again.

All the best,

-Andy

Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
hey! hows canada?... enjoying it i hope.. cool

well, the thing is that it's supposed to search the value for the match. since the item is the users address, it the main portion of the script stores the associated nicks that it sees linked to that address. so, i'm looking at just the item values right now for my results..
and what i'm actually doing is this:
Code:
ON *:START: {
  if !$hget(usertrack) { .hmake usertrack 100 }
  if ($isfile($mircdirtrackusers.hsh)) {
    .hload usertrack $mircdirtrackusers.hsh
  }
}
on *:JOIN:#: {
  if ($hget(usertrack,$address($nick,3))) {
    var %n = $ifmatch
    if ($istok(%n,$nick,32)) { var %d = $deltok(%n,$findtok(%n,$nick,1,32),32) }
    else { var %d = %n }
    if (!%d) { return }
    alert 
    if $dialog(alert_info) { did -a alert_info 1 $nick | didtok alert_info 2 32 %d }
    if (!$istok(%n,$nick,32)) {
      .hadd usertrack $address($nick,3) %n $nick
    }
  }
  else {
    .hadd usertrack $address($nick,3) $nick
  }
}
on *:NICK: {
  if ($hget(usertrack,$address($newnick,3))) {
    var %n = $ifmatch
    if (!$istok(%n,$newnick,32)) {
      .hadd usertrack $address($newnick,3) %n $newnick
    }
  }
  else {
    .hadd usertrack $address($nick,3) $newnick
  }
}

dialog aka_test {
  title "AKA_TesT"
  size -1 -1 222 150
  option dbu
  list 1, 7 17 161 50, size
  list 2, 130 82 87 50, size vsbar
  button "Close", 3, 19 138 37 9, ok
  edit "", 4, 30 98 61 10
  text "Enter Search Nick :", 5, 34 89 46 8
  box "Speed Search", 6, 22 79 79 45
  button "Search Now!", 7, 42 111 37 9
}
on *:dialog:aka_test:*:*: {
  if ($devent == init) {
    if !$hget(usertrack) { .hmake usertrack 100 }
    if ($isfile($mircdirtrackusers.hsh)) { .hload usertrack $mircdirtrackusers.hsh }
    var %i = 1 
    while $hget(usertrack,%i).item { 
      did -a $dname 1 $v1 
      inc %i 
    } 
  }
  if ($devent == sclick) {
    if $did(1).sel {
      did -r $dname 2
      didtok $dname 2 32 $hget(usertrack,$v1).data
    }
    if ($did == 7) {
      if $did(4) {
        if ($hfind(usertrack,$did(4),0,W)) { 
          var %b = $remtok($hget(usertrack,$hfind(usertrack,$did(4),0,W).data),$did(4),1,32) 
          didtok $dname 2 32 %b
        } 
      }
    }
  }
}
alias -l alert { dialog -m alert_info alert_info | .timeralert 1 3 dialog -x alert_info }
dialog alert_info {
  title "ALERT!"
  size -1 -1 128 58
  option dbu
  edit "", 1, 35 8 50 10, read
  list 2, 68 28 49 28, size vsbar
  button "Button", 3, 5 62 37 9, hide ok
  text "Nick :", 4, 14 10 15 8
  text "Has also been known as :", 5, 2 24 61 8
}
menu nicklist {
  Track Users
  .View Other Nicknames:{
    if (!$address($$1,3)) { echo $colour(info) -ti2 # * IAL not updated for $$1 $+ , performing userhost lookup | userhost $$1 | return }
    if ($hget(usertrack,$address($$1,3))) {
      var %n = $ifmatch
      if ($istok(%n,$$1,32)) { var %d = $deltok(%n,$findtok(%n,$$1,1,32),32) }
      else { var %d = %n }
      if (!%d) { goto notknown }
      echo $colour(info) -ti2 # * $$1 has also used the nickname $+ $iif($numtok(%d,32) &gt; 1,s:,:) %d
    }
    else {
      :notknown
      echo $colour(info) -ti2 # * $$1 has not been known by any other nickname
    }
  }
  .Reset:.hdel usertrack $address($$1,3)
}
ON *:EXIT: {
  if ($hget(usertrack)) { .hsave -o usertrack trackusers.hsh }
} 
  


i'm trying to add a quick search type thing to scan for other possible existing nicks attached to a users address.
so that's why i'm searching the vaule only for a known nick and have it display any other nicks that maybe linked into the dialog listbox..


Last edited by clutz1572; 08/06/05 06:12 PM.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
[code]nickfind {
if ($hfind(usertrack,$1,0,W)) {
return $remtok($hget(usertrack,$hfind(usertrack,$1,0,W).data),$1,1,32)
}
}[code]


Ok i assume usertrack is a hashtable like so.....
*!*DaveC@*.DaveC.com = DaveC Davo David
*!*user@*.user.com = bob fred john
etc etc etc

and the $1 is a nick your passing the routine?

If thats corrwect then read on


if ($hfind(usertrack,$1,0,W)) {
^ thats wrong your looking for $1 inside the item names your not gonna find "Davo" in there!
The help file is a bit confusing when you read it
W hash table item/data is wildcard text
/ doesnt mean "OR" means which ever one your actually searching.
when using $hfind(,W) its ITEM
when using $hfind(,W).data its DATA

Closest i think you want was....
nickfind {
if ($hfind(usertrack,$1,1,W).data) {
return $remtok($hget(usertrack,$v1),$1,1,32)
}
}

Still seems a bit wrong tho, what about this

nickfind {
if ( ($hfind(usertrack,$1,1,n).data) || ($hfind(usertrack,* $1,0,w).data) || ($hfind(usertrack,$1 *,0,w).data) || ($hfind(usertrack,* $1 *,0,n).data) ) {
return $remtok($hget(usertrack,$v1),$1,1,32)
}
}
if $1 is the data, or any number of names then $1, or $1 then any number of names, or any number of names $1 then any number of names is the data.

This of course still stops at the first nick it find that matches, what if two people have both yused the same nick?


HELP SOMEONE WITH REGEXENESS (bet you dont get called that often!)
Omg someone give us a regex for detecting $1 as a WORD in a string of words, to put in so he well only need one $hfind instead of 4
$hfind(usertrack,??????????????,1,r)

Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
Quote:
Ok i assume usertrack is a hashtable like so.....
*!*DaveC@*.DaveC.com = DaveC Davo David
*!*user@*.user.com = bob fred john
etc etc etc


yes dave, you have it correct with that...
and i had no idea how ambiguous this was, lol.

Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
Quote:
HELP SOMEONE WITH REGEXENESS (bet you dont get called that often!)
Omg someone give us a regex for detecting $1 as a WORD in a string of words, to put in so he well only need one $hfind instead of 4
$hfind(usertrack,??????????????,1,r)


FiberOptics, where are you???!!!!!! grin

hehe

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
$hfind(usertrack,/(?<=^| )\Q $+ $replacecs($1,\E,\E\\E\Q) $+ \E(?= |$)/,1,r).data

The spaces, where used, must be preserved.


Gone.
Joined: Aug 2004
Posts: 423
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Aug 2004
Posts: 423
FiberOPtics,

you are the man!!!! wink

thanks very mucho!!!!

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Anytime cool


Gone.

Link Copied to Clipboard