[Script] Tongues - a simple language script

1507758815

Edited 1508357411
Hi there! You can find the script and its usage instructions here: Tongues Script Description I'm DMing a D&D campaign and wanted my players to actually speak some weird words while using other languages than Common and yet other users of the language get to understand them. I created this simple script which replaces words written by a same length word from the languages specific vocabulary lists. I had this idea after World of Warcraft's cross-faction communication system which translates your words when they are displayed to an opposite faction's player as they "don't understand your language". I wanted to share in order to other groups take advantage of this. The final result is a pseudo-translator which sends the translated text to everyone but whispers the orginal text to those who can speak the language used to translate. Note: the original text is always whispered to the GM, which could cause replication if you are also tagged as a character's controller since the script whispers both the GM and the characters. I hope someone find this useful! Changelog v1.0.0 - Release v2.0.0 - Improved parsing (special thanks to The Aaron) Now languages are loaded and parsed on script startup or whenever created, changed or deleted. Tongues will look for any handout prefixed with "Tongues: ". Restricted  !tongues --create [name]  command to only GMs. This command now also automatically prefixes languages handouts Added new examples & screenshots. v2.1.0 - Improved character parsing The script now searches for full names when checking the speakers of a language, no more nicknames, now you must write the full name of the character. Leaving empty rows on a language list doesn't causes the script to malfunction. If no vocabulary exists (empty rows) for a language, every word will be translated by sequences of '?' depending on word length. Will not send whispers to characters without any player in its "Can Be Edited & Controlled By" field, avoiding replication of whispers for GMs when talking through an NPC. v3.0.0 - Improved translation via hash (special thanks to Corin S.) Tongues now uses a hash to translate words, resulting in getting always the same translation to a given word. May cause weird translated sentences if not enough vocabulary is available. Examples & Screenshots I'm also leaving a few screenshots of some languages I configured for my own game for you to take as example: Disclaimer: my english is not perfect since i'm not a native speaker
1507761373
The Aaron
Pro
API Scripter
Nice! I notice you're parsing the handout on every message, you could do that once at startup, then have an on('change:handout',...) event to reparse it if it ever changes.  That should make message display much faster.
Looks very promising! I like this approach much better than the creating extra characters method.
Do players also have the ability to send a foreign language text? If so, does the GM get the translation? For instance, if the two PC elves in the party wanted to make fun of the barbarian's haircut and still keep all their limbs, and would the GM be aware of what is being said?
1507793625

Edited 1507801787
keithcurtis said: Do players also have the ability to send a foreign language text? If so, does the GM get the translation? For instance, if the two PC elves in the party wanted to make fun of the barbarian's haircut and still keep all their limbs, and would the GM be aware of what is being said? Yes, only GMs can create a language template, but every player in the game can use the speak command, the script was created after that purpose. If the token they have selected represents a character and that character's name appears on the GM Notes of the language, the script will do the job. If the character is not listed on the GM Notes, a "you can't speak that language" message is sent to the player using the command. Regardless the characters it controls, the GM always gets the original text whispered. In my game my players are supposed to run the command, then say by voice the translated text and then any speaker of the language can see what that really means in their chat as the whisper works like some kind of "subtitles" for what a player is saying.
1507794414
Ravenknight
KS Backer
This is very neat! Thanks.
1507799021
Loki
Pro
Sheet Author
Haven't tested it due to lack of an opportunity, but it sounds really nice! Thanks!
1507823400
The Aaron said: Nice! I notice you're parsing the handout on every message, you could do that once at startup, then have an on('change:handout',...) event to reparse it if it ever changes.  That should make message display much faster. Took your suggested approach to parsing handouts and it really works much faster. Thank you for that. Will upload the changes as soon as I can.
1507824068
The Aaron
Pro
API Scripter
Cheers!  =D
1507830306

Edited 1507981321
New  version is now available. v2.0.0 - Improved parsing (special thanks to The Aaron) Now languages are loaded and parsed on script startup or whenever created, changed or deleted. Tongues will look for any handout prefixed with "Tongues: " to load and parse them to make translations faster Restricted !tongues --create [name] command to only GMs. This command also will automatically prefix languages handouts it creates Added new examples & screenshots Thank you all!
1507830867
The Aaron
Pro
API Scripter
Looks great!  You even handled the removal of handouts, kudos!
1507846904

Edited 1507847364
I've made a little  update v2.1.0 - Improved character parsing The script now searches for full names when checking the speakers of a language, no more nicknames, now you must write the full name of the character. This will prevent malfunction because of characters with similar names. Leaving empty rows on a language list now doesn't causes the script to malfunction. If no vocabulary exists (empty rows) for a language, every word will be translated by sequences of '?' depending on word length. Will not send whispers to characters without any player in its "Can Be Edited & Controlled By" field, avoiding replication of whispers for GMs when talking through an NPC. Thank you all!
Coolbeans..
1507866954

Edited 1507867002
Corin S.
Pro
Sheet Author
This, uh, might not be proper coder's etiquette, but I made a slightly altered fork that uses a hash instead of a random selection, if you're interested. Results in the same word always being translated to a given word, though obviously there might be some overlap, and I'm not entirely sure if the distribution for translations will be roughly evenly distributed, but still.
1507879765
Corin S. said: This, uh, might not be proper coder's etiquette, but I made a slightly altered fork that uses a hash instead of a random selection, if you're interested. Results in the same word always being translated to a given word, though obviously there might be some overlap, and I'm not entirely sure if the distribution for translations will be roughly evenly distributed, but still. That's great! I would like to take a look at that, can you provide a link?
1507915681
Corin S.
Pro
Sheet Author
Here we are: https://github.com/cwstra/Tongues-Script
1507981279

