This alias will convert the decimal number associated with a utf-8 image to the ascii combinations needed to display it in mIRC. I have no idea why this isn't already included in mIRC ;/
The modular division and binary math needed to do this conversion would require several pages to explain, so I'm not going to bore you with that. If someone would like to discuss the math involved here, please see me in irc.
To make sure utf8 is enabled on your mIRC - Do this first:
Go to Tools - Options - IRC - Messages
Make sure The 6 boxes at the bottom are checked.
If you still are seeing ??? question marks, Right click the channel, on the treebar or the channel box at the bottom/top and click Font.
Under utf8 select Display & Encode.
How to use this?
I included 3 basic aliases to demonstrate how to use $utf8
The first one will print your text upsidedown and backwards.
Syntax /flip text or $flip(text)
And the second will print the letters and numbers inside a octagon.
Syntax /Octatext text or $octatext(text)
New alias added /small
Syntax /small text or $small(text)
;$utf8 conversion for mIRC by Ford_Lawnmower irc.mindforge.org #USA-Chat
alias UTF81 {
if ($1 < 161) { return $chr($1) }
elseif ($len($base($1,10,2)) < 12) { return $+($chr($calc(192 + $div($1,64))),$chr($calc(128 + [ $1 % 64 ] ))) }
elseif ($len($base($1,10,2)) < 17) { return $+($chr($calc(224 + $div($1,4096))),$chr($calc(128 + [ $div($1,64) % 64 ] )),$chr($calc(128 + [ $1 % 64 ] ))) }
elseif ($len($base($1,10,2)) < 22) {
return $+($chr($calc(240 + $div($1,262144))),$chr($calc(128 + [ $div($1,4096) % 64 ] )),$chr($calc(128 + [ $div($1,64) % 64 ] )),$&
$chr($calc(128 + [ $1 % 64 ] )))
}
}
alias -l div { return $int($calc($1 / $2)) }
alias UTF8 {
if ($version >= 7) return $chr($1)
else {
var %x $base($1,10,2),%y $len(%x)
if ($1 < 161) { return $chr($1) }
elseif (%y < 12) { return $+($shift(11000000,$left(%x,-6)),$shift(10000000,$right(%x,6))) }
elseif (%y < 17) { return $+($shift(11100000,$left(%x,-12)),$shift(10000000,$mid(%x,-12,6)),$shift(10000000,$right(%x,6))) }
elseif (%y < 22) {
return $+($shift(11110000,$left(%x,-18)),$shift(10000000,$mid(%x,$iif(%y < 18,$+(-,%y),-18),6)),$shift(10000000,$mid(%x,-12,6)),$shift(10000000,$right(%x,6)))
}
}
}
alias -l shift {
if ($2) { return $chr($base($+($left($1,$+(-,$len($2))),$2),2,10)) }
else { return $chr($base($1,2,10)) }
}
alias UrlEncode {
return $regsubex($1-,/([^a-z0-9])/ig,$+(%,$base($UTF8($asc(\t)),10,16,2)))
}
Menu channel,status {
.Text Tricks
..Fliptext:flip $?="Enter the text to be fliped"
..Octatext:Octatext $?="Enter the text for Octagon conversion"
}
alias octatext {
var %octa $regsubex($1-,/([a-z])/g,$utf8($calc($asc($regml(\n)) + 9327)))
%octa = $regsubex(%octa,/([A-Z])/g,$utf8($calc($asc($regml(\n)) + 9333)))
$iif($isid,return,$iif($active ischan,say,echo -a)) $regsubex(%octa,/([1-9])/g,$utf8($calc($asc($regml(\n)) + 10063)))
}
alias flip {
var %flip, %end $len($1-)
while (%end) {
%flip = $+(%flip,$replace($mid($1-,%end,1),$chr(32),$chr(7)))
dec %end
}
%flip = $replacex(%flip,a,$utf8(592),b,q,c,$utf8(596),d,p,e,$utf8(601),f,$utf8(607),g,$utf8(595),h,$utf8(613),i,$utf8(618),j,$utf8(638),k,$utf8(670),$&
l,$utf8(305),m,$utf8(623),n,u,o,o,p,d,q,b,r,$utf8(633),s,s,t,$utf8(647),u,n,v,$utf8(652),w,$utf8(653),y,$utf8(654),.,$utf8(729),?,$utf8(191),z,z,$chr(7),$chr(32))
$iif($isid,return,$iif($active ischan,say,echo -a)) %flip
}
alias small {
var %small = $replacex($1-,a,$utf8(7424),b,$utf8(665),c,$utf8(7428),d,$utf8(7429),e,$utf8(7431),f,$utf8(1171),g,$utf8(610),h,$utf8(668),i,$utf8(1110),$&
j,$utf8(7434),k,$utf8(7435),l,$utf8(671),m,$utf8(7437),n,$utf8(628),o,$utf8(7439),p,$utf8(7448),q,$utf8(587),r,$utf8(640),s,$utf8(1109),$&
t,$utf8(7451),u,$utf8(7452),v,$utf8(7456),w,$utf8(7457),x,$utf8(1093),y,$utf8(655),z,$utf8(7458))
$iif($isid,return,$iif($active ischan,say,echo -a)) %small
}
I agree with jaytea about the fact that a script can further be adjusted to work with the latest versions, but some people either don't know how or bother to do so...and as a result, they take the latest builds as a culprit that their old scripts have stopped functioning. As for buggy issues, not necessarily a user will encounter them if his or her main purpose of using mIRC is to chat and monitor their chat rooms. Some self-conscious folks will think a client with bugs should be avoided at all costs. Nevertheless, against all odds, the latest version should work fairly well for those who give it a whirl.
I agree jaytea. I have this script working 100% with 7 in limited testing. Although I realize that $chr() in 7 makes this $utf8() alias unnecessary.
I think I've said this before, but if anyone has problems with one of my scripts working on mIRC 7.x, please let me know and I will take the time to edit the code and get it working.
everything that was possible to code in mIRC 6.35 is still possible now with 7.x versions. Unicode/UTF-8 related scripts will probably require adjustment; for most of these scripts (such as this one) the adjustments will be routine and basic, a few may require deeper and more comprehensive knowledge of the topics involved. we should not be opposed to the idea of learning new concepts, especially those that are relevant outside the realm of mIRC.
Nice new addition, Ford. :p
Cheiron wrote:
2... some of the scripting i use is not working on the new 7+if the old scripts you have don't work with the latest version, how do you expect them to work when you make a transition from 6.35 to a 7+ version in the future?
I quote a passage Khaled has written from mirc.com:> While it may seem that mIRC v6.35 handles codepages correctly, there are a large number of situations where it cannot do so due to a lack of context, just like in the channels list window, and many users have reported issues, such as corrupted text and incorrect encodings, over the years. It would not be possible to add codepage support to mIRC v7.1 without leading to the same issues that were present in all previous versions of mIRC.You might find yourself stuck with 6.35 for good... Just food for thought.
For montague's posted code to work in mIRC 7.1, change it to...
/alias ud say $utfdecode($regsubex($replacex($regsubex($lower($1-),/(.)/g,$mid(\A,-\n,1)),a,C9 90,b,q,c,C9 94,d,p,e,C7 9D,f,C9 9F,g,C6 83,h,C9 A5,i,C4 B1,j,C9 BE,k,CA 9E,l,CA 83,m,C9 AF,n,u,p,d,q,b,r,C9 B9,t,CA 87,u,n,v,CA 8C,w,CA 8D,y,CA 8E),/([A-F\d]{2}) ([A-F\d]{2})/g,$chr($base(\1,16,10)) $+ $chr($base(\2,16,10))))
Then, in mIRC, alt+o (or Tools, Options), Other, Lock... Untick Decode (at the right). Hit OK.
Else, you will have to recode the thing. And notice the 4th ")" at the end of the code; it is needed.
@Gummo Good point about the elseif. It took me over 3 months, off and on, messing with mIRC's utf8 charcter combinations to finally find a way to script the bit shifting properly. I never even noticed I left a block of if's like that.
I don't see how $base could help this script. Please explain if you see something I'm missing.
Ford, I don't think Montague's made it, the alias was a source from swiftirc.net. The link to that topic can be found here:http://forum.swiftirc.net/viewtopic.php?t=18021&sid=59230b36edfb6091020c949be72faedd
Dated back to 2008
Nice script, though elseif would remove some conditionals in the first alias.
montague's code there uses an interesting method of reversing the text with the inner-most $regsubex, uses $replacex to swap the letters with hex codes representing the upside-down letters (spaced to make later regex accurate easily) and the outside regsubex simply converts those values to the correct pairs of characters with $base.
$base would probably have made your script easier, FordLawnmower.
Those bouncing cats are going to make me insane P:
This alias is for utf8 conversion montague. The upsidedown is just One example of it's use.
Cool alias though :) It shows the power of nested regsubex.
Did you make this alias?
If so, could you take a moment to explain it here?
If not I can explain it in my next post.
It took me quite a while to wrap my head around how it works.
Got a headache now ;/
For an upside down text u could do it like this too:
/alias ud say $regsubex($replacex($regsubex($lower($1-),/(.)/g,$mid(\A,-\n,1)),a,C9 90,b,q,c,C9 94,d,p,e,C7 9D,f,C9 9F,g,C6 83,h,C9 A5,i,C4 B1,j,C9 BE,k,CA 9E,l,CA 83,m,C9 AF,n,u,p,d,q,b,r,C9 B9,t,CA 87,u,n,v,CA 8C,w,CA 8D,y,CA 8E),/([A-F\d]{2}) ([A-F\d]{2})/g,$chr($base(\1,16,10)) $+ $chr($base(\2,16,10)))
u could start it with /ud
Yea nublet, it usually means that the font that contains that language has not been loaded. The cube means unknown character.
You can usually fix this by adding all the languages.
For XP go here -->> http://support.microsoft.com/kb/177561 <-- and scroll down to xp instructions.
For Vista go here -->> http://windowshelp.microsoft.com/Windows/en-US/help/52e368fa-bd32-4749-955e-331f9130889f1033.mspx
I hope this helps nublet :)
Nope I didn't know that Gummo. Thanks for the info :) When I finally found a formula that would generate the characters correctly everytime, I quickly made the script without the mod alias. I added the mod alias later to remove some repetition, but I would have never guessed that mIRC had modulus function. Useful information :)