Does anyone have a copy of the Dice extension? The download link is dead at https://www.mediawiki.org/wiki/Extension:Dice
It looks like they were going to mirror it, but I'm not sure that ever happened: https://github.com/wikimedia/mediawiki-extensions-Dice
Thanks.
Since no one seems to have a copy, I just went ahead and re-implemented it. You put this code in your LocalSettings.php, and then any time you want to roll dice, you make an edit that includes @@ROLL@@ in the wikitext. The DiceRoller system user will then immediately make an edit replacing @@ROLL@@ with a number between 1 and 6, and link to the diff for easy auditing.
function onDiceRoll( $article, $user, $content, $summary, $isMinor, $isWatch, $section, $flags, $revision, $status, $baseRevId ) { global $alreadyCheckedForDice; global $wgDiceRoller; if ( $alreadyCheckedForDice ) { return true; } $alreadyCheckedForDice = true; $text = ContentHandler::getContentText( $content ); $diceCommand = '@@ROLL@@'; $summary = 'Roll(s):'; while ( true ) { if ( strpos( $text, $diceCommand ) === false ) { break; } $dieRoll = rand( 1, 6 ); $revId = $revision->getId(); $dieRollText = "[[Special:Diff/$revId/next|$dieRoll]]"; $summary .= " $dieRoll"; $text = str_replace_first( $diceCommand, $dieRollText, $text ); } echo $text; $content = ContentHandler::makeContent( $text, $article->getTitle() ); $user = User::newSystemUser( $wgDiceRoller ) ; if ( $user === false ) { return true; } $article->doEditContent( $content, $summary, 0, false, $user ); return true; }
$wgHooks['PageContentSaveComplete'][] = 'onDiceRoll'; $alreadyCheckedForDice = false; $wgDiceRoller = 'DiceRoller';
On Wed, Jun 14, 2017 at 8:42 PM, Jean Valjean jeanvaljean2718@gmail.com wrote:
Does anyone have a copy of the Dice extension? The download link is dead at https://www.mediawiki.org/wiki/Extension:Dice
It looks like they were going to mirror it, but I'm not sure that ever happened: https://github.com/wikimedia/mediawiki-extensions-Dice
Thanks.
Oh yeah, and you gotta include this too:
function str_replace_first($from, $to, $subject) { $from = '/'.preg_quote($from, '/').'/'; return preg_replace($from, $to, $subject, 1); }
On Wed, Jun 14, 2017 at 10:17 PM, Jean Valjean jeanvaljean2718@gmail.com wrote:
Since no one seems to have a copy, I just went ahead and re-implemented it. You put this code in your LocalSettings.php, and then any time you want to roll dice, you make an edit that includes @@ROLL@@ in the wikitext. The DiceRoller system user will then immediately make an edit replacing @@ROLL@@ with a number between 1 and 6, and link to the diff for easy auditing.
function onDiceRoll( $article, $user, $content, $summary, $isMinor, $isWatch, $section, $flags, $revision, $status, $baseRevId ) { global $alreadyCheckedForDice; global $wgDiceRoller; if ( $alreadyCheckedForDice ) { return true; } $alreadyCheckedForDice = true; $text = ContentHandler::getContentText( $content ); $diceCommand = '@@ROLL@@'; $summary = 'Roll(s):'; while ( true ) { if ( strpos( $text, $diceCommand ) === false ) { break; } $dieRoll = rand( 1, 6 ); $revId = $revision->getId(); $dieRollText = "[[Special:Diff/$revId/next|$dieRoll]]"; $summary .= " $dieRoll"; $text = str_replace_first( $diceCommand, $dieRollText, $text ); } echo $text; $content = ContentHandler::makeContent( $text, $article->getTitle() ); $user = User::newSystemUser( $wgDiceRoller ) ; if ( $user === false ) { return true; } $article->doEditContent( $content, $summary, 0, false, $user ); return true; }
$wgHooks['PageContentSaveComplete'][] = 'onDiceRoll'; $alreadyCheckedForDice = false; $wgDiceRoller = 'DiceRoller';
On Wed, Jun 14, 2017 at 8:42 PM, Jean Valjean jeanvaljean2718@gmail.com wrote:
Does anyone have a copy of the Dice extension? The download link is dead at https://www.mediawiki.org/wiki/Extension:Dice
It looks like they were going to mirror it, but I'm not sure that ever happened: https://github.com/wikimedia/mediawiki-extensions-Dice
Thanks.
Heiya Jean,
I'd rather see this is some repo either at GitHub, WMF or elsewhere at your choice. It will be nice if you could publish the exension and maintain it. Also updating the extensions page accordingly will be good too. Otherwise people will have the same issue you had today, but not everybody may be able to just program an new one.
Cheers Karsten
Am 15.06.2017 um 04:18 schrieb Jean Valjean:
Oh yeah, and you gotta include this too:
function str_replace_first($from, $to, $subject) { $from = '/'.preg_quote($from, '/').'/'; return preg_replace($from, $to, $subject, 1); }
On Wed, Jun 14, 2017 at 10:17 PM, Jean Valjean jeanvaljean2718@gmail.com wrote:
Since no one seems to have a copy, I just went ahead and re-implemented it. You put this code in your LocalSettings.php, and then any time you want to roll dice, you make an edit that includes @@ROLL@@ in the wikitext. The DiceRoller system user will then immediately make an edit replacing @@ROLL@@ with a number between 1 and 6, and link to the diff for easy auditing.
function onDiceRoll( $article, $user, $content, $summary, $isMinor, $isWatch, $section, $flags, $revision, $status, $baseRevId ) { global $alreadyCheckedForDice; global $wgDiceRoller; if ( $alreadyCheckedForDice ) { return true; } $alreadyCheckedForDice = true; $text = ContentHandler::getContentText( $content ); $diceCommand = '@@ROLL@@'; $summary = 'Roll(s):'; while ( true ) { if ( strpos( $text, $diceCommand ) === false ) { break; } $dieRoll = rand( 1, 6 ); $revId = $revision->getId(); $dieRollText = "[[Special:Diff/$revId/next|$dieRoll]]"; $summary .= " $dieRoll"; $text = str_replace_first( $diceCommand, $dieRollText, $text ); } echo $text; $content = ContentHandler::makeContent( $text, $article->getTitle() ); $user = User::newSystemUser( $wgDiceRoller ) ; if ( $user === false ) { return true; } $article->doEditContent( $content, $summary, 0, false, $user ); return true; }
$wgHooks['PageContentSaveComplete'][] = 'onDiceRoll'; $alreadyCheckedForDice = false; $wgDiceRoller = 'DiceRoller';
On Wed, Jun 14, 2017 at 8:42 PM, Jean Valjean jeanvaljean2718@gmail.com wrote:
Does anyone have a copy of the Dice extension? The download link is dead at https://www.mediawiki.org/wiki/Extension:Dice
It looks like they were going to mirror it, but I'm not sure that ever happened: https://github.com/wikimedia/mediawiki-extensions-Dice
Thanks.
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Well, my extension isn't as powerful or as nice as his was. It would be better if we could get his extension. It looks like there's only one site (RPG wiki) that still uses it: https://wikiapiary.com/wiki/Extension:Dice
I wasn't able to get past their CAPTCHA to create an account, though. It says "Unscramble the magic word to create an account: xyyzz" http://inky.org/wiki/index.php?title=Special:UserLogin&returnto=Main+Pag...
On Thu, Jun 15, 2017 at 4:30 AM, [[kgh]] mediawiki@kghoffmeyer.de wrote:
Heiya Jean,
I'd rather see this is some repo either at GitHub, WMF or elsewhere at your choice. It will be nice if you could publish the exension and maintain it. Also updating the extensions page accordingly will be good too. Otherwise people will have the same issue you had today, but not everybody may be able to just program an new one.
Cheers Karsten
See https://en.wikipedia.org/wiki/Xyzzy_(computing) :)
On Thu, Jun 15, 2017 at 5:13 PM, Jean Valjean jeanvaljean2718@gmail.com wrote:
Well, my extension isn't as powerful or as nice as his was. It would be better if we could get his extension. It looks like there's only one site (RPG wiki) that still uses it: https://wikiapiary.com/wiki/Extension:Dice
I wasn't able to get past their CAPTCHA to create an account, though. It says "Unscramble the magic word to create an account: xyyzz" http://inky.org/wiki/index.php?title=Special:UserLogin&returnto=Main+Pag...
On Thu, Jun 15, 2017 at 4:30 AM, [[kgh]] mediawiki@kghoffmeyer.de wrote:
Heiya Jean,
I'd rather see this is some repo either at GitHub, WMF or elsewhere at your choice. It will be nice if you could publish the exension and maintain it. Also updating the extensions page accordingly will be good too. Otherwise people will have the same issue you had today, but not everybody may be able to just program an new one.
Cheers Karsten
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
I assume you'll hear back from Dan Shiovitz, admin for inky.org. But If you need more contact info, I hope you saw this: https://inky.org/resume.html
btw, I don't understand the utility of this extension. Is it useful for game wikis?
~ Greg
A while back, we needed a similar functionality (a random number generated on the wiki upon page save that would be permanently available afterwards) in fawiki, to use it as a last-resort tie breaker for a certain election. We ended up using the page_random field (it is a random number between 0 and 1, which can be easily converted to an integer between 1-6 or whatever other range desired).
The point is, I would support (re)creating an extension like this, and hopefully enabling it on WMF wikis as well.
PS: I tried to fetch the source of that project via Archive.org but was not successful.[1]
[1] https://web.archive.org/web/20160303193209/https://www.uberbox.org/gitweb/?p...
On Thu, Jun 15, 2017 at 10:02 PM, Greg Rundlett (freephile) < greg@freephile.com> wrote:
I assume you'll hear back from Dan Shiovitz, admin for inky.org. But If you need more contact info, I hope you saw this: https://inky.org/resume.html
btw, I don't understand the utility of this extension. Is it useful for game wikis?
~ Greg _______________________________________________ MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
The use case I have in mind is a game of nomic. Rule 202 https://legacy.earlham.edu/%7Epeters/writing/nomic.htm#202 states, "One turn consists of two parts in this order: (1) proposing one rule-change and having it voted on, and (2) throwing one die once and adding the number of points on its face to one's score. In mail and computer games, instead of throwing a die, players subtract 291 from the ordinal number of their proposal and multiply the result by the fraction of favorable votes it received, rounded to the nearest integer. (This yields a number between 0 and 10 for the first player, with the upper limit increasing by one each turn; more points are awarded for more popular proposals.)"
Pondering that arithmetic gives me a headache, so I'd rather just come up with a way to roll a die. Also, some versions of nomic don't even provide for a non-die option, saying simply something like, "Any time a player receives the Turn, this player rolls a fair die. If the value rolled is not a computable number, nothing happens. Otherwise, the player then adds the number rolled to their score, unless doing so would cause a player to win, or to be Charlie Sheen; in these cases the number is instead subtracted from their score."
On Thu, Jun 15, 2017 at 10:54 PM, Huji Lee huji.huji@gmail.com wrote:
A while back, we needed a similar functionality (a random number generated on the wiki upon page save that would be permanently available afterwards) in fawiki, to use it as a last-resort tie breaker for a certain election. We ended up using the page_random field (it is a random number between 0 and 1, which can be easily converted to an integer between 1-6 or whatever other range desired).
The point is, I would support (re)creating an extension like this, and hopefully enabling it on WMF wikis as well.
PS: I tried to fetch the source of that project via Archive.org but was not successful.[1]
[1] https://web.archive.org/web/20160303193209/https://www. uberbox.org/gitweb/?p=Dice.git;a=summary
On Thu, Jun 15, 2017 at 10:02 PM, Greg Rundlett (freephile) < greg@freephile.com> wrote:
I assume you'll hear back from Dan Shiovitz, admin for inky.org. But If you need more contact info, I hope you saw this: https://inky.org/resume.html
btw, I don't understand the utility of this extension. Is it useful for game wikis?
~ Greg _______________________________________________ MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org