Closed Sojournophile closed 10 months ago
I'll investigate some more, here's an error I get:
foundry.js:753 TypeError: Error thrown in hooked function '' for hook 'createChatMessage'. Cannot read properties of undefined (reading 'understands')
[Detected 1 package: theatre]
at Object.fn (theatre_main.js:438:28)
at #call (foundry.js:730:20)
at Hooks.callAll (foundry.js:687:17)
at ClientDatabaseBackend.callback (foundry.js:13537:13)
at foundry.js:13509:43
at Array.map (
I'll look and see if polyglot has changed its fields
This successfully scrambles the string of unknown languages:
if (typeof polyglot !== 'undefined') {
// Get current language being processed
const lang = chatData.flags.polyglot.language;
// Fetch the languages known by current user
let langs = game.polyglot.getUserLanguages();
let understood = false;
for (lang_set of langs.values()) {
for (item of lang_set.values()) {
// If the user has a matching language in their list, we understand it
if (lang == item) {
understood = true;
break;
}
}
}
if (!understood) {
// If not understood, scramble the text
const fontStyle = game.polyglot._getFontStyle(lang);
fontSize *= Math.floor(Number(fontStyle.slice(0,3))/100);
insertFontType = fontStyle.slice(5);
textContent = game.polyglot.scrambleString(textContent, chatData._id, lang);
}
}
I put it around line 454, the next line after it is
charSpans = Theatre.splitTextBoxToChars(textContent, textBox);
and I moved the snippet initialising fontSize above it
I can make this a PR, but I know basically no JS, this was just a quick fix; if you think it is fine as is, let me know and I'll fork and make a PR. Thanks
That might work as a PR, yes; if at the very least, it'll let me see the code all together at once. I'll be sure to give it a doublecheck just in case something unexpected happens with it (keeping this open for the time being).
I can confirm that his code at least works, since we just ran our session with the fix. Not sure if there's anything long term that will happen to this fix, "but it works" and that's what counts.
Yup, looks like the PR works; I'll be leaving this issue open in case someone might have a better solution (if one exists) to cover all of the polyglot cases.
Cheers! I'll keep looking at it later in the week on a fork and PR if I manage to find a more elegant solution.
Hello, could there possibly be a release of this for v10, for those who have not yet updated due to other module incompatibility or other instability with v11 is sorted? I'm currently stuck on v10 until a system and several of the modules I use update, and I am still encountering some bugs on updated modules. I would like to use this fix if possible, as I use Polyglot.
Kind regards.
Actually, I found a bug maybe?
The GM will always have text garbled for them with the polyglot patch, and the garbled text doesn’t use what specific fonts you put in for polyglot as their “default font” if you don’t know it.
(Sorry for the poor resolution. Trying to use steam link at work to show the issue.)
I think the fonts were that way in the original integration, I don't think using the actual polyglot runes is possible with theatre. One is a set of animated sprites the other is a font file. Scrambling the text in its original theatre font is just an approximation of the gameplay effect - obfuscating unknown languages. As for the GM thing, I don't know - works on my machine. As GM I see all languages unscrambled in theatre box and text chat. re: rjb, I have no intent of adding this for v10, sorry. This was just a personal fix for my own game that I decided to push here. You could probably recreate it in a similar fashion yourself, though.
Hello, Thank you very much for updating Theatre to Foundry 11. I love this module.
43 indicates that polyglot support was added a couple years ago, but I cannot seem to find any settings relating to it. All my text boxes come out in readable English instead of scrambled polyglot runes.
I tried re-implementing #43 myself, but now no text displays in the boxes at all. If there's anyway to re-enable polyglot support, or if I'm missing something to turn it on, that would be great. Thanks for your time.