Skip to content

Instantly share code, notes, and snippets.

@ashlux
Created August 10, 2009 22:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashlux/165471 to your computer and use it in GitHub Desktop.
Save ashlux/165471 to your computer and use it in GitHub Desktop.
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.");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment