mIRC Home    About    Download    Register    News    Help

Print Thread
#208662 25/01/09 09:44 PM
Joined: Mar 2006
Posts: 6
T
Tomica Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Mar 2006
Posts: 6
Hey all,

sorry if my question is dumb, but I'm a complete beginner concerning mIRC scripts. I have a trivia on my channel. I'm using Trivbot Advance v1.2, and since it's support forum is dead for a couple of years now, I'm clueless about where to search for help.

I would like to make this trivia bot accept UTF-8 encoded answers, because my language uses cyrillic script. It works fine with Windows Cyrillic encoding, but when someone tries to answer a question with his text encoding set to UTF-8. the bot doesn't recognize correct answers.

At first Trivia didn't have non-latin support at all, but I asked for help on the official forum and the trivia creator enhanced his bot to be cyrillic-ready. Now, since that forum doesn't exist any more, I am forced to ask help in other places, like this.

So please, could anyone help me get this script working with UTF-8? I would like to have both questions and answers encoded in UTF-8.

Please note that, as I mentioned before, default trivia pack has only latin support, but I have a copy of it which has support for Windows 1251 (cyrillic) encoding too, enhanced by trivia creator.

If anyone willing to help me needs any more information, please feel free to contact me:

tomak[at]delijeonline[dot]com

Thanks in advance.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
You would have to go through the script looking for items like
Code:
on *:text:*:#:{
which is similar or the same as the code that actually accepts the answers.
Then you would have to use $utfdecode($1-) to alter the text entered (in utf format) to default latin characters, which can then be compared in the script.

I'm not sure what the code might look like for sending the information, but you would need to use $utfencode(<message>) to send the message using UTF characters.

Joined: Mar 2006
Posts: 6
T
Tomica Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Mar 2006
Posts: 6
Russel, thank you very much for your help. Unfortunately, as I mentioned before, I know absoultely nothing about mIRC scripts, so I'm pretty sure I won't be able to do anything myself about this. But I'll try to put out several more precise questions, so I'd greatly appreciate your further help.

Originally Posted By: RusselB
You would have to go through the script looking for items like
Code:
on *:text:*:#:{
which is similar or the same as the code that actually accepts the answers.

I don't know how to find the code line that actually accepts the answers. Could you help me some more about this? I searched for the code line you gave me, but found nothing. frown

Originally Posted By: RusselB
Then you would have to use $utfdecode($1-) to alter the text entered (in utf format) to default latin characters, which can then be compared in the script.

I'm not sure I got everything you said here. But I did know it has to do something with the $utfencode/$utfdecode functions. I just don't know how to use them frown Come to that, could you please explain these finctions on this example: The first time trivia is run, it asks about the channel name it will be running on, but the dialog doesn't support UTF-8 names. The actual lines for getting the channel name are:

Code:
  set %trivchan #$$?"Enter your #Trivia_Channel_Name"
  dowrite -s miscop trivia.channel %trivchan | saveini | /join %trivchan

So, what should I put where so that I can join a channel with a UTF-8 name?

Originally Posted By: RusselB

I'm not sure what the code might look like for sending the information, but you would need to use $utfencode(<message>) to send the message using UTF characters.

Wouldn't it be enough to just set UTF-8 to Display and Encode in my mIRC client which runs the bot? Because when I do, I really think that questions are indeed encoded in UTF-8.

Last edited by Tomica; 27/01/09 11:50 PM.
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Why not just convert all of your Cyrillic characters with $utfencode identifier? Like this:

Code:
//echo $utfencode(CyrillicCharactershere)


Once entered, your mirc will output ANSI result.

Finally to test, in your mirc remote, put this code in and your bot will recognize these Cyrillic characters:

Code:
on *:TEXT:*:#: {
  if (<EncodedResultHere> isin $1-) {
    msg $chan $nick says $v1
  }
}

Joined: Mar 2006
Posts: 6
T
Tomica Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Mar 2006
Posts: 6
Hi Tomao.

Could you please tell me where exactly should I put those code lines? I tried this: Opened mIRC in which I run my trivia bot, opened script editor (aliases.ini), pasted this line:

