mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
I have this remote, and it doesn't seem to be working. It executes the command in the text file for the network, but doesn't join the channel(s) listed.
Code:
on *:CONNECT: {
    if ($read(joins.txt, s, $network)) {
    var %readline = $read(joins.txt, s, $network)
    var %command = $gettok(%readline,3,9)
    %command  
    var %x = 1
    while (%x <= $numtok(%readline,35)) {
      var %chan = $char(35) $+ $gettok(%readline,%x,35)
      join %chan
      inc %x
    }
  }
}


The text file looks like this:
Quote:
ScanGeorgia #general#test /pass mypassword
AccessIRC #ScanGwinnett nickserv identify mypassword


The parts are separated by tabs.

Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
Got it. Apparently, it didn't like the s option on $read. I went with w.

Code:
on *:CONNECT: {
  var %n = $network
  echo -a $read(joins.txt, w,* $+ %n $+ *)
  if ($read(joins.txt, w,* $+ %n $+ *)) {
    var %readline = $read(joins.txt, w,* $+ %n $+ *)
    var %chans = $gettok(%readline,2,9)
    var %command = $gettok(%readline,3,9)
    %command  
    var %x = 1
    echo -a $numtok(%chans,35)
    while (%x <= $numtok(%chans,35)) {
      var %chan = $char(35) $+ $gettok(%chans,%x,35)
      echo -a %chan
      join $chr(35) $+ %chan
      inc %x
    }
  }
}

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
If you use "s" with $read, it will find the first line that starts with that word/phrase/etc. It will then return everything *after* that word/phrase/etc. So if that's the only thing on the line, it will return $null. If you want to make an exact match of the line and return the results, "w" without wildcards is required. In your case, the issue was that your tokens were off by one because the matchtext isn't returned when using "s".


Invision Support
#Invision on irc.irchighway.net
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
Quote:
//echo $read(info.txt, s, mirc)

Scans the file info.txt for a line beginning with the word mirc and returns the text following the match value.


Ah, it does say that, doesn't it? I've been missing that part the whole time. I read "for a line beginning with..." and figure that's good enough. Good to know!


Link Copied to Clipboard