mIRC Home    About    Download    Register    News    Help

Print Thread
#119235 03/05/05 01:15 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Code:
  var %host = $gettok($address($nick,3),-2-1,46)
  var %a.1 = $+($gettok($address($nick,3),1,64),@*.,%host)
  var %a.2 = $hfind(TD,$+(*.,%address),1,w)
  echo -a Host %host
  echo -a CAddress %a.1
  echo -a Address %a.2
 


The first two variables echo correctly to what I'm expecting them to show for any given nick.
However, the third one keeps showing up as $null, even though I have manually confirmed that a matching address, or at least an address that matches according to my understanding of $hfind, does exist.

Any suggestions/clarification?

#119236 03/05/05 02:38 AM
Joined: Jun 2004
Posts: 4
B
Self-satisified door
Offline
Self-satisified door
B
Joined: Jun 2004
Posts: 4
Well where is %address getting set?


-bugz
#119237 03/05/05 02:47 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
*dunce*...was using %address then changed it to %a.1 and missed that change...now that that has been pointed out, I'll give the code another try.

#119238 03/05/05 02:57 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
still no luck. altered code now looks like
Code:
  var %host = $gettok($address($nick,3),-2-1,46)
  var %a.1 = $+($gettok($address($nick,3),1,64),@*.,%host)
  var %a.2 = $hfind(TD,$+(*.,%a.1),1,w)
  echo -a Host %host
  echo -a CAddress %a.1
  echo -a Address %a.2
  

#119239 03/05/05 07:10 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I dont know if this is the problem, but its the normal one i make a mistake with...

Is the *.address your looking for data or item names? $hfind() searches the ITEM names not the DATA $hfind().data well search the data, and BOTH well always returns the ITEM name.

/hadd -m TD blah bannana
$hfind(TD,*nana,1,w) >> $null
$hfind(TD,*lah,1,w) >> blah
$hfind(TD,*nana,1,w).data >> blah

Hope i helped.

#119240 03/05/05 07:30 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
the information being searched is the item names, since I need the actual item name in order to retrieve the data that's stored in the item.
%a.1 is a wildcard format of the person's address. The format for the storage of the information in the hash table is /hadd -m TD $+(Limits.,$address) <their limits>

So, as I understand it, I need the actual matching address to be able to retrieve the data, and I thought that using $hfind with the wildcard address brought me the actual address that matched.

Example:
hash table location: Limits.~Nick@bdsm-36320B18.sympatico.ca
generated address: Limits.~Nick@*.sympatico.ca

It would be great if everyone always had the same IP address when they joined the room, but I know that the "bdsm-36320B18" changes...and sometimes there's an additional code in front of the ".sympatico.ca" that usually represents a specific province, so that for Ontario it might look like .on.sympatico.ca, Quebec .qb.sympatico.ca, British Columbia .bc.sympatico.ca, and so on...but sometimes there isn't a provincial code there, so I need to be able to handle all of these possibilities

Hope this additional information is useful

#119241 03/05/05 11:01 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
/hadd -m TD $+(Limits.,$address) <their limits>
Example:
Limits.~Nick@bdsm-36320B18.sympatico.ca
^^^^ that looks right

generated address: Limits.~Nick@*.sympatico.ca
^^^^ this is the problem I think, I dont think your code is generating that address.

Code:
  var %host = $gettok($address($nick,3),-2-1,46)            [color:blue]&gt;&gt;&gt; %host = sympatico.ca[/color]
  var %a.1 = $+($gettok($address($nick,3),1,64),@*.,%host)  [color:blue]&gt;&gt;&gt; %a.1 = *!*~Nick@*.sympatico.ca[/color]
  var %a.2 = $hfind(TD,$+(*.,%a.1),1,w)                     [color:blue]&gt;&gt;&gt; $+(*.,%a.1) = *.*!*~Nick@*.sympatico.ca[/color]


NB: $address($nick,3) seems a bit odd im monitoring it as people say things, and sometimes its *!~Nick@bdsm-36320B18.sympatico.ca, *!*Nick@bdsm-36320B18.sympatico.ca, *!~Nic*@bdsm-36320B18.sympatico.ca

$address($nick,5) always seems to be DaveC!~Nick@bdsm-36320B18.sympatico.ca

Code:
  var %host = $gettok($address($nick,5),-2-,46)
  var %a.1 = $+($gettok($gettok($address($nick,5),1,64),2-,33),@*.,%host)
  var %a.2 = $hfind(TD,$+(*.,%a.1),1,w)

* changed to type 5 $address
* took out a 1 on the end of the -2- (dont think it does anything)
* added $gettok( ,2-,33) to get passed the ! in nick!~nick@domain

Seems to work in my limited test.

Hope you the best.

#119242 04/05/05 12:41 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks for your help Dave. Managed to come up with a solution that works. FYI Code follows:
Code:
alias caddress {
  var %user = $right($address($nick,0),-2)
  var %user = $left($left(%user,$pos(%user,@,1)),-1)
  var %ISP = $gettok($address($nick,5),-2-,46)
  var %address = $+(*,%user,@*.,%isp)
  var %address = $hfind(TD,$+(Limits.,%address),1,w)
  return %address
}
  


How can I modify that code so that it'll work with a supplied nick (ie: one passed from another script), rather than the nick of the person that activated that code?

Last edited by RusselB; 04/05/05 12:51 AM.
#119243 04/05/05 04:22 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
;usage $caddress(nick) 
;NB: if no nick is passed then $nick is used, if no $nick is avalaible then $me is used.
;
alias caddress {
  tokenize 32 $1 $nick $me
  var %user = $right($address($1,0),-2)
  var %user = $left($left(%user,$pos(%user,@,1)),-1)
  var %ISP = $gettok($address($1,5),-2-,46)
  var %address = $+(*,%user,@*.,%isp)
  var %address = $hfind(TD,$+(Limits.,%address),1,w)
  return %address
}


* could have left the tokenize out but it lets you call it without passing any value and it does it on $nick (or if no $nick then $me )

#119244 05/06/05 06:38 AM
Joined: Jun 2005
Posts: 2
Z
Bowl of petunias
Offline
Bowl of petunias
Z
Joined: Jun 2005
Posts: 2
Hi, I tried your code and tried doing some tweaking but they didnt work. Your code does for example : *!~Invisible@Zephyron.Industries.Inc

But how do i get it to do : Zephyron!*Invisible@Zephyron.Industries.Inc instead?

Thanks.

#119245 05/06/05 06:54 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I don't know what tweaking you did to the code, but the $address mask that's used in the original code is 5, which I then custom alter.

For the results you seem to be asking for, simply use $address(<nick>,6)

reference /help $address & /help $mask

#119246 05/06/05 07:16 AM
Joined: Jun 2005
Posts: 2
Z
Bowl of petunias
Offline
Bowl of petunias
Z
Joined: Jun 2005
Posts: 2
Ah, I mean in terms of DaveC's code

----
;usage $caddress(nick)
;NB: if no nick is passed then $nick is used, if no $nick is avalaible then $me is used.
;
alias caddress {
tokenize 32 $1 $nick $me
var %user = $right($address($1,0),-2)
var %user = $left($left(%user,$pos(%user,@,1)),-1)
var %ISP = $gettok($address($1,5),-2-,46)
var %address = $+(*,%user,@*.,%isp)
var %address = $hfind(TD,$+(Limits.,%address),1,w)
return %address
}
---


Link Copied to Clipboard