Advertisement Create a free account

3d dice via API with send chat.

is there any way I can have a 3d dice with a sendchat function with a callback parameter? Example: on("chat:message", function(msg) { .       if (msg.content == "!bow"){          sendChat(msg.who,"/r 1d20",function(ops){                        //if is a critical hit roll double damage, if not roll normal damage                })     }   });
The Aaron
Forum Champion
API Scripter
Nope. If you want 3D dice from the API, your messsge must go to chat.  However, you should be able to fake it by having the chat output an API command which you then respond to. You’d need to store anything you need to deal with from the issuing code so you can pick it up again in the next command. You can do that by creating a unique id and using it as both the index of a an object, and an argument to the command. Look at the push functionality in my Mutant Year Zero script for an example.