Hey all, I'm working with something that I'm sure is simple but, despite 2 hours of Googling, I can't find a solution. I'm working with an API to roll an attack and all I want to do is save the result of the roll outside of the callback function. I have: sendChat('', txt, function(ops) //txt is the inline dice roll (ex. [[1d20+8]])
{
rollResult = ops[0].inlinerolls[0].results.total;
log(rollResult);
} and I want to use the value of rollResult outside of the callback. The fact that sendChat is asynchronous seems to be what's killing me. I've tried adding sleep methods, re-scoping the rollResult variable, scouring StackOverflow and this forum, and still can't find any way to get that value out of the callback and back into my "main script".