mIRC Home    About    Download    Register    News    Help

Print Thread
#229521 08/02/11 07:08 AM
W
Warrior124
Warrior124
W
I've noticed a couple bugs the newest version of mirc seems to be having.
The first one has to do with the $numtok.

Code:
//tokenize 32 -----This is a test! | echo -a $numtok($1-,45)


The echo returns 1, and not 5. However, if I do...

Code:
//tokenize 32 -----This is a-test! | echo -a $numtok($1-,45)


That returns 2, and not 6.

----------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------

The next bug has to do with aliases, and the $chr(44). When returning text from an alias it never returns any "," that are in the text...

Code:
alias textreturn {
  var %x = $1-
  return %x
}

When I enter...
Code:
//tokenize 32 This is a test, 123456789 | echo -a $textreturn($1-)


it returns...
Code:
This is a test 123456789


I do not have any other scripts loaded. However, I'm getting these errors.

#229523 08/02/11 07:20 AM
Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
The tokenization issue is not a bug. It's been like that forever, and it's by design. mIRC ignores "empty" tokens, ie. "---" is treated as a single "-", not 3 empty tokens separated by -'s. This is why mIRC does not like multiple spaces very much (because $1- is passed through the tokenization process). It's a double edged sword, but that's how it works.

As for your second issue, I can't reproduce this. I get "This is a test, 123456789", with the comma. Please ensure that you're testing on the latest mIRC, version 7.17, as bugs might exist in old versions.

argv0 #229524 08/02/11 07:24 AM
W
Warrior124
Warrior124
W
Thanks for the reply, argy0. Yes, my mirc is up to date. Concerning the $numtok issue I've even tried...
Code:
//tokenize 32 aaaaaThis is a test! | echo -a $numtok($1-,97)


and it still gives me "1".

#229525 08/02/11 07:29 AM
Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
It gives me 2. What version of mIRC are you running?

Type the following in mIRC:

//echo -a $version $os $script(0) $dll(0) $md5($mircexe,2)

And report the results here

argv0 #229526 08/02/11 07:30 AM
W
Warrior124
Warrior124
W
7.17 7 3 0 7683908b23e2cfd3ed883d5daf3eacae

Last edited by Warrior124; 08/02/11 07:32 AM.
#229527 08/02/11 07:33 AM
Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
Type //echo -a $isalias(tokenize) and report the results here.

I can't reproduce either of your results, and it's highly unlikely that they're dependent on your specific computer environment. I'm going to say you're likely checking the wrong results. Copy in the commands as you've listed them here and double check to confirm that you are getting 1 for this last code snippet.

argv0 #229528 08/02/11 07:34 AM
W
Warrior124
Warrior124
W
It returns $false

Here is the code I've been using...

Code:
alias textreturn {
  var %x = $1-
  return %x
}

Last edited by Warrior124; 08/02/11 07:36 AM.
#229529 08/02/11 07:38 AM
Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
Please double if not triple check that the code you posted actually returns 1 for you:

Code:
//tokenize 32 aaaaaThis is a test! | echo -a $numtok($1-,97)


I do not get 1 for that code.

argv0 #229530 08/02/11 07:42 AM
W
Warrior124
Warrior124
W
Oops, my mistake. It doesn't give "1" for that code, but it only gives me "2". For some reason it only picks up 1 in that string of 5 "a"'s, and then picks up the "a" in the middle of the sentence.

P.S.: By the way, I've more than quadrupple chacked, and all with the same results.

Last edited by Warrior124; 08/02/11 07:44 AM.
#229532 08/02/11 07:48 AM
Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
As I explained in my first response, 2 is the expected result. It doesn't matter if your delimiter is -, $chr(32), or 'a', the tokenization process will always IGNORE empty tokens.

the string "aaaaa" delimited by "a"'s is a list of empty tokens, mIRC will not count 6 tokens here, it will count 1.

argv0 #229534 08/02/11 07:51 AM
W
Warrior124
Warrior124
W
Ahh, okay. Thanks, again argy0. I'm sure I can make a script to do what I want. I just didn't understand why $numtok wasn't picking up all the same characters together, but I do now.

As far as the $chr(44) I made a new folder, and put a new copy of mirc in it, made another alias, and am still getting the same results. It always takes out the "," in the sentence for some reason.

Last edited by Warrior124; 08/02/11 07:54 AM.
#229549 08/02/11 05:59 PM
Joined: Dec 2002
Posts: 294
D
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 294
Originally Posted By: Warrior124
Ahh, okay. Thanks, again argy0. I'm sure I can make a script to do what I want. I just didn't understand why $numtok wasn't picking up all the same characters together, but I do now.


Ah, I think you misunderstood what tokens are. If you simply want to count the number of '-' (hyphen) characters in some text, you can use:

Code:
$count(text,-)

#229550 08/02/11 06:05 PM
Joined: Dec 2002
Posts: 294
D
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 294
Originally Posted By: Warrior124
As far as the $chr(44) I made a new folder, and put a new copy of mirc in it, made another alias, and am still getting the same results. It always takes out the "," in the sentence for some reason.


I can't reproduce this issue at all.

drum #229551 08/02/11 06:17 PM
5
5618
5618
5
Maybe this is simply a font issue?

#229552 08/02/11 07:19 PM
Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
I think you just need to double check (or "quadruple"?) again to ensure what you gave us is in fact what you're testing.

For reference, we are testing:

Code:
//tokenize 32 This is a test, 123456789 | echo -a $textreturn($1-)


With your textreturn alias given below:

Code:
alias textreturn { var %x = $1- | return %x }


The result for me is "This is a test, 123456789"

Keep in mind that the above string should only fill $1 in the textreturn alias, since identifiers are tokenized by literal commas (NOT INCLUDING commas inside of variables or identifiers). Your alias should give the same result if you changed it to:

Code:
alias textreturn return $1


edit:

Note that it IS possible to return the result you reported, but it would require using [] brackets to re-order evaluation as such:

Code:
//tokenize 32 A, B | echo -a $textreturn( [ $1- ] )


The above will evaluate $1- before $textreturn(...), converting the single argument into two: "A, B" (equivalent to $textreturn(A, B)). Then, your identifier "textreturn" would be filled with $1 = A and $2 = B. In this case, using $1- will re-tokenize $1 and $2 by spaces, returning $1 [space] $2, or "A B".

Is this what you are doing?

Last edited by argv0; 08/02/11 11:42 PM.
argv0 #229565 09/02/11 12:11 AM
W
Warrior124
Warrior124
W
Quadruple means 4, or more. Meaning I checked more than 4 times, lol.

For some reason it started showing the "," today. So, I don't know what happened. I just know it wasn't showing for some reason last night.

Drum, I want to thank you very much for letting me know about using $count. That definitely works. Thanks again. smile

#229568 09/02/11 04:45 AM
Joined: Dec 2002
Posts: 294
D
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 294
Originally Posted By: Warrior124
For some reason it started showing the "," today. So, I don't know what happened. I just know it wasn't showing for some reason last night.


One possibility that 5618 alluded to was that it could be some sort of strange font-linking and/or font ligature problem -- although it seems a bit of a stretch.

Do you use a font other than the default (Fixedsys) with mIRC?

Last edited by drum; 09/02/11 04:48 AM.
drum #229570 09/02/11 06:13 AM
W
Warrior124
Warrior124
W
Just checked. I am using the default Fixedsys font in mIRC. So, it might have not been the font, then.


Link Copied to Clipboard