-
-
Save ashlux/165471 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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