mIRC Home    About    Download    Register    News    Help

Print Thread
A
An0o
An0o
A
This code reads only the first line of the file
and not read The second line and the following lines

I want to fix it to search all the lines of the file

if ($read(do.txt, w, *, %........) isin %.......) {

Code
on :............: {
  var %...... = $address($nick,2)
  var %........ = $remove($gettok($gettok(%.............,2,33))  
  if ($read(do.txt, w, *, %........) isin %.......) {
    ban -u77200 # $address($nick,2)
  }
  else {
    dec %...................
  }
}

Joined: Jan 2004
Posts: 2,081
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jan 2004
Posts: 2,081
in your effort to remove info from your variable names, you've made it unreadable. you have nested gettok's without the delimiter and token for the outer one. also, the 4th parm of your wildcard read is for the line number to begin searching, and we have no way of knowing what's contained in your variable placed in that location.
also reminder that you should always use the 'nt' switches with $read unless you have a specific reason for not doing so.
Without the 't' switch, if line#1 is a number, it uses that as if it's the total number of lines in the file.
Without the 'n' switch, it evaluates %word and $word found in the line

A
An0o
An0o
A
Thanks maroon
This is code

Code
ON !*:JOIN:#: {
  var %domain = $address($nick,2)
  var %ident = $remove($gettok($gettok(%fullhost ,2,33))  
  if ($read(do.txt, w, *, %domain ) isin %domain ) {
    ban -u77200 # $address($nick,2)
  }
  else {
    dec %domain 
  }
}


The code read one first line only in filetext(do.txt)
, not search in all lines in the filetext

In need read or search all lines numbers in the filetext,
If there is a match of the number in one of the lines, execute the command

Joined: Jan 2004
Posts: 2,081
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jan 2004
Posts: 2,081
Your code doesn't make sense. Are you posting the actual code you're using, or a sanitized version of it.
As I said before, you've wrapped the $gettok identifier around another $gettok, but the outer doesn't have a delimiter or a token#. And then on top of that, you're using $remove without any parameter pairs for removing stuff, and without a closing parenthesis - 3 open + 2 closing.

You define %ident then proceed to not use it. As I said before, the 4th parameter is an optional line number to start searching from if you don't want to start at 1. If %domain contains 123456, then it's starting at line 123456. Luckily, your %domain contains a text string, which $read evaluates as the number zero, so it starts at line 1 since 0 is an invalid line#.

You're not using the 'nt' switches, so if line#1 is a number, then $read thinks that's how many lines there's supposed to be in the file, and if the line contains %word or $word then it tries to evaluate them into variables or identifiers.

By doing a wildcard search for "*" of course it's going to match on the 1st line it encounters, even a blank line.

You can use the -s switch when creating the /var to send an info message to status window showing what string is created, or use echo -s to show the value of variables at different $scriptline's


Link Copied to Clipboard