Jump to content

Photo

Dice roller for the boards


  • Please log in to reply
6 replies to this topic

#1 Diabolical_Jazz

Diabolical_Jazz

    Gigabyte

  • Members
  • 959 posts

Posted 27 January 2013 - 06:35 AM

So, we could have an awful lot of fun with a dice rolling program were it to be somehow embedded into the forums. I don't know a whole lot about programming, but it seems to me that it could be plausible to have a dice rolling program that would function on the boards, with some minor thing separating the text so that it wouldn't be easy to fake the rolls.

You could run several tabletop RPG's with just a d20, d10, and d6. And I am pretty sure there's open source dice rollers out there.

What'choo think, Spleen?
I don't think he needs to be immortal. I think all he needs to do is to write the right story. Because some stories do live forever.

#2 SpleenBeGone

SpleenBeGone

    Deer Leader of the Goriest Revolution

  • Administrators
  • 14,951 posts
  • LocationHouston

Posted 27 January 2013 - 06:51 AM

That could be pretty interesting.
nmjUGDL.jpg

#3 Diabolical_Jazz

Diabolical_Jazz

    Gigabyte

  • Members
  • 959 posts

Posted 27 January 2013 - 07:14 AM

Right?

I mean, for most tabletop RPG's, you don't really *need* a map. You can get by with the players and DM keeping track of where everyone is. Most of the time it's just like, "You're in a 10ft by 10ft room with a table in the middle." And it's not hard to keep track of the spacial stuff in your head in that case. Most of the games I've played have been like that.

So yeah, a dice roller could enable us to play tabletop RPG's on the boards themselves, for those willing to be a little imaginative.

D&D requires the most dice of any system, I think. It needs everything from a d20 down to a d4, basically.
d20, d12, d10, d8, d6, d4.
I don't think he needs to be immortal. I think all he needs to do is to write the right story. Because some stories do live forever.

#4 K_N

K_N

    Megabyte

  • Members
  • 576 posts
  • LocationPhoenix

Posted 27 January 2013 - 12:24 PM

Pretty easily done, actually. If it doesn't already exist, I could implement it in a couple minutes time.

You could just use this function on reading posts so people can do [roll]12[/roll] for a 12 sided die.



function dice_roll($post_text, $user) {
if(strpos($post_text, '[roll]') {
	$start = strpos($post_text, '[roll]');
	$end = strpos($post_text, '[/roll]');
	$roll = substr($post_text, $start, ($end - $start));
	if(is_numeric($roll) {
		$result = mt_rand(1, $roll);
		$roll_text = $user . ' rolled a ' . $roll . ' sided die and got ' . $result;
		$post_text = str_replace('\[roll\][0-9]+\[/roll\]', $roll_text, $post_text);
	} else {
		return $post_text
	}
} else {
	return $post_text
}
Haven't had my coffee, so not the most efficient job and the regex is probably wrong, but you get the idea....

Usage would be just to run this function on the post body before echoing it. Could also stick a while loop in it to catch every die roll in the post instead of one.

Rumors of my demise have been greatly exaggerated.


#5 Guest_ElatedOwl_*

Guest_ElatedOwl_*
  • Guests

Posted 27 January 2013 - 12:26 PM

How do you imagine this working? bbcode tag? IE something like
[dice sides=20]
would output something like

Dice roll (20): 5



#6 Diabolical_Jazz

Diabolical_Jazz

    Gigabyte

  • Members
  • 959 posts

Posted 27 January 2013 - 12:31 PM

I suspected it might be reasonably easy. <__< ( Thanks K_N. ^_^ )

Any old method would work, honestly. BBcode would be fine.

Also, we could totally use this to solve disputes. People start talking politics and you can just be like, "No, hold on. This conversation is going nowhere. Both of you roll a d20 and whoever gets the higher number wins." :P
I don't think he needs to be immortal. I think all he needs to do is to write the right story. Because some stories do live forever.

#7 SpleenBeGone

SpleenBeGone

    Deer Leader of the Goriest Revolution

  • Administrators
  • 14,951 posts
  • LocationHouston

Posted 27 January 2013 - 02:03 PM

I believe BBCode would be the best way to do it.
nmjUGDL.jpg