|
Joined: Mar 2003
Posts: 48
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 48 |
As example:
i have these variables and content: %var1 work %var2 car %var3 girl %var4 car.work %var5 girl.work %var6 girl.car
Now I want to searh all variables starting with %var for the word car. When search is done, I have to notice $nick all finds (complete)
wich would be: /notice $nick %var2 %var4 %var6
Is this possible?
Thanks
|
|
|
|
Joined: Mar 2003
Posts: 48
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 48 |
I tried this: on *:text:@wmfind *:%sLchannel: {
var %i = %slid
:loop
while (%i >= 0) {
if ($s2 isin $gettok(%sl [ $+ [ %i ] ],1,32)) { notice $nick Filename: $gettok(%sl [ $+ [ %i ] ],1,32) - Get file: /msg $me @wmget $gettok(%sl [ $+ [ %i ] ],2,32)
set %i $calc(%i - 1)
goto loop
}
}
} but the script stops working when I try to do @wmfind something
|
|
|
|
Joined: Mar 2005
Posts: 420
Fjord artisan
|
Fjord artisan
Joined: Mar 2005
Posts: 420 |
Try this on *:text:@wmfind &:%sLchannel: {
var %a = 1, %b
while $var(%*,%a) {
if ( $1 isin $var(%*,%a).value ) {
%b = $addtok(%b, $var(%*,%a), 32)
}
inc %a
}
notice $nick ** Results for $1 $+ : $iif(%b, $v1, None)
}
If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
|
|
|
|
Joined: Mar 2003
Posts: 48
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 48 |
Gives me this output:
(23:49:35) (+hOPPA) @wmfind lol (23:49:35) -^hOPPA- ** Results for @wmfind: %sLfind
I've added 3 things with lol: %sl19 lol.girl hihi %sl20 lol url %sl21 who.lol.hehe url2
|
|
|
|
Joined: Mar 2003
Posts: 48
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 48 |
Now I changed it to: on *:text:@wmfind *:%sLchannel: {
var %a = 1, %b
while $var(%*,%a) {
if ($1 isin $gettok(%sl*,1,32)) {
%b = $addtok(%b, $var(%*,%a), 32)
}
inc %a
}
notice $nick ** Results for $1 $+ : $iif(%b, $v1, None)
} But it gives me the output "None" on all search strings.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
You appear to want to use %sl and not %var so you can change that where it is blueThe orange 400 is a length of message control, most (all?) networks well send notices this length, if yours doesnt then reduce it, or if the contents of these variables is large then reduce it. * global var %sLchannel must already be set by u elsewhere!
on *:TEXT:@wmfind *:%sLchannel:{
notice $nick ** Results for $+(,$2-,) are as follows...
var %text
var %i = 1
while ($var([color:blue]%var[/color]*,%i)) {
if ($2- isin $($v1,2)) { var %text = $update(%text,$v2) }
inc %i
}
$update(%text)
}
alias -l update {
var %msg.length = [color:orange]400[/color]
var %text
if ($0 == 1) {
if (!$len($1)) { notice $nick No Matches Found. }
elseif ($1 != &) { notice $nick $1 }
}
else {
var %text = $1 $2
if ($len(%text) > %msg.length) { notice $nick %text | var %text = & }
}
return %text
}
Code was tested and ran fine on mirc v6.16
|
|
|
|
Joined: Mar 2005
Posts: 420
Fjord artisan
|
Fjord artisan
Joined: Mar 2005
Posts: 420 |
My bad, I was testing it in an alias when I posted it. This should work by changing $1 to $2. on *:text:@wmfind &:%sLchannel: {
var %a = 1, %b
while $var(%*,%a) {
if ( $2 isin $var(%*,%a).value ) {
%b = $addtok(%b, $var(%*,%a), 32)
}
inc %a
}
notice $nick ** Results for $2 $+ : $iif(%b, $v1, None)
}
If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
ohhh beat you by seconds!, lol mine looks alot like yours, just I watched out for message length (only becuase i done one of these things before and thats the first thing that crapped out!). One thing your sweeping all variables not just %var or %sl as i think hes going to make it.
|
|
|
|
Joined: Mar 2003
Posts: 48
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 48 |
My bad, I was testing it in an alias when I posted it. This should work by changing $1 to $2. on *:text:@wmfind &:%sLchannel: {
var %a = 1, %b
while $var(%*,%a) {
if ( $2 isin $var(%*,%a).value ) {
%b = $addtok(%b, $var(%*,%a), 32)
}
inc %a
}
notice $nick ** Results for $2 $+ : $iif(%b, $v1, None)
} Stil on bad: (10:40:22) -^hOPPA- ** Results for orneta: %sl2 %sl16  think I have to use $gettok(%b,1,32) instead?!
|
|
|
|
Joined: Mar 2003
Posts: 48
Ameglian cow
|
OP
Ameglian cow
Joined: Mar 2003
Posts: 48 |
ohhh beat you by seconds!, lol mine looks alot like yours, just I watched out for message length (only becuase i done one of these things before and thats the first thing that crapped out!). One thing your sweeping all variables not just %var or %sl as i think hes going to make it. And yours worked perfect. Thansk 
|
|
|
|
Joined: Mar 2005
Posts: 420
Fjord artisan
|
Fjord artisan
Joined: Mar 2005
Posts: 420 |
Stil on bad: (10:40:22) -^hOPPA- ** Results for orneta: %sl2 %sl16  think I have to use $gettok(%b,1,32) instead?! Using "$gettok(%b,1,32)" will only get the first token in the the value of "%b". I just based my code from your example, made it simple.
If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
%b = $addtok(%b, $var(%*,%a), 32) ^ thats the problem, he needed the contents of the variables not there names %b = $addtok(%b, $var(%*,%a).value, 32) was all you needed to fix it, a minor minor bug at the most 
|
|
|
|
Joined: Mar 2005
Posts: 420
Fjord artisan
|
Fjord artisan
Joined: Mar 2005
Posts: 420 |
Oh, the values. He didn't say that on his first post (which is the only one I read). :tongue:
If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
|
|
|
|
|