Edited 1508026925
Corin S. said: Here we are:  https://github.com/cwstra/Tongues-Script Liked your approach more than the random one and implemented it into my own. I fixed an issue since hash can return negative values and then try to pick a word from a negative index of the array. Also I ensured that every word is hashed at lower case, resulting in the same translation for: "Hello" and "hello". Thank you very much! New version  available . v3.0.0 - Improved translation via hash (special thanks to Corin S.) Tongues now uses a hash to translate words, resulting in getting always the same translation to a given word. May cause weird translated sentences if not enough vocabulary is available..
1508018417

Edited 1508018436
Corin S.
Pro
Sheet Author
Glad you like it! In regards to the repeated vocabulary, we can just pretend it's some kind of enunciation thing. :P
I installed the script and I like it. I've found it is a little wonky finding players whose names are on the GM portion of the handout. I've found it's mostly characters with multi-part names that seem problematic My players like it, but the script crashed while we were playing. I had to disable the script and reset the API. I didn't manage to copy the error unfortunately. If the script crashes again, I'll make sure to copy the error and share it here. Suggestion . Maybe make a folder with files for languages that we can copy and easily add to our games. Anyways, good job. Looking forwards to future updates.
I'm wondering if i can add a "language" such as "Thieves Cant"  and have it set to translate only between people who know thieves cant? Thanks!
That's exactly what this script allows. The players who can't speak cant will just see different text. Thieves cant is an interesting idea. I have Elvish and Giant setup for my Storm King's Thunder campaign. These are languages shared by some party members.
1508342403
Spaceweasels said: I installed the script and I like it. I've found it is a little wonky finding players whose names are on the GM portion of the handout. I've found it's mostly characters with multi-part names that seem problematic My players like it, but the script crashed while we were playing. I had to disable the script and reset the API. I didn't manage to copy the error unfortunately. If the script crashes again, I'll make sure to copy the error and share it here. Suggestion . Maybe make a folder with files for languages that we can copy and easily add to our games. Anyways, good job. Looking forwards to future updates. I have names on my campaign like Therenvarys Ther Solaris or Eldon "Eyebrows" and the script is reading them well from the GM notes. Would you mind to explain how is it wonky? As for the error, the script may be unpolished, I also detected some errors and are trying to recreate and solve them. If it ever happens again on your game and you post the error here I will try to fix it. Regarding the folder with languages I pick most of them from WoW's wiki language section. They have a lot of them and they provide the words the game uses to generate the language. Anyways, I will upload mine to the GitHub as examples.
1508342794

Edited 1508342818
Terrelle S. said: I'm wondering if i can add a "language" such as "Thieves Cant"  and have it set to translate only between people who know thieves cant? Thanks! Yes, as Spaceweasels replied that's the script purpose. I'm working on a dictionary functionality that will allow you to declare a specific translation for a given word which the script will take if available before trying to hash the word. That will work specially well for Thieve's Cant as you can translate things like "steal" to "buy" or "assassinate" to "hug", since Thieve's Cant is more of a code language.
Sarkamist said: I have names on my campaign like Therenvarys Ther Solaris or Eldon "Eyebrows" and the script is reading them well from the GM notes. Would you mind to explain how is it wonky? It was wonky, but after I restarted the API, everything seems fine now. I'll keep you posted.
This is what I setup for my Thieves Cant. There are a lot of recognizable words, but the script will mix them up in a confusing stew. cant 1-letter words: [I, O, E] cant 2-letter words: [Ye, Ya, Ne, Ni, Oi, Do, Yo, It, To, Al, Hi, Lo, De, He, My, An, Is] cant 3-letter words: [Ace, Tha, Tho, Oft, Bum, Aft, Wit, Cor, Dim, Fit, Gag, Gob, Kip, Dem, Mug, Jab, Jut, Ful, Yon, Pas, Pis, Jit, Jig, Ale, Fur, Puf, Ire, Pip, Rat, Dog, Row, Sad, Sod, Row, Waz, Wat, Sky, Kit, Hit, Haz] cant 4-letter words: [Daft, Crap, Faff, Dull, Duck, Flog, Grem, Grub, Hast, Knob, Mate, Mush, Naff, Nesh, Nick, Twit, Nowt, Quid, Goat, Ring, Suss, Well, Kill, Skip, Rule, Ahoy] cant 5-letter words: [Dicky, Dishy, Haggy, Jammy, Jolly, Knock, Lurgy, Parky, Twats, Pinch, Pisst, Quite, Potty, Right, Tools, Knows, Rumpy, Senda, Quids, Pulls] cant 6-letter words: [Diddle, Crikey, Luvvly, Jubbly, Shirty, Rugger, Smarmy, Smegly, Sodall, Sorted, Todger, Nitwit, Watcha] cant 7-letter words: [Jollies, Shagged, Scrummy, Rubbish, Snogger, Sloshed, Squidgy, Squiffy, Wangles, Measure] cant 8-letter words: [Knockers, Shambles, Smashing, Stonkers, Waffler, Wobblers] cant 9-letter words: [Shambolic, Scrumming, Snookered, Stonkings, Yakkingly] cant 10-letter words: [Six-sevens] cant 11-letter words: [Pork'nbeans] cant 12-letter words: [Deep-stevens]
1508366453

Edited 1508428884
I've uploaded all the languages I use in my own campaign to a  new folder inside the script's GitHub repository.