
I'm not sure how to effectively search for other threads with this, so I'll just ask.
I want to make a roll from inside an API script (this is working). I want to do something interesting with the total (also working). I also want to re-chat the pretty, formatted, colourful, hoverable object that would have been the result, if I hadn't co-opted the handler function.
Simple sample:
on("ready", function(msg)
{
sendChat("Test", "1d4: [[1d4]]", function(msg)
{
log(msg[0]);
var roll = msg[0].inlinerolls["1"];
var total = roll.results.total;
doSomethingInteresting(total);
// But also log the nicely-displayed results...
sendChat("Test", "1. " + msg[0]);
sendChat("Test", "2. " + msg[0].content);
sendChat("Test", "3. " + msg[0].inlinerolls);
sendChat("Test", "4. " + msg[0].inlinerolls["1"]);
sendChat("Test", "5. " + roll);
sendChat("Test", "6. " + roll.results);
});
});
function doSomethingInteresting(t)
{
sendChat("Test", "Something interesting! " + t);
}
Most of them output: [object Object]
2 waits a bit and then outputs: 1d4: $[_1_]
...where [_1_] is a formatted result like I want, except that a) it always shows a 1 when the actual result may have been something else, and b) hovering over it always says "Rolling 1 = 1".
Any advice?
Thanks!
I want to make a roll from inside an API script (this is working). I want to do something interesting with the total (also working). I also want to re-chat the pretty, formatted, colourful, hoverable object that would have been the result, if I hadn't co-opted the handler function.
Simple sample:
on("ready", function(msg)
{
sendChat("Test", "1d4: [[1d4]]", function(msg)
{
log(msg[0]);
var roll = msg[0].inlinerolls["1"];
var total = roll.results.total;
doSomethingInteresting(total);
// But also log the nicely-displayed results...
sendChat("Test", "1. " + msg[0]);
sendChat("Test", "2. " + msg[0].content);
sendChat("Test", "3. " + msg[0].inlinerolls);
sendChat("Test", "4. " + msg[0].inlinerolls["1"]);
sendChat("Test", "5. " + roll);
sendChat("Test", "6. " + roll.results);
});
});
function doSomethingInteresting(t)
{
sendChat("Test", "Something interesting! " + t);
}
Most of them output: [object Object]
2 waits a bit and then outputs: 1d4: $[_1_]
...where [_1_] is a formatted result like I want, except that a) it always shows a 1 when the actual result may have been something else, and b) hovering over it always says "Rolling 1 = 1".
Any advice?
Thanks!