vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Dice Roll for vB3 (https://vborg.vbsupport.ru/showthread.php?t=62042)

Holidazed 03-05-2004 08:30 PM

Has not this hack already been done by Madacc at https://vborg.vbsupport.ru/showthrea...highlight=dice for vb2.xx?

I am not saying this is a ripoff of that code. I am just saying that if this hack worked more like that hack, it would be very cool.

Instead of images, have it just do it in text. Maybe if we could ember the roll dice command inside of an existing post, that would be awesome.

Kentaurus 03-06-2004 08:49 PM

Quote:

Originally Posted by bitg
Has not this hack already been done by Madacc at https://vborg.vbsupport.ru/showthrea...highlight=dice for vb2.xx?

I am not saying this is a ripoff of that code. I am just saying that if this hack worked more like that hack, it would be very cool.

Instead of images, have it just do it in text. Maybe if we could ember the roll dice command inside of an existing post, that would be awesome.

I searched for this hack because I needed it in my forum, I wasn't able to find it so I started to code it myself. When I release a hack I don't look into other people vb2 code, that way I keep my hack 100% original.

I have no use for only text, I want the dice to be shown as an image, also I like my syntax to throw the dice so I will stick with it :) I don't know if it is the best one to use but it sounded logical when I designed it.

Kentaurus 03-06-2004 08:52 PM

Quote:

Originally Posted by Morrus
What edits would you need to make to increase the number of dice?

I am sorry, i should had make this hack more friendly. If more people use it I would upgrade it to be more friendly to customize. Right now to increase the number of dice

look for
Code:

$dice = eregi_replace(".*\[dice=([123])\]([0-9]?[0-9])\[\/dice\].*","\\1 \\2",$post['message']);
Add numbers depending on the number of dice you allow. Ej, for adding support for 4, 5 and 6 dices:
Code:

$dice = eregi_replace(".*\[dice=([123456])\]([0-9]?[0-9])\[\/dice\].*","\\1 \\2",$post['message']);
also look for

Code:

$post['message'] = preg_replace("/\[dice=[123]\][0-9]?[0-9]\[\/dice\]/i","[dice]",$post['message']);
In a similar way change it to:

Code:

$post['message'] = preg_replace("/\[dice=[123456]\][0-9]?[0-9]\[\/dice\]/i","[dice]",$post['message']);

Kentaurus 03-06-2004 08:55 PM

Quote:

Originally Posted by Hoffi
How are they stored in the Post? I searched this if it is impossible to chnage the Value. (OK, directly in the Database only!)

When a user does a dice roll the result of the roll is generated and stored in the post. Then the post of the user is edited only to contain [dice]

Then no matters if the user edits the post they can no longer change the dice roll, in fact, they only see a [dice]. The results have been already been stored with the post in the database. The only think they could do is to "delete" the dice roll.

Hoffi 03-10-2004 04:46 AM

Quote:

Originally Posted by Kentaurus
When a user does a dice roll the result of the roll is generated and stored in the post. Then the post of the user is edited only to contain [dice]

Then no matters if the user edits the post they can no longer change the dice roll, in fact, they only see a [dice]. The results have been already been stored with the post in the database. The only think they could do is to "delete" the dice roll.

Works great. What should i change to roll 10 and 20 sided Dices. And maybe 12 sided are also needed.
Great would be a option where I can put in the posiible sidenumbers comma seperated.

Hoffi 03-10-2004 04:54 PM

Hey, there are some undocumentated features in the Code. ;)

I modified my postbit_dice that it shows which dices were rolled.

HTML Code:

<fieldset>
<legend><strong>$dicesno W$dicesfaces</strong> mit $dicepoints Augen</legend>
$dicedata
</fieldset>

Thats for me very interesting and it is good so!

mudpyr8 03-25-2004 04:14 PM

I'll take a look at this. I have a custom dice roller I wrote for phpbb. It handled Hero dice (STUN/BODY), Deadlands, Open Ending, and others. It worked great in phpbb, but I am new to vB so I just have to figure out where to move the functions and what not.

It doesn't store the rolls in the DB, but that hasn't been an issue on our board so I'm more looking for the functionality. If I get some time, I will try to convert it.

On the DB storage: I don't think that will work unless you tie the message ID to the store, and even then someone could create a new message anyway. If you had the [roll] code generate a result and store it in the DB, referencing by some kind of record ID, the roller could just delete the record ID and reroll anyway.

I think the bottom line is to either a) disallow editing at the forum level or b) make it known that any edited post with a roll will be considered a failed roll/minimum roll (forcing a reroll just means the people who roll crappy will edit their post so they will *have* to reroll).

a) is the easiest solution.

Hoffi 03-26-2004 06:30 AM

It works perfectly how it stores the dice-rolls. Nothing can changed later. But you even can edit your Post.
The Roll ist stored in an extra Database-field of each Message.

mudpyr8 03-26-2004 02:01 PM

Well, if I get a bad roll why not just delete the whole message and then roll again in a new message?

What about multiple rolls in a single message?

Hoffi 03-27-2004 08:44 AM

If you can delete your Post, you can do it. But I idsallow Postdeleting.

Only one Roll per Post is possible.


All times are GMT. The time now is 11:13 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01181 seconds
  • Memory Usage 1,751KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_html_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete