Comments (8)
Might be linked to issue #37
from fvtt-module-polyglot.
I think the issue is in the macro command :
$(`#polyglot select option [value=${args[2]}]`).attr("selected","selected");
It should probably be like this instead :
$(`#polyglot select`).val(args[2]);
Setting the option as selected wouldn't change the actual select's value I think. Do you actually see it change in the UI ? If not, try the above and see if it works.
Though you should use the language id not its translated string (so elvish
instead of Elvish
)
from fvtt-module-polyglot.
I had the "bright" idea of upgrading Foundry to 0.7.5... same behavior as before.
Sad to report that the changed line triggers an error in the console:
SyntaxError: private fields are not currently supported
_doMacros http://192.168.1.*:30000/modules/multilevel-tokens/multilevel.js:856
_onUpdateToken http://192.168.1.*:30000/modules/multilevel-tokens/multilevel.js:1579
_call http://192.168.1.*:30000/scripts/foundry.js:2426
callAll http://192.168.1.*:30000/scripts/foundry.js:2386
callOriginalFunction http://192.168.1.*:30000/modules/**furnace**/Patches/Patches.js:57
<anonymous> http://192.168.1.*:30000/modules/**furnace**/QoL/Debug.js:33
_handleUpdateEmbeddedEntity http://192.168.1.*:30000/scripts/foundry.js:29647
_handleUpdateEmbeddedEntity http://192.168.1.*:30000/scripts/foundry.js:33793
updateEmbeddedEntity http://192.168.1.*:30000/scripts/foundry.js:29615
multilevel.js:859:21
_doMacros http://192.168.1.*:30000/modules/multilevel-tokens/multilevel.js:859
_onUpdateToken http://192.168.1.*:30000/modules/multilevel-tokens/multilevel.js:1579
_call http://192.168.1.*:30000/scripts/foundry.js:2426
callAll http://192.168.1.*:30000/scripts/foundry.js:2386
callOriginalFunction http://192.168.1.*:30000/modules/**furnace**/Patches/Patches.js:57
<anonyme> http://192.168.1.*:30000/modules/**furnace**/QoL/Debug.js:33
_handleUpdateEmbeddedEntity http://192.168.1.*:30000/scripts/foundry.js:29647
_handleUpdateEmbeddedEntity http://192.168.1.*:30000/scripts/foundry.js:33793
updateEmbeddedEntity http://192.168.1.*:30000/scripts/foundry.js:29615
from fvtt-module-polyglot.
Those errors clearly say they're from multilevel tokens module, it has nothing to do with chat messages or polyglot. Try the macro on its own, without the timeout and all the other stuff around it and see if it works
from fvtt-module-polyglot.
Heya Kakaroto, triggering the macro without all the extra stuff still happens on the polyglot line.
With the following macro, I get an error about Private Fields not supported
let t = canvas.tokens.get(args[0]);
//target token
//set language?
$(`#polyglot select).val(args[2]);
ChatMessage.create(
{
speaker : { token : t, actor : t.actor, scene : canvas.scene },
content : args[1],
type : CONST.CHAT_MESSAGE_TYPES.IC,
},{chatBubble : false});
With this script, there is no error, but the message is always in common (even passing elvish as a parameter)
let t = canvas.tokens.get(args[0]);
//target token
//set language?
$(`#polyglot select option [value=${args[2]}]`).attr("selected","selected");
ChatMessage.create(
{
speaker : { token : t, actor : t.actor, scene : canvas.scene },
content : args[1],
type : CONST.CHAT_MESSAGE_TYPES.IC,
},{chatBubble : false});
from fvtt-module-polyglot.
I'm a moron... I never noticed that the code you suggested was missing a `
This almost works:
let t = canvas.tokens.get(args[0]);
//target token
//set language?
$(`#polyglot select`).val(args[2]);
ChatMessage.create(
{
speaker : { token : t, actor : t.actor, scene : canvas.scene },
content : args[1],
type : CONST.CHAT_MESSAGE_TYPES.IC,
},{chatBubble : false});
The issue is that if the triggering token does not speak the required language, it simply outputs in common. Those tests are done on a GM account btw.
from fvtt-module-polyglot.
I was working on this exact problem and your code got me most of the way there and advice from kakaroto on Discord finished the job. Here's code that does the trick by switching control to a "speaking" token that has the target language enabled and then back to the player token afterwards:
let speakactor = game.actors.entities.find(c => c.name === args[0]);
let speaktoken = canvas.tokens.placeables.find(p => p.name === args[0]);
let playertoken = token;
speaktoken.control();
$(`#polyglot select`).val(args[2]);
ChatMessage.create(
{
speaker : { token : speaktoken, actor : speakactor, scene : canvas.scene },
content : args[1],
type : CONST.CHAT_MESSAGE_TYPES.IC,
},{chatBubble : false});
playertoken.control();
from fvtt-module-polyglot.
Welp, you're awesome @drewg13 ... I should have though of that.
Thanks guys!
from fvtt-module-polyglot.
Related Issues (20)
- Using Polyglot in Journal Entries Impossible HOT 9
- text not parsing when module enabled HOT 2
- 17 warning about fonts! HOT 1
- Polyglot broken after 1.8.4.x update | Cyberpunk Red
- Polyglot seems broken on ProseMirror's journal pages? HOT 3
- Scrambled chat bubbles truncated
- [BUG] Polyglot - Language selection only shows other languages to GM. - Non-standard system. HOT 4
- Language Support for Worlds Without Number HOT 3
- Polyglot language dropdown not visible when logged into a game in Safari HOT 10
- Polyglot and chat bubbles HOT 3
- Can't add custom fonts directory HOT 2
- "Add Polyglot's fonts to Core" setting overwrites user-uploaded fonts HOT 1
- Sharing compendium entry in chat is broken when a language other than common is used HOT 6
- [Reopen #279] Sharing compendium entry in chat is broken when a language other than common is used HOT 1
- currentLanguageProvider erroring on migrated WWN save HOT 3
- Only Randomize Non-Alphanumerical Characters Option
- Randomized characters as a per language setting HOT 1
- Missing languages in Shadowrun 5e HOT 1
- "/me" doesn't work great with this module HOT 2
- Journal (and other object) titles as other language
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fvtt-module-polyglot.