|
Warrior124
|
Warrior124
|
I've noticed a couple bugs the newest version of mirc seems to be having. The first one has to do with the $numtok.
//tokenize 32 -----This is a test! | echo -a $numtok($1-,45)
The echo returns 1, and not 5. However, if I do...
//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...
alias textreturn {
var %x = $1-
return %x
}
When I enter...
//tokenize 32 This is a test, 123456789 | echo -a $textreturn($1-)
it returns... I do not have any other scripts loaded. However, I'm getting these errors.
|
|
|
|
Joined: Oct 2003
Posts: 3,641
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Warrior124
|
Warrior124
|
Thanks for the reply, argy0. Yes, my mirc is up to date. Concerning the $numtok issue I've even tried...
//tokenize 32 aaaaaThis is a test! | echo -a $numtok($1-,97)
and it still gives me "1".
|
|
|
|
Joined: Oct 2003
Posts: 3,641
Hoopy frood
|
Hoopy frood
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
|
|
|
|
Warrior124
|
Warrior124
|
7.17 7 3 0 7683908b23e2cfd3ed883d5daf3eacae
Last edited by Warrior124; 08/02/11 07:32 AM.
|
|
|
|
Joined: Oct 2003
Posts: 3,641
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Warrior124
|
Warrior124
|
It returns $false Here is the code I've been using...
alias textreturn {
var %x = $1-
return %x
}
Last edited by Warrior124; 08/02/11 07:36 AM.
|
|
|
|
Joined: Oct 2003
Posts: 3,641
Hoopy frood
|
Hoopy frood
Joined: Oct 2003
Posts: 3,641 |
Please double if not triple check that the code you posted actually returns 1 for you: //tokenize 32 aaaaaThis is a test! | echo -a $numtok($1-,97) I do not get 1 for that code.
|
|
|
|
Warrior124
|
Warrior124
|
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.
|
|
|
|
Joined: Oct 2003
Posts: 3,641
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Warrior124
|
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.
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.
|
|
|
|
Joined: Dec 2002
Posts: 294
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Dec 2002
Posts: 294 |
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:
|
|
|
|
Joined: Dec 2002
Posts: 294
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Dec 2002
Posts: 294 |
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.
|
|
|
|
5618
|
5618
|
Maybe this is simply a font issue?
|
|
|
|
Joined: Oct 2003
Posts: 3,641
Hoopy frood
|
Hoopy frood
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: //tokenize 32 This is a test, 123456789 | echo -a $textreturn($1-) With your textreturn alias given below: 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: 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: //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.
|
|
|
|
Warrior124
|
Warrior124
|
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. 
|
|
|
|
Joined: Dec 2002
Posts: 294
Pan-dimensional mouse
|
Pan-dimensional mouse
Joined: Dec 2002
Posts: 294 |
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.
|
|
|
|
Warrior124
|
Warrior124
|
Just checked. I am using the default Fixedsys font in mIRC. So, it might have not been the font, then.
|
|
|
|
|