-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chat message created with a macro is always in Common #54
Comments
Might be linked to issue #37 |
I think the issue is in the macro command : It should probably be like this instead : 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 |
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:
|
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 |
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}); |
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. |
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:
|
Welp, you're awesome @drewg13 ... I should have though of that. Thanks guys! |
Hello all,
I am triggering a macro from a MultiLevelTokens drawing area to speak as a token located elsewhere in the dungeon. When a player enters the drawing, it calls the below macro with the following arguments:
args[0] = V7AHiqGDjtQGvGtE
args[1] = "The Spider Queen blesses House Auvryndar! The battle to break House Freth's hold on the passages below brings victory after victory. We have seized key positions formerly held by our enemy. The defeat of House Freth is inevitable. Praise Lolth!"
args[2] = Elvish
args[3] = 2
The args[0] token knows Elvish and I have tried to trigger the macro with a non-elvish speaking character and an elvish speaking character. It always comes out the same in comon.
The text was updated successfully, but these errors were encountered: