vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Dice Roller Hack [BBCode] (https://vborg.vbsupport.ru/showthread.php?t=113972)

Eikinskjaldi 05-30-2006 07:52 PM

....and another variation that requires less work from you but a little more from the users:
Code:

<script type="text/javascript">
function dropDownDice(obj,obj2){
    var diceToRoll = document.getElementById(obj).value;
    var faces = document.getElementById(obj2).value;
    document.getElementById('{$editorid}_textarea').value += '[dice='+diceToRoll+']'+faces+'[/dice]';
}
</script>

<td><select id="{$editorid}_dicetoroll">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select></td>
<td><span style="color:black;"><b>D</b><span></td>
<td><select id="{$editorid}_dicefaces">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select></td>
<td><input type="button" onClick="dropDownDice('{$editorid}_dicetoroll','{$editorid}_dicefaces');" value="Add Dice" /></td>

same rules apply as above, Attaching a screenshot of this one since it is a little different.

Eq4bits 05-30-2006 09:26 PM

so these only work with quick reply or the non advanced wysiwyg editor? or it won't even work on quick reply if the other is enabled?

cclaerhout 05-30-2006 09:44 PM

RPG DICE IS READY !

That's good, i've finished my job :) Sorry for the delay, i had a busy day.

So what's new :
-sql problem is fixed
-dice in first thread are working
-new user interface integrated in Quickreply and in Editor tool bar


And the best for the end :

Everything is automatically installed with the xml product file :)


To see the result, have a look at the pictures.

P.S : I'd like to know if i can translate and distribute this hack to vbulletin-fr for french users.


EDIT : files removed for a new release.

Emmy2 05-30-2006 10:00 PM

wow, all of the menus look great! I'll be studying them and figuring out which one to add to my site. So glad we were able to figure something out for this...will really make it easier for the game players.

Quote:

Originally Posted by Eq4bits
so these only work with quick reply or the non advanced wysiwyg editor? or it won't even work on quick reply if the other is enabled?

I think he just means the wysiwyg editor will simply show the dice bbcode in the textarea, not actually "execute" it live like it does for other bbcode functions. Am I right on that?


Is this a good time to re-ask one last question I have? I mentioned it before in another post. But I would like to install this hack more than once, to use to play different games that have different images...numbered dice, playing cards, rolling alphabet letters. If I took the xml file and changed every instance of "dice" to "dice2" and then imported it would I get a second installation of the game that uses [dice2] as the bbcode? Would that work? Or can someone rewrite the code using "cards" and "alpha" instead? Thanks for any help.

Eikinskjaldi 05-30-2006 10:38 PM

Yes, in theory if you changed all that it would make a new bbcode, but of identical function. you'd need to add new templates as well if you wanted to change output and modify the code for cards to some extent.

You can translate this into any langauge you'd like, but it isnt done yet. I like the drop down below but I prefer my own method as its smaller, to each his own.

When i attempted the use of it in a WYSIWIG it did not apear in the editor because you have to write special code from what i recall to handle the WYSIWIG. That is something a little more complex then this simple JS. It should in theory show up but unparsed. I may look into this later. In a few hours when i have this other work done i am going to tackle the code and rip it to pieces for my own uses which does sort of render the buttons as useless to some extent but I will see what I can do.

cclaerhout 05-30-2006 10:42 PM

Just to say that i've also got the wysiwyg problem.

Emmy2 05-30-2006 10:55 PM

speaking of modifying the code for cards....I guess what I'd need is something that assures that the same card isn't drawn twice (suppose you draw 5 cards...two of them can't be the ace of hearts...unlike dice, where you CAN roll the same number twice). I don't suppose anyone here would know how to make that modification? :hopeful: :D

Oh, oh, oh....just had another idea. What would be ideal for cards is if the same card couldn't be drawn more than once in EACH THREAD. That way if you're playing a card game, taking turns drawing from the deck, you don't get cards repeating themselves, no matter who is doing the drawing. If each thread was a new game, then limiting it to one draw of each card PER THREAD would be the way to go. I would absolutely love this....any possibility?

cclaerhout 05-30-2006 11:33 PM

To avoid the wysiwyg problem, just tell for the moment your members to click "A/A" in the top right corner of the editor to make dice buttons work.

To see RPG Dice in action go there : www.lesatirique.info/forum/showthread.php?t=2421

Eq4bits 05-31-2006 12:43 AM

Thanks for the work around cclaerhout, or should I say Merci?
One more question, on your interface can you 'mix' the different dice in one roll? i.e. 1d5 1d10 1d20 (1 for # of dice,d for dice, 5/10/20 for # of faces) did that make sense?

Eq4bits 05-31-2006 01:23 AM

Quote:

Originally Posted by Eikinskjaldi
To add a new dice just add:
Code:

<option value="Number of dice to roll;Number of faces">Descriptor</option>

where in the template does one put that option value? which template?


All times are GMT. The time now is 01:00 AM.

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.01144 seconds
  • Memory Usage 1,746KB
  • 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
  • (2)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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