Quote:
//echo $utfencode(&#1040;&#1072;&#1041;&#1073;&#1042;&#1074;&#1043;&#1075;&#1044;&#1076;&#1026;&#1106;&#1045;&#1077;&#1046;&#1078;&#1047;&#1079;&#1048;&#1080;&#1032;&#1112;&#1050;&#1082;&#1051;&#1083;&#1033;&#1113;&#1052;&#1084;&#1053;&#1085;&#1034;&#1114;&#1054;&#1086;&#1055;&#1087;&#1056;&#1088;&#1057;&#1089;&#1058;&#1090;&#1035;&#1115;&#1059;&#1091;&#1060;&#1092;&#1061;&#1093;&#1062;&#1094;&#1063;&#1095;&#1039;&#1119;&#1064;&#1096;)

in the bottom of the document (right below the lines that were added to the code by its creator to allow CP1251 characters). Then I switched to Remote tab, created new script.ini and pasted inside your second code:

Code:
on *:TEXT:*:#: {
  if (<EncodedResultHere> isin $1-) {
    msg $chan $nick says $v1
  }
}

I tried to leave <EncodedResultsHere>, I tried to replace it with: &#1040;&#1072;&#1041;&#1073;&#1042;&#1074;&#1043;&#1075;&#1044;&#1076;&#1026;&#1106;&#1045;&#1077;&#1046;&#1078;&#1047;&#1079;&#1048;&#1080;&#1032;&#1112;&#1050;&#1082;&#1051;&#1083;&#1033;&#1113;&#1052;&#1084;&#1053;&#1085;&#1034;&#1114;&#1054;&#1086;&#1055;&#1087;&#1056;&#1088;&#1057;&#1089;&#1058;&#1090;&#1035;&#1115;&#1059;&#1091;&#1060;&#1092;&#1061;&#1093;&#1062;&#1094;&#1063;&#1095;&#1039;&#1119;&#1064;&#1096; and finaly tried replacing it with <&#1040;&#1072;&#1041;&#1073;&#1042;&#1074;&#1043;&#1075;&#1044;&#1076;&#1026;&#1106;&#1045;&#1077;&#1046;&#1078;&#1047;&#1079;&#1048;&#1080;&#1032;&#1112;&#1050;&#1082;&#1051;&#1083;&#1033;&#1113;&#1052;&#1084;&#1053;&#1085;&#1034;&#1114;&#1054;&#1086;&#1055;&#1087;&#1056;&#1088;&#1057;&#1089;&#1058;&#1090;&#1035;&#1115;&#1059;&#1091;&#1060;&#1092;&#1061;&#1093;&#1062;&#1094;&#1063;&#1095;&#1039;&#1119;&#1064;&#1096;> but nothing worked frown I get this message in my status window:

Quote:
&#1040;&#1072;&#1041;&#1073;&#1042;&#1074;&#1043;&#1075;&#1044;&#1076;&#1026;&#1106;&#1045;&#1077;&#1046;&#1078;&#1047;&#1079;&#1048;&#1080;&#1032;&#1112;&#1050;&#1082;&#1051;&#1083;&#1033;&#1113;&#1052;&#1084;&#1053;&#1085;&#1034;&#1114;&#1054;&#1086;&#1055;&#1087;&#1056;&#1088;&#1057;&#1089;&#1058;&#1090;&#1035;&#1115;&#1059;&#1091;&#1060;&#1092;&#1061;&#1093;&#1062;&#1094;&#1063;&#1095;&#1039;&#1119;&#1064;&#1096; Unknown command

Or of course, respective substitute for the changed values.

What am I doing wrong? frown

Last edited by Tomica; 29/01/09 12:19 AM.
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
No, the echo command is to just show the result of the Cyrillic conversion in ANSI encode.

You enter this in any mirc window:
Quote:
//echo $utfencode(&#1040;&#1072;&#1041;&#1073;&#1042;&#1074;&#1043;&#1075;&#1044;&#1076;&#1026;&#1106;&#1045;&#1077;&#1046;&#1078;&#1047;&#1079;&#1048;&#1080;&#1032;&#1112;&#1050;&#1082;&#1051;&#1083;&#1033;&#1113;&#1052;&#1084;&#1053;&#1085;&#1034;&#1114;&#1054;&#1086;&#1055;&#1087;&#1056;&#1088;&#1057;&#1089;&#1058;&#1090;&#1035;&#1115;&#1059;&#1091;&#1060;&#1092;&#1061;&#1093;&#1062;&#1094;&#1063;&#1095;&#1039;&#1119;&#1064;&#1096;)


And then it will output these characters:
Code:
АаБбВвГгДдЂђЕеЖжЗзИиЈјКкЛлЉљМмНнЊњОоПпРрСсТтЋћУуФфХхЦцЧчЏџШш


