Solved How to ignore diacritics in a message?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

MsWolfi

Member
May 29, 2020
2
0
0
22
Hi!
I'm creating a chatbot for our server. I'm from a country where diacritics are common and I need chatbot to ignore it. I'm a beginner so sorry for maybe a simple question.

Example: "Hráč" and "Hrac" ("player" and "player" in English).
Code:
on chat:
    if chat message contains "hráč" or "hrac": #player or player
        wait 1 seconds
        message "Ahoj!" to player #Hi!

This is just a simple example, I need it for more complex operations.

Thanks for help!
 
I think it is like:

on chat:
if chat message contains "hráč" or "hrac": #player or player
wait 1 tick
cancel event then run [execute console command:"/msg %arg-1% Please don't use diacritics on our server"]
[doublepost=1590795579,1590795546][/doublepost]Please tell me if it works, I too am not great with skript.
[doublepost=1590795673][/doublepost]
I think it is like:

on chat:
if chat message contains "hráč" or "hrac": #player or player
wait 1 tick
cancel event then run [execute console command:"/msg %arg-1% Please don't use diacritics on our server"]
[doublepost=1590795579,1590795546][/doublepost]Please tell me if it works, I too am not great with skript.
Add 2 spaces in "if chat message contains...", "wait 1 tick", and "cancel event then run..."
 
I think it is like:

on chat:
if chat message contains "hráč" or "hrac": #player or player
wait 1 tick
cancel event then run [execute console command:"/msg %arg-1% Please don't use diacritics on our server"]
[doublepost=1590795579,1590795546][/doublepost]Please tell me if it works, I too am not great with skript.
[doublepost=1590795673][/doublepost]
Add 2 spaces in "if chat message contains...", "wait 1 tick", and "cancel event then run..."
She can't just add if statements for every single diacritic ever, we'll need to remove them.
 
You can use
Code:
on chat:
    if message contains "č", "ř", "ž", "š" or "ď": #etc...
        replace all "č" in message with "c"
        replace all "ř" in message with "r"
        #etc...
or you can forbid using diacritics:
Code:
on chat:
    if message contains "č", "ř", "ž", "š" or "ď": #etc...
        cancel event
        send "&cNemůžeš používat diakritiku!" #you can't use diacritics
 
You can reformat the chat by
Code:
on chat:
    set {_msg} to message
    replace all "č" with "c" in {_msg}
    cancel event
    broadcast "(your chat format): %{_msg}%"
or instead of replacing "č" with "c" you can simply replace it with "" to remove it. You can set format with addons that support GroupManager and so on.
 
Hi! Thanks to all for your help. I replaced all "č, ř, ž, ť" etc. with "c, r, z, t.." and it works great!
 
Status
Not open for further replies.