public
Last active

  • Download Gist
x.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
CmdUtils.CreateCommand({
names: ["roll"],
icon: "http://ashlux.com/favicon.ico",
description: "Roll a die with the given ",
help: "TODO",
author: {name: "Ash Lux", email: "ashlux@gmail.com"},
license: "GPL",
homepage: "http://www.ashlux.com/wordpress/ubiquity-commands",
arguments: [{role: 'object', nountype: noun_arb_text}],
preview: function preview(pblock, args) {
pblock.innerHTML = "Roll a <b>" + args.object.html + "-sided die.</b>.";
},
execute: function execute(args) {
var randomnumber=Math.floor(Math.random()* args.object.text + 1);
var doc = CmdUtils.getWindowInsecure();
doc.alert("You rolled a " + randomnumber + " on a " + args.object.text + "-sided die.");
}
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.