mIRC Home    About    Download    Register    News    Help

Print Thread
#41399 13/08/03 05:31 AM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
Here is my problem. when I make a request in the channel
some people use underscores in a filename. I am attempting to
determin if the request made had a underscore in the request
or not. So I log all request I make using Innput to a custom window.
If a Dcc fails this script will see FILE NAME.ZIP. It will not reconize
a FILE_NAME.ZIP even if it uses underscores in the custom window.

alias test {
var %temp = $replace($1-,_,*) $+ *
var %i1 = 1
var %fline = $fline(@test,%temp,1,0)
while ( %i1 <= $line(@test,0) ) {
if ( %temp == $gettok($line(@test,%i1),1-,9) ) {
aline 5 @test2 ! $+ $nick $gettok($line(@test,%i1),1-,9)
if (%fline) { dline @test %fline }
halt
}
inc %i1
}
}




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
#41400 13/08/03 06:32 AM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
Two problems:

Code:
alias test {
  var %temp = $replace($1-,_,*) $+ *
[color:green]  ; this will set a value in temp like this*is*my*request* -
  ; Keep that in mind as you'll never be able to get an exact match with a
  ; filename seeing how * is not allowed in filenames.[/color]
  var %i1 = 1
  var %fline = $fline(@test,%temp,1,0)
  while ( %i1 &lt;= $line(@test,0) ) {
    if ( %temp [color:red]==[/color] [color:red]$gettok($line(@test,%i1),1-,9)[/color] ) {
[color:green]    ; there are wildcards in your %temp, therefor, use iswm and not == [/color]
    aline 5 @test2 ! $+ $nick [color:red]$gettok($line(@test,%i1),1-,9)[/color]
[color:green]    ; a bit pointless to use $gettok to get all the words. this $gettok statement returns
    ; the output of $line(@test,%i1) no matter what. Also -- which character is 9?
    ; Personally I'd just use $line(@test,%i1) instead of $gettok($line(@test,%i1),1-,9) [/color]
    if (%fline) { dline @test %fline }
    halt
  }
  inc %i1
}
}


Now given that you didn't supply any more on the formatting of your custom window I can make no guarantees, but I did point out what i think to be problem. If this doesn't help, return with some more information (like the code used for sending the requests to the window).


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#41401 13/08/03 08:59 AM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
I could of posted a whole script but I thought it would be easyer to just post what I was workling on to get to my point.
lets Just say the help file in Mirc is very veg , at times.... Myself, I learn by asking questions and using the Search feature on this web page. You have helped me out by pointing out my problems in that script.

Question?
as to breaking down this commands line. To help me understand what i am doing.

$gettok( [color:red] $line(@test,%i1),1-,9)
$gettok Returns the Number tokens in text

$gettok( [color:green] $line(@test,%i1) [color:red],1-,9)
$line Returns the line in the custom window

$gettok($line(@test, [color:green] %i1 [color:red] ),1-,9)
%i1 would be the line count of the custom window

$gettok($line(@test,%i1),[color:green]1-[color:red] ,9)
1- would be the match to what the line was searching for.


$gettok($line(@test,%i1),1-,[color:green] 9 [color:red])
[color:blue] 9 is the Charitor, What is this charitor for and what is it suppose to do?




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
#41402 13/08/03 09:10 AM
Joined: Dec 2002
Posts: 774
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
/help $addtok
...
The C parameter is the ascii value of the character separating the tokens.
...

And that's the case in all token identifiers...


Code:
//if ( khaled isgod ) echo yes | else echo no
#41403 13/08/03 10:25 AM
Joined: Mar 2003
Posts: 1,271
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,271
$gettok(text,N,C)
$gettok. takes the specified tokens (N) from a line (text) where the words are separated by the character which has the ASCII value (C). Getting words 1- means "word 1 and everything after it", aka everything.


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius
#41404 13/08/03 03:13 PM
Joined: Dec 2002
Posts: 417
O
Othello Offline OP
Fjord artisan
OP Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
so \what you are saying is The charitor is the ASCII or $CHR(#) seperating the words in a line. in other wors $CHR(32) which is equal to a space in the line of text.




Intelligence: It's better to ask a stupid question, then to prove it by not asking....

Link Copied to Clipboard