Extension:Dice

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
Crystal Clear action run.svg
Dice
Release status: unmaintained
Implementation Extended syntax, Tag, Special page, Database
Description Adds the ability to automatically substitute random dice when an edit is saved, and logs the dice being rolled to a special page.
Author(s) Corentalk
MediaWiki 1.17+
Database changes Yes
License Creative Commons Attribution Share Alike 3.0
Download Git [Help]
Example http://nomicwiki.com
Tags
<dice>
Added rights
rolldice, checkrolls
Hooks used
ArticleSave
ArticleSaveComplete
Translate the Dice extension if it is available at translatewiki.net
Check usage and version matrix.

The Dice extension adds the ability to automatically substitute random dice when an edit is saved, and logs the dice being rolled to a special page.

When an edit is saved, requests for dice rolls in the form @@xdy cause dice to be "rolled" and logged, and are substituted with a tag that displays the result.

Roll results are intended to be tamper-proof, and easily verifiable. The extension provides a special page where dice roll logs can be examined.

Usage[edit]

Provides a magic keyword that is substituted when a page is saved with the appropriate <dice> tag to display the result of a roll. The dice tag can be moved around, but remains attached to a log entry and will resist modification of the result.

Dice roll keywords are "standard" roll specifications prefixed with @@; specific accepted formats are as below:

Formula Description Example
@@[x]dy roll x (default 1) y-sided dice @@3d6 to roll 3 6-sided dice
@@[x]dybn roll x (default 1) y-sided dice, keeping the best n @@3d6b2 to roll 3 6-sided dice, keeping the best 2

Installation[edit]

  1. From your $IP/extensions/ directory, check out the Dice extension with
    git clone https://www.uberbox.org/git/Dice.git
    
  2. Add the following line to the bottom of LocalSettings.php (though not after trailing ?>, if it is present):
    require_once("$IP/extensions/Dice/Dice.php");
    
  3. This extension adds a table to the database to hold the results of dice rolls, so you need to run the update script (instructions).
  4. Installation can now be verified through Special:Version of your wiki.

User rights[edit]

rolldice: user can roll dice by saving a page with the magic keyword, and can use the Special:Dice special page to check their roll history. checkrolls: user can use Special:Dice to check the history of rolls of users other than themselves.

E.g., if you want everyone to be able to roll dice and check rolls:

$wgGroupPermissions['*']['rolldice']    = true;
$wgGroupPermissions['*']['checkrolls']    = true;