mIRC Homepage
Posted By: bwr30060 Token question - 15/01/06 03:08 PM
Hi,

I have a text file with nicks and addresses (in an abbreviated form of $ctime) and I want to be able to process each number to add a 1 and a 0 and then make them $asctime, and then be able to echo the finished line. I tried using a loop to keep adding the next token to a variable, but I can't seem to figure it out. A line looks like this:
*!*@whatever-D1F223B4.aep.bellsouth.net,Blake1 13728927,Blake-brb 13728929,Blake2 13728937

I want to be able to process that line so I can get an echo that says "Blake was Blake1 <date here>,Blake-brb <date here>,Blake2 <date here>.

I can figure out how to process the numbers to get the date I want. I'd just like someone to help me figure out how to set a variable to keep being equal to the info it has stored plus the next token as it loops. I'll use "tokenize 44 %list", but I can't figure it out from there. Thanks for any help.
Posted By: DaveC Re: Token question - 15/01/06 03:39 PM
I dont know where you got BLAKE from so im going to assue its the $nick your currently on.

Code:
var %line, %i = 2, %m = $numtok(%list,44)
while (%i &lt;= %m) {
  var %name = $gettok($gettok(%list,%i,44),1,32)
  var %numdate = $gettok($gettok(%list,%i,44),2,32)
  [color:blue]... adjust %numdate from the number to a date here ...[/color]
  var %line = %line $+ %name %numdate $+ ,
  inc %i
}
var %line = $gettok($nick was %line,1-,44)
echo -a %line

* code untested *

I dont use the tokenize command at all, rather i use the $gettok() identifier, first with 44 comma, starting at trhe second token, then using 32 space to get the 1st and 2nd parts of each of the previous token, then u can add the adjusting the date bit, then i add it to a line %line, and move to the next token (44), lastley I add the "Blake was " bit at the front , and remove the trailing comma ($gettok well remove leading and trailing token seperators), finaly echo it.
Posted By: bwr30060 Re: Token question - 15/01/06 05:12 PM
That works. Thank you. smile
© mIRC Discussion Forums