So, for full clarity, I opened the macro file you have and copied this:
//This code works with WhisperBox. Save it as a macro to give yourself an alternative method
//of launching a WhisperBox that will also work for players.
var users = game.users.contents;
var selectOptions = ""
users.forEach(user => selectOptions+=<option value = "${user.id}">${user.name}</option>\n);
var dp = {
title:"Create a WhisperBox",
content:Pick a user:<select id="users" name="users">${selectOptions}</select>,
//default:"whisper",
buttons:{
whisper:{
label:"Whisper", callback:() => {
let uid=document.getElementById("users").value;
console.log(uid);
let user = game.users.find(user => user.id===uid);
let name = user.name;
let opt = Dialog.defaultOptions;
opt.resizable=false;
opt.title=Whispering to ${name};
opt.width=400;
opt.height="auto";
opt.minimizable=true;
opt.resizable=true;
var target=uid;
var whisperbox = new WhisperBox (opt, data, target);
whisperbox.render(true);
whisperbox.getHistory();
var data = user;
Hooks.on('renderChatMessage', function(html, data){
whisperbox.getHistory();
});
}}
}
}
let d = new Dialog(dp);
d.render(true);
Then I pasted that into a macro on the hotbar, set it to script instead of chat, and tried it. I get a syntax error every time. Any advice or better instructions would be appreciated. Or, could you make the "button" to send a message to someone moved down to the bottom left player roster? and make it where dm's and players can all use it. It is very useful for players, but instead it's kind of odd to use it and doesn't really make for an obvious usage.
So, for full clarity, I opened the macro file you have and copied this:
//This code works with WhisperBox. Save it as a macro to give yourself an alternative method
//of launching a WhisperBox that will also work for players.
var users = game.users.contents;
var selectOptions = ""
users.forEach(user => selectOptions+=
<option value = "${user.id}">${user.name}</option>\n);var dp = {
title:"Create a WhisperBox",
content:
Pick a user:<select id="users" name="users">${selectOptions}</select>,//default:"whisper",
buttons:{
whisper:{
label:"Whisper", callback:() => {
let uid=document.getElementById("users").value;
console.log(uid);
let user = game.users.find(user => user.id===uid);
let name = user.name;
let opt = Dialog.defaultOptions;
opt.resizable=false;
opt.title=
Whispering to ${name};opt.width=400;
opt.height="auto";
opt.minimizable=true;
opt.resizable=true;
var target=uid;
var whisperbox = new WhisperBox (opt, data, target);
whisperbox.render(true);
whisperbox.getHistory();
var data = user;
Hooks.on('renderChatMessage', function(html, data){
whisperbox.getHistory();
});
}}
}
}
let d = new Dialog(dp);
d.render(true);
Then I pasted that into a macro on the hotbar, set it to script instead of chat, and tried it. I get a syntax error every time. Any advice or better instructions would be appreciated. Or, could you make the "button" to send a message to someone moved down to the bottom left player roster? and make it where dm's and players can all use it. It is very useful for players, but instead it's kind of odd to use it and doesn't really make for an obvious usage.