This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Bogus trivia non-english users answer problem.

Support & discussion of released scripts, and announcements of new releases.
Post Reply
K
Keen
Voice
Posts: 10
Joined: Wed Jan 28, 2009 7:47 pm

Bogus trivia non-english users answer problem.

Post by Keen »

Hello many of my users come from english speaking countries. So bogus trivia must accept both non-english and english char answers.

For example if the answer of the question is "Şeytan" the english speaking users cant type Şeytan they have to write seytan/Seytan because there is no turkish chars in ther computer. But the bogus trivia bot does not accept this answer. can we make it with a code such this?
regsub -all {ğ} $tx "g" tx
regsub -all {Ğ} $tx "G" tx
regsub -all {ü} $tx "u" tx
regsub -all {Ü} $tx "U" tx
regsub -all {ş} $tx "s" tx
regsub -all {Ş} $tx "S" tx
regsub -all {ı} $tx "i" tx
regsub -all {İ} $tx "I" tx
regsub -all {ö} $tx "o" tx
regsub -all {Ö} $tx "O" tx
regsub -all {ç} $tx "c" tx
regsub -all {Ç} $tx "C" tx
i want bot accept both Ç and C hars but i dont know how to do. thank you.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

You should use Johannes13's two function to encode and decode a text to and from Turkish to English instead of the regsubs.

Code: Select all

proc enc v {
  subst [regsub -all {[^a-zA-Z0-9\-_\.~]} [encoding convertto utf-8 $v] {[format %%%02X [scan {\0} %c]]}]
}

proc decode v {
  encoding convertfrom utf-8 [subst -nocommands -novariables [regsub -all {%([a-fA-F0-9]{2})} $v {\u\1}]]
} 
Once the game is over, the king and the pawn go back in the same box.
K
Keen
Voice
Posts: 10
Joined: Wed Jan 28, 2009 7:47 pm

Post by Keen »

thank you caesar but im new in tcl. Can you implement this code for me to the bogus tcl? Thank you.
k
kingkong
Voice
Posts: 10
Joined: Sun Apr 08, 2012 5:02 am

Post by kingkong »

According to your words, I assume that your bot can accept Turkish chars. So, You don't need to recode or edit anything in tcl.
All you need to do is just to put both of answers in your question file. seperate the answers with * sign. just edit your answers in such questions as like that and bot will accept both(answer can be more than one or two) of the answers;

question*answer1*answer2

in your case;

question*Seytan*Şeytan

so, nothing else will need to do.
Post Reply