and they are to be placed inside the on text code.

Ok, how about we do something different here. Put this code inside your remote:

Code:
on $*:TEXT:/(А|а|Б|б|В|в|Г|г|Д|д|Ђ|ђ|Е|е|Ж|ж|З|з|И|и|Ј|ј|К|к|Л|л|Љ|љ|М|м|Н|н|Њ|њ|О|о|П|п|Р|р|С|с|Т|т|Ћ|ћ|У|у|Ф|ф|Х|х|Ц|ц|Ч|ч|Џ|џ|Ш|ш)/giS:#: {
  if ($regml(1) isin $1-) { msg $chan I recognize $nick has said the Cyrillic letter: $v1 }
}


Now say an actual Cyrilic letter using another nickname in your channel. Let's say I put the word &#1046;

Your bot shall say this in your channel:

<YourBot> I recognize Tomao has said the Cyrillic letter: &#1046;

Joined: Mar 2006
Posts: 6
T
Tomica Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Mar 2006
Posts: 6
Originally Posted By: Tomao
No, the echo command is to just show the result of the Cyrillic conversion in ANSI encode.

Silly me smile Sorry for the dumb question...

Tomao, your idea worked almost fine smile I will do my best to try and explain you why, since this forum also lacks some UTF-8 support, so I guess I won't be able to write down everything I need the way I'd like to.

I believe that the main problem is the fact that my default system encoding is CP1251. So when I perform you //echo command, my responce is different. Here's how it looks like: link1. Then I separated letter codes with vertical bars {|} and replaced the responding part of your on$*TEXT* code. I ended up with this code: link2. I saved it in a new script and loaded the script in my bot mIRC. At first, I had some trouble (it recognized some letters, while refusing to recognize or recognized wrong the others). But after some time, I got it working. Unfortunately, it could recognize only when I type just one letter. If I typed in more than one letter or more than one word, the script recognized only the first one.

Last edited by Tomica; 30/01/09 03:43 PM.
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
This shall recognize all of the Cyrillic letters:

Code:
on $*:TEXT:/([А-Яа-Ñ])/giS:#: {
  if ($regml(1) isin $1-) { msg $chan I recognize $nick has said : $v2 }
}


I performed a test using Russian, and it worked as expected:

<MyBot> I recognize that Tomao has said : &#1042;&#1084;&#1077;&#1089;&#1090;&#1077; &#1089; &#1090;&#1077;&#1084;, &#1087;&#1086; &#1077;&#1075;&#1086; &#1089;&#1083;&#1086;&#1074;&#1072;&#1084;, &#1087;&#1086;&#1076;&#1087;&#1080;&#1089;&#1072;&#1085;&#1085;&#1099;&#1077; &#1082;&#1086;&#1085;&#1090;&#1088;&#1072;&#1082;&#1090;&#1099; &#1085;&#1072;&#1076;&#1086; &#1074;&#1099;&#1087;&#1086;&#1083;&#1085;&#1103;&#1090;&#1100;.

Joined: Mar 2006
Posts: 6
T
Tomica Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Mar 2006
Posts: 6
I don't know how you do it, but you did it again smile

<Tomica> «&#1064;&#1082;&#1072;&#1092;&#1080;&#1096;&#1082;&#1072;&#1092;&#1114;&#1072;&#1082; &#1112;&#1077; &#1089;&#1077;&#1086; &#1091; &#1072;&#1091;&#1090;&#1086;&#1084;&#1086;&#1073;&#1080;&#1083;»
<Kbucko> I recognize Tomica has said : «&#1064;&#1082;&#1072;&#1092;&#1080;&#1096;&#1082;&#1072;&#1092;&#1114;&#1072;&#1082; &#1112;&#1077; &#1089;&#1077;&#1086; &#1091; &#1072;&#1091;&#1090;&#1086;&#1084;&#1086;&#1073;&#1080;&#1083;»

But my bot still doesn't confirm correct answers frown What should I do now?

Last edited by Tomica; 01/02/09 07:02 PM.
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
It's rather hard for people on this forum to help further without knowing what your trivbot codes look like.

Joined: Mar 2006
Posts: 6
T
Tomica Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
T
Joined: Mar 2006
Posts: 6
Well, uhm, I did post a link for the download page in my first post... Would you like me to make my particular installation available for download?

Last edited by Tomica; 01/02/09 11:25 PM.

Link Copied to Clipboard