Saw someone make something similar to this, but this is all the chrs in 1 dialog
Right click any window, nicklist, status window, etc. and click $Chr List
OR
Type /chr
thanks to Dean for revisioned version
dialog chr {
title "$chr table"
size -1 -1 66 90
option dbu
list 1, 8 12 25 50, size
list 2, 34 12 25 50, size
text "", 3, 9 63 50 8
text "$chr(n)", 4, 9 4 19 8
text "Symbol", 5, 35 4 20 8
button "msg active", 6, 13 72 42 12
}
menu nicklist,channel,menubar,status {
.$!Chr List:{ dialog $iif($dialog(chr),-v,-m) chr chr }
}
on *:dialog:chr:init:*:{
var %x = 33
while (%x < 255) {
if (%x isnum 33-126) || (%x isnum 160-254) { did -a chr 1 %x | did -a chr 2 $chr(%x) }
inc %x
}
}
on *:dialog:chr:sclick:1,2:{
var %id = $iif($did == 1, 2, 1)
did -c chr %id $did($did).sel
did -ar chr 3 $!chr( $+ $did(1).seltext $+ ) = $did(2).seltext
}
on *:dialog:chr:sclick:6:{
msg $active $did(2).seltext
}
this is because mirc is now (since 7.x) an unicode application, internally, $chr(130) get translated to utf8 (the way mirc is representing unicode internally) and as you can guess, in utf8, $chr(130) is represented by two bytes whose value are 194 and 130, regex are handled with a library which work, by default, 'per character':
$regex($chr(130),/./g) is 2 because mirc pass the internal (utf8) value of the character which is in fact two bytes.
To solve the problem, you can tell the regex engine to interpret the input string as utf8 before matching by adding (UTF8) as the first thing to match in the pattern:
$regex($chr(130),/(UTF8)./g) is 1
alias get_chars return $regsubex($1-,/(*UTF8)(.)/g,$!chr( $+ $asc(\t) $+ ) $!+ $+ $chr(32)) :)
Well, our intelligence can't be measured superficially and compared to one another. We were born with certain intellects. But through the hard work, practice, and persistent learning, we can develop and increase our perception of an object we study. Then we become better and adaptable at following the grammatical rules and improve thereon. I can't speak for jaytea. He's the one allowable to speak for himself if he's superior in MSL then the rest of us. The truth is, he has dedicated many, many years of exposure to MSL and thus he knows how it works inside out.
does anyone have this where you can type in
Hello MIRC
and then send it to active like
$chr(72) $+ $chr(101) $+ $chr(108) $+ $chr(108) $+ $chr(111) $chr(77) $+ $chr(73) $+ $chr(82) $+ $chr(67)
also in reverse decode type in chr & send text to active
ive looked every where no luck if anyone could due this i think alot would apreciate it besides me. thanks
Dean, no one is hinting the notion of workability and vice versa. jaytea was wheeling people to code with a good habit. I have to admit I make lots of bad habits in MSL. Perhaps I still do, and I'm always on the verge of refining and perfecting myself. Without people like jaytea acting as a mentor, many MSL learners may not have been aware of what they can improve upon. There's no denying that jaytea has many extensive years of MSL experience and skill under his belt.
yes i understood guys... but calling something "inefficient" is the same as saying that it wont work correctly
not at all. that would be 'incorrect' or 'dysfunctional'. in fact, saying something is 'inefficient' implies it DOES work correctly since we would just call it broken otherwise ;)
by the way, the FASTEST method would be 189 lines of code resembling 'did -a chr 1 33 | did -a chr 2 !', but that's obviously ridiculous. we need to find a healthy balance between the sensible, the efficient, and the maintainable - and i feel that, in this case, a method involving wasteful iterations tips that balance unfavourably.
it's not a matter of opinion, using 2 while loops is undoubtedly faster. maybe not faster to type, but certainly faster for mIRC to execute. this is because you're cutting down on the amount of work performed in each iteration of those loops, as well as reducing the number of total iterations. if you're still not convinced, try benchmarking 2 minimally functional versions of those methods (/noop instead of /did etc.).
creating inefficient code because it's easier to write is something we should avoid doing ourselves let alone suggesting to people ;P it's simply bad coding practice.
jaytea the first post of alabama was like this
on *:dialog:chr:init:*:{
var %x = 33
while (%x < 127) { did -a chr 1 %x | did -a chr 2 $chr(%x) | inc %x }
var %y = 160
while (%y < 255) { did -a chr 1 %y | did -a chr 2 $chr(%y) | inc %y }
}
as i mentioned, using !isnum operator would make it shorter and faster in my opinion, but as you said, different methods
on my last example i think it is fine, since its ignoring the characters between 127-159
on *:dialog:chr:init:*:{
var %x = 33
while (%x < 255) {
if (%x !isnum 127-159) { did -a chr 1 %x | did -a chr 2 $chr(%x) }
inc %x
}
}
but thanks for the example, now i understand it
'waste of time'? Dean:
on *:dialog:chr:init:*:{
var %x = 33
while (%x < 255) {
if (%x !isnum 127-159) { did -a chr 1 %x | did -a chr 2 $chr(%x) }
inc %x
}
}
between %x = 127 and %x = 159, the loop does nothing except cycle unnecessarily. THAT is a waste of time, albeit a small one. this is what i meant:
on *:dialog:chr:init:*:{
var %x = 33
while (%x < 255) {
if (%x == 127) %x = 160
did -a chr 1 %x | did -a chr 2 $chr(%x)
inc %x
}
}
the difference in execution time is so insignificantly small in this case that it really doesn't matter. but it is plain incorrect to say using 2 separate while loops is a 'waste of time' because it actually produces faster code. if you're not able to see this, consider that your method requires mIRC to perform an if statement for all 222 of its iterations, of which 33 are completely redundant.