p4535992 / foundryvtt-better-rolltables

Module for FoundryVTT to improve rolltables
MIT License
3 stars 4 forks source link

[BUG] Loot Generation Chat Message #33

Closed jknolte closed 7 months ago

jknolte commented 7 months ago

This option doesn't generate a message in chat when loot is generated to a token. image

Since this option was broken, I also tried to modify my macro that generates a loot item on a character using BRT but I'm unable to get the generated item to display in chat. The macro executes and generates an item on the token but it doesn't display in chat despite the [options.displayChat=true].

// Draw from a table that contains items and add the items to a selected token's actor.

const table  = game.tables.getName("Magic Item Loot Roll A-C");

const receiver = token?.actor;
if (!table || !receiver) {
  ui.notifications.warn("Missing table or selected token.");
  return null;
}

game.betterTables.addLootToSelectedToken(table, receiver, [options.displayChat=true]);
p4535992 commented 7 months ago

The macro is not right here (unfortunately it's jsdoc syntax is that way):

// Draw from a table that contains items and add the items to a selected token's actor.

const table  = game.tables.getName("Magic Item Loot Roll A-C");
const token = canvas.tokens.controlled[0]; // Get the first token selected
const receiver = token?.actor;
if (!table || !receiver) {
  ui.notifications.warn("Missing table or selected token.");
  return null;
}

game.betterTables.addLootToSelectedToken(table, receiver, {displayChat:true});

anyway i cleaned up the old settings in favor of the api macro approach and bug fixing some stuff, try out version 2.1.8 and let me know it

jknolte commented 7 months ago

Seems to be working now! Thank you :)