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)

Ziki 05-13-2006 02:02 PM

Wanted to ask same

Eq4bits 05-22-2006 02:34 AM

ugh, some a****** stole my gmail addy and I'm locked out of it... which is the addy I used for my ORIGINAL username here... Rukbat... so if there have been any posts since May 12 attributed to the Rukbat i.d. it is NOT me, they hacked my groups website that I administer AND my static IP also, that's getting reassigned tomorrow, it's been a nightmare getting everything kinda straight.
If anyone has a request for specific colors/shapes of dice for this mod, either post here or pm me with this, my new, username.

Emmy2 05-24-2006 01:33 PM

nice hack!

Is is possible to create a bbcode within a bbcode? Example, if I want to create a bb code called "roll" (and an accompanying button for it), and I want it to automatically roll 5 dice with 1-6 options, how can I do that? Theoretically this is what I want:

my member would type (or hit the roll button and get this): [roll][/roll]

but the code would execute as: [roll][dice=5]6[/dice][/roll]

Anyway to do that? The reason is...my members are low tech and having them input all the variables is too complex. Just want a simple roll button that they can click and it's all set up for them. Can do?

Zowners 05-24-2006 02:54 PM

Quote:

Originally Posted by Rukbat
FIND
Code:

<td><smallfont><b>Dice roll with $dicesno dices of $dicesfaces faces: $dicepoints points</b></smallfont></td>
CHANGE TO
Code:

<td><smallfont><b>Dice roll with $dicesno die of $dicesfaces faces: $dicepoints points</b></smallfont></td>

Where was the database with this code? I assume it's not one of the dice hack databases because I couldn't find them. Found the other two but not the above code

soravok 05-25-2006 09:20 AM

How long do you think it will be before there is a solid/stable version of this dice roller I like it a lot just a few too many minor bugs with it for the time being.

Emmy2 05-25-2006 09:51 PM

can I try another question? I'm trying to simplify the dice roll for my members...trust me, inputting [dice=5]6[/dice] is beyond most of them.

Ideally, it would be great if I could add a clickable button on the quickreply toolbar menu that automatically inserts a pre-determined text string into the reply box (in this case, the actual bbcode I want them to use, which is [dice=5]6[/dice] ... that way they don't have to type it themselves). Is there any way to do this? I've been searching around the net for a few hours and I can't find anything (I'm no coder).

Any help really appreciated.

cclaerhout 05-26-2006 01:26 AM

I think Emmy2 idea is good.

Why not having in the editor tool bar a collpase icon showing a different choice of dice : dice 4 ; dice 6 ; dice 10 ; dice 12 ; dice 20. RPG gamers will love that !

The php code sould also be rewritten.

Because i'm not a php coder, i can't do that. But i've already developped the different dice pictures :) I think you will like them ;)

In the joined archive, you will find png pictures (better for transparency) et adobe psd file.

Tell us if you think you can make our wishes become true :banana:

Zowners 05-26-2006 05:20 AM

I'm still wrestling with the database.

how was ZIKI's problem solved? I don't know where to alter the database and alter it with what.

Eikinskjaldi 05-26-2006 06:29 AM

I personally was in a hurry with this and I have made no plans to work on it. I ported it per request when I had some free time, but as it stands my free time might not be coming back for awhile, iv got 6 projects lined up in my future. So if another coder wants to take and mod this then its free game as I just don't have time for it.

If it doesnt not work for you then you may need to use phpmyadmin and manually add the database iformation, it is all in the install code that can be found in the product by hitting edit. I don't have it handy but it is basic field adding.

Emmy2 05-26-2006 12:09 PM

Zowners, I don't know if this will help you but let me relate my installation experience. I just installed this a few days ago. I noticed in the unzipped file that there were TWO product xml files, named:

Eiken-DiceRoller-0_1
Eiken-DiceRoller-1_0

I assumed the 1_0 was the newer one and tried to import that one. However, I got database errors, the product wasn't installing into the dabatase correctly (maybe like you are getting now). So I UNINSTALLED that one, and installed the other product...the Eiken-DiceRoller-0_1 file. That one worked and the version listed for it in the admin panel is "1.0" (even though the file is named 0_1). I have no idea why there are two files, why one works and one doesn't, but I thought I'd relay that in case you are having the same problem I did.

As for creating a button for the dice roll...I'll go ask in a general coding forum to see if anyone can assist. It's not necessarily just a function of the dice roll, but a button to input ANY pre-defined text into the reply box, so maybe someone can help.

Eq4bits 05-26-2006 01:03 PM

Quote:

Originally Posted by Zowners
I'm still wrestling with the database.

how was ZIKI's problem solved? I don't know where to alter the database and alter it with what.

Do you actually have access to the database? Via something like phpMyAdmin? Where you can 'see' the database and alllll the tables that make it up?

As previously stated on the FIRST page the changes are not being made to the database when you install/import this product. You'll have to ALTER the
***_thread & ***_post yourself. Do the following:
  • ALTER the ****_thread table by ADDING a field named 'dice' the field should be MEDIUM TEXT and set at NOT NULL;
  • ALTER the ****_post table by ADDING a field named 'dice', athe field should be MEDIUMTEXT and set at NOT NULL;
Since I don't know what you named your database table prefixes I inserted asterisks prior to the _thread & _post table names. The attached images are screenshots showing the ****_post table of a database and indicatingwith the 'dice' field already added (image1a.png) , and an image (image1.png) is showing the properties of the dice field... which can be edited, dropped altogether or whatever. If you need help adding a field to the database I suggest reading over the help file for phpmyAdmin.

Eq4bits 05-26-2006 01:18 PM

also, as Eiikenskjaldi stated above he ported this product from it's original (written by someone else) that was for ver 3.0 so that it could be used for ver. 3.5.x the xml file
to add a button as Emma2 suggested would require more than this simple xml file/product. There is a hack somewhere for adding additional bbcode buttons to the editor. This is just a simple and easy way to be able to roll dice by typing the bbcode for it, just like adding an img tag or url tag when typing a post, it's NOT really that hard to type [dice=1]100[/dice] is it? Having 20 buttons for different dice rolls on the WYSIWYG editor could get a bit crowded anyway, don't you think? IF you were ONLY using, for your board a SINGLE predetermined number of die with a predetermined number of faces (i.e. only able to roll x number of die that have z number of faces) yes a button would be the thing to go with, but that wasn't the purpose of this hack.. You can always put a request for someone to write a hack that does this in the request forum, or pay someone to do it. I don't have all the know how to.

Eq4bits 05-26-2006 01:49 PM

Quote:

Originally Posted by Zowners
Where was the database with this code? I assume it's not one of the dice hack databases because I couldn't find them. Found the other two but not the above code

Zowner,
That is in the actual xml file and has to be changed prior to importing.

wherever you saved the xml file on your computer, open it using notepad or wordpad.. some type of equivalent editor. Then use 'Find' to seach and located the code, then change it
EDIT: hit submit too soon :eeps:
Then save the file and reimport, be sure to check 'Yes' to overwrite for the import process.
EDIT: :eeps: i must need more coffee i totally read and replied wrong, have fixed my reply now tho
ignore the attached image it has nothing to do with the section of code Zowner was asking about.
Edit: I definiately need more coffee or another brain... the image attached DOES have everything to do with this
all that code change in the xml file was change the 'wording' above the pics of the dice in the post
'dices' was not correct you would use either 'die' or 'dice' and it bugged me seeing 'dices' made me want to grab a knife and an onion... :D

Eq4bits 05-26-2006 03:08 PM

Quote:

Originally Posted by soravok
How long do you think it will be before there is a solid/stable version of this dice roller I like it a lot just a few too many minor bugs with it for the time being.

I'm putting in a 'code' section below a copy of the XML file I use on my board (please note '***' that is in front of '_thread' and '_post' should be the PREFIX all the tables in your database have)... except for making the alterations to the table this hack works FINE.

The changes I (as Rukbat at the time) made were for customizing it for MY board/forum (using up to 9 dice with up to 100 faces), and also changing the 'Dice roll with x dices of ** faces: *** points' phrase to 'Dice roll with x dice of ** faces: *** points' because 'dices' is not the plural and it bugged me.

So now....
################### INSTALL INSTRUCTIONS ################
1. Access the database you use for your forum
  • open the ***_thread table
    • ADD a field - make the field name 'dice' set it's properties to: 'mediumtext' and 'not null'
  • open the ***_post table
    • ADD a field - make the field name 'dice' set it's properties to: 'mediumtext' and 'not null'
2. Upload the images to ./images/dice in your main forum directory, you will need to create the dice folder. (the ZIP file attached below is Blue Dice 1-100.. you will have to download the zip file, extract it and upload all the images in it to the dice folder you created)

4. Copy and paste the below code into notepad (or other xml editor), change the '***' prefix for the tables to the prefix YOUR database has for all it's tables, then SAVE it as: Eikin-DiceRoller-1_0.xml (in notepad 'save' box be sure to have the file type set to 'all files' NOT as TEXT/TXT and the encoding as ANSI):
Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="dice" active="1">
 <title>Dice Roller</title>
 <description>Rolls dice in postbit</description>
 <version>1.0</version>
 <codes>
  <code version="1.0">
  <installcode>ALTER TABLE `***_thread` ADD `dice` MEDIUMTEXT NOT NULL ;
ALTER TABLE '***_post' ADD 'dice' MEDIUMTEXT NOT NULL ;</installcode>
  <uninstallcode />
  </code>
 </codes>
 <templates>
  <template name="dice" templatetype="template" date="1145915902" username="admin" version="3.5.4"><![CDATA[<img src="images/dice/$point.gif" width="76" height="80" />]]></template>
  <template name="postbit_dice" templatetype="template" date="1145915990" username="admin" version="3.5.4"><![CDATA[<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1">
<tr>
  <td><smallfont><b>Dice roll with $dicesno dice of $dicesfaces faces: $dicepoints points</b></smallfont></td>
</tr>
<tr>
  <td style="BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; BACKGROUND-COLOR: #D7D7D7;">
$dicedata
</td>
</tr>
</table><br/>]]></template>
 </templates>
 <plugins>
  <plugin active="1">
  <title>dice_process_data</title>
  <hookname>newpost_process</hookname>
  <phpcode><![CDATA[// Hack
                if (@eregi("\[dice",$post['message']))
                {
                        $diceresult = array();
                        preg_match_all("/\[dice=([1-9])\]([0-9]?[0-9]?[0-9])\[\/dice\]/",$post['message'],$diceresult);
 
                        $dices = $diceresult[1];
                        $faces = $diceresult[2];
                        $dicedetail = array();
                        $rollcount = count($dices);
 
                        $validdice = 0;
                        for ($i = 0; $i < $rollcount; $i++)
                        {
                                if ($faces[$i] >= 2 && $faces[$i] <= 100)
                                {
                                        $diceresult[0][$i] = str_replace("[","\[",$diceresult[0][$i]);
                                        $diceresult[0][$i] = str_replace("]","\]",$diceresult[0][$i]);
                                        $diceresult[0][$i] = str_replace("/","\/",$diceresult[0][$i]);                                               
                                        $post['message'] = preg_replace("/".$diceresult[0][$i]."/","[dice".($validdice)."]",$post['message'],1);
 
                                        $dicedetail[$validdice]['dices'] = $dices[$i];
                                        $dicedetail[$validdice]['faces'] = $faces[$i];
                                        $dicedetail[$validdice]['data'] = array();
                                        for ($j = 0; $j < $dices[$i]; $j++)
                                        {
                                                $dicedetail[$validdice]['data'][] = rand(1,$faces[$i]);       
                                        }
                                        $validdice++;
                                }
                        }
 
                        if (!empty($dicedetail))
                        {
                                  $dataman->set('dice',serialize($dicedetail));
                        }
                }
                // End Hack]]></phpcode>
  </plugin>
  <plugin active="1">
  <title>dice_postbit_convert</title>
  <hookname>postbit_display_complete</hookname>
  <phpcode><![CDATA[// Hack: dice
 if ($post['dice'])
        {
        $dicearray = unserialize($post['dice']);
  $totalroll = count($dicearray);
 
  for ($i = 0; $i < $totalroll; $i++)
                {
  $dicedata = "";               
                $dicepoints = 0;
                $dicesno = $dicearray[$i]['dices'];
                $dicesfaces = $dicearray[$i]['faces'];
 
                foreach ($dicearray[$i]['data'] as $point)
                {
                        eval('$dicedata .= "' . fetch_template("dice") . '";');
                        $dicepoints += $point;                 
                }
                eval('$dice = "' . fetch_template("postbit_dice") . '";');
                $post['message'] = preg_replace("/\[dice$i\]/i","$dice",$post['message']);
                }
        }]]></phpcode>
  </plugin>
  <plugin active="1">
  <title>dice_set_valid_fields</title>
  <hookname>postdata_start</hookname>
  <phpcode><![CDATA[$this->validfields['dice'] = array(TYPE_STR, REQ_NO);]]></phpcode>
  </plugin>
  <plugin active="1">
  <title>dice_set_valid_fields_new_thread</title>
  <hookname>threadfpdata_start</hookname>
  <phpcode><![CDATA[$this->validfields['dice'] = array(TYPE_STR, REQ_NO);]]></phpcode>
  </plugin>
 </plugins>
 <phrases>
 </phrases>
 <options>
 </options>
</product>

3. Go into ACP and upload the XML through the product manager. BE SURE TO CHECK-OFF 'YES' for OVERWRITE.

4. Go to a forum and test the formatting (described below).

################# FORMATTING INFORMATION ################
To roll a dice use the following tag,
[dice=X]Y[/dice]
X - The number of dice to roll (This cannot be larger than 9 currently, I'm not a coding whiz and not sure how to fix this but I AM looking into it.)
Y - The number of sides on the dice (This cannot be larger than 100 currently, mainly because I don't feel like making more dice, but if YOU do feel free, just find in the xml file (again using notepadchange the ) the following
Code:

if ($faces[$i] >= 2 && $faces[$i] <= 100)
and change the '100' to however many you need it/want it to be, provided you have dice images up to and including that number.

so [dice=1]6[/dice] Roll's 1, 6 sided dice.

NOTE: Currently you CANNOT make a dice roll in the first post of a new thread, only in reply posts. I'm not a coding-whiz so I don't know how to fix it, but I'll try looking into it in the next couple of days and post another reply here.

The hack isn't buggy except for the table altering, as long as you go in and make those changes to the 2 tables yourself via phpMyAdmin (or whatever) it works fine.

Eq4bits 05-26-2006 03:15 PM

Quote:

Originally Posted by Emmy2
nice hack!

Is is possible to create a bbcode within a bbcode? Example, if I want to create a bb code called "roll" (and an accompanying button for it), and I want it to automatically roll 5 dice with 1-6 options, how can I do that? Theoretically this is what I want:

my member would type (or hit the roll button and get this): [roll][/roll]

but the code would execute as: [roll][dice=5]6[/dice][/roll]


Anyway to do that? The reason is...my members are low tech and having them input all the variables is too complex. Just want a simple roll button that they can click and it's all set up for them. Can do?

I'll look into this when I have time, but I'm not guaranteeing anything, so you essentially want a button for the WYSISYG editor that has the word 'Roll' on it (that's an image thing) that will ALWAYS roll the same number of die with the same number of faces, correct?

cclaerhout 05-26-2006 03:16 PM

I think the sql problem shoud be fixed with this new product file.

I'm still thinking the idea suggested above would be great. If each time you want to play dice you have to type the code, members are going to be upset. I'm going to look if i can do it. Anyway we can ask Michelle, the hacker of e-steki Smilie Maker 1.7 to help us ;)


Edit : file removed because update on next page.

cclaerhout 05-26-2006 03:18 PM

Quote:

Originally Posted by Eq4bits
I'll look into this when I have time, but I'm not guaranteeing anything, so you essentially want a button for the WYSISYG editor that has the word 'Roll' on it (that's an image thing) that will ALWAYS roll the same number of die with the same number of faces, correct?

My idea would be to create a collaspe menu with several choice of dice. Each time you click on of the icon, the bbcode will be insert in the message.

BeaLzeBuB 05-26-2006 03:38 PM

it doesn't show the dices.I imported it and it doesn't show the dices there is only [dice=1]6[/dice]

Eq4bits 05-26-2006 03:58 PM

Quote:

Originally Posted by cclaerhout
My idea would be to create a collaspe menu with several choice of dice. Each time you click on of the icon, the bbcode will be insert in the message.

That's a bit more complicated than my limited knowledge allows for, perhaps one of the 'whizzy' coders here could assist... if any are reading this thread....

Eq4bits 05-26-2006 04:18 PM

Quote:

Originally Posted by cclaerhout
I think the sql problem shoud be fixed with this new product file.

I'm still thinking the idea suggested above would be great. If each time you want to play dice you have to type the code, members are going to be upset. I'm going to look if i can do it. Anyway we can ask Michelle, the hacker of e-steki Smilie Maker 1.7 to help us ;)

I haven't had any problems with my users getting upset, they are just thrilled that they can roll dice and haven't had a problem rolling them... i posted instruction on how to do the bbcode and so far no problems... i made a thread for them to 'practice' on, lol

That would be great if Michelle could help, bribe her maybe???? lol

Looking at the xml version you attached it 'looks' like the code for altering the two tables should work (I was just looking at that part of the code and fixing to try to fix it... thanks for saving me the trouble), anyone try it yet?
A note tho... the 'dices' word is still there instead of 'die' or 'dice' so that would need to be changed if anyone else is as anal about that as I am :D
Another note your's is only for up to 5 dices of 30 faces each.

So anyone needing up to 9 dice would need to change
Code:

preg_match_all("/\[dice=([1-5])\]([0-9]?[0-9])\[\/dice\]/",$post['message'],$diceresult);
TO
Code:

preg_match_all("/\[dice=([1-9])\]([0-9]?[0-9]?[0-9])\[\/dice\]/",$post['message'],$diceresult);
and anyone wanting/needing more than 30 faces would need to change the '30' in
Code:

if ($faces[$i] >= 2 && $faces[$i] <= 30)
to the number of faces they choose (as long as they have images of dice up to and including the number they choose)

Eq4bits 05-26-2006 04:23 PM

Quote:

Originally Posted by BeaLzeBuB
it doesn't show the dices.I imported it and it doesn't show the dices there is only [dice=1]6[/dice]

Check your 'thread' and 'post' tables in your database to be sure the 'dice' field was added to both tables.

Be sure you uploaded images of dice to the vBulletin forum images directory into a file named 'dice'. The dice file with the product are the old images and are pretty ugly and only go up to 30. If you want to use more than 30 faces you'll need to make dice for those numbers or download the Blue Dice.zip file that is attached to one of my previous posts (prettier dice and numbered 1-100)

Eq4bits 05-26-2006 04:32 PM

Quote:

Originally Posted by cclaerhout
I think the sql problem shoud be fixed with this new product file.

I'm still thinking the idea suggested above would be great. If each time you want to play dice you have to type the code, members are going to be upset. I'm going to look if i can do it. Anyway we can ask Michelle, the hacker of e-steki Smilie Maker 1.7 to help us ;)

cclaerhout
Do you know if that also corrected the problem of having a dice roll in a post that is the first post of a new thread?

Emmy2 05-26-2006 04:59 PM

Yes Eq4bits, a button or collaspible menu for rolling dice that automatically inputs the correct bbcode for each roll when a user clicks on it. If collapsible isn't possible, just a single button would work. I could create more than one button to include variations of the roll.

I have also asked for coding help for this in the general forums, since this idea wouldn't necessarily be exclusive to rolling dice.

here is the thread I've asked...

https://vborg.vbsupport.ru/showthread.php?t=116727

Eq4bits 05-26-2006 05:48 PM

Okay, what preset would you like? I'm working on it now

Emmy2 05-26-2006 06:24 PM

cool! for a preset, how about...

[dice=5]6[/dice] if it's just one button

If it's a menu....

[dice=1]6[/dice]
[dice=2]6[/dice]
[dice=3]6[/dice]
[dice=4]6[/dice]
[dice=5]6[/dice]

As long as there is some code to start off I think I can change it to whatever I want later, but for a start those presets would do.

Thanks, it'll be great if this works!

Eq4bits 05-27-2006 01:30 AM

So far I'm not having any luck, like I said I'm no whiz at this but usually given time and a LOT of mistakes I'll eventually figure something out.

It *definiately* doesn't work by just adding a new bbcode via the admincp... I can get the button there, no problem, but it won't execute and show the dice...

OH I just thought of something, if you've installed this and the dice pics aren't showing you MAY need to change the permission/ on your image file to 777 and on the dice file to 777

Eq4bits 05-27-2006 01:35 AM

I'm still going to continue playing with this to try to get it to work via a button on the editor or a dropdown on the editor, but until then emmy if you don't need to 'store' the results in the d/b and just want your users to roll dice and don't need it to show in a post take a look at this alternative thread https://vborg.vbsupport.ru/showthrea...highlight=dice

Eikinskjaldi 05-27-2006 05:45 AM

Well paint me up and call me a liar, Due to some demand from my users and a few holes in my alternate dice roller I use I think I will be coming back and working on this hack some more. I don't know yet if I will release the same one here as on my forum since this one being an extension needs to avoid code edits, but I thank those who have supported people and ried to help them, I will be adding your names to the first post and I'll check the package again on the SQL error.

If your dice are not parsing then it is most likely a plugin issue and you should ensure all plugins are turned on. Making a drop down for the post bit doesn't seem to difficult, Much like using the color code in a modified format, I may look into this when iIrevisit this hack, I may have a new version up in the next few days, depending on my scedual.

[[Yes, I am pushing back other work for this as its been something iv been avoiding taking care of at my own site and now its time to tackle it before I get beaten up by disgruntled DM's.]]

-Eikinskjaldi-

cclaerhout 05-27-2006 09:31 AM

Here is a new xml product file :
-SQL error is fixed
-Display dice in first post of a new thread is OK (i guess my code can be improved a lot ;) )

Now we all can try to make the version of the hack i've described above :D
Here

cclaerhout 05-27-2006 11:20 AM

Well, here is a preview of "RPG DiceRoller". I still have to work on the user interface.

You want to play a D4 ?
[dice=1]4[/dice]

You want to play a D6 ?
[dice=1]6[/dice]

You want to play a D8 ?
[dice=1]8[/dice]

You want to play a D10 ?
[dice=1]10[/dice]

You want to play a D12 ?
[dice=1]12[/dice]

You want to play a D20 ?
[dice=1]20[/dice]

Other dices won't work because pictures don't exist ;)

N.B : Pictures are in png format. To avoid grey line arround them in Internet Explorer 6, you need a png transparency hack (available here). Otherwise i could do a gif release.

akanevsky 05-27-2006 11:24 AM

Although I see no practical use for me, this is a very nice hack technical-wise.

Eq4bits 05-27-2006 02:42 PM

Quote:

Originally Posted by cclaerhout
Well, here is a preview of "RPG DiceRoller". I still have to work on the user interface.

You want to play a D4 ?
[dice=1]4[/dice]

You want to play a D6 ?
[dice=1]6[/dice]

You want to play a D8 ?
[dice=1]8[/dice]

You want to play a D10 ?
[dice=1]10[/dice]

You want to play a D12 ?
[dice=1]12[/dice]

You want to play a D20 ?
[dice=1]20[/dice]

Other dices won't work because pictures don't exist ;)

N.B : Pictures are in png format. To avoid grey line arround them in Internet Explorer 6, you need a png transparency hack (available here). Otherwise i could do a gif release.

So you can only roll 1 dice at a time with this version? Any way to make it work to ALWAYS roll a die with 6 faces but make the # of dice variable? i.e.
[dice=1]6[/dice]
[dice=2]6[/dice]
[dice=3]6[/dice]
[dice=4]6[/dice]
[dice=5]6[/dice]

That's what Emmy2 is looking for.
My group uses anywhere from 1-9 dice and anywhere from 2-100 faces, I was TRYING to just make a new bbcode button in the admincp bbcode manager, i could get the button image to work, but when you'd click it and vB asks you to input the number for the {option} the result would look like:

[DICE="4"][/DICE]

you still had to put the 'face' variable/option/param in physically between the two sets of brackets, but the quotes vB automatically put around the #ofdice of course kept it from working, was having trouble with the 'html' part in the 'add bbcode' panel also..

*sigh*... I just have to face it somethings I *can* do and some I just don't have the knowledge for.. I'm just belligerant and keep at it though... till I'm cross-eyed... LOL

I didn't realize IE put grey borders around gifs, i've never noticed it before.... hmmmm
If anyone wants me to turn the 1-100 Blue Dice in pentagonal shape (that I did as Rukbat) into png's let me know and I'll do a batch conversion and re-zip & re-upload here.

Eq4bits 05-27-2006 02:45 PM

cclaerhout,
One more question...
is the 'roll' still stored in the d/b?

Emmy2 05-27-2006 03:27 PM

There now seems to be several of you working on variations for this, and that's great! So, not to sidetrack everyone but I have a few more ideas....

Suppose I wanted to install this hack more than once, what would I need to change in the original xml file? In other words I want one hack called "dice" and another hack called "cards" that does the same thing but uses separate database tables and images. So for example, I can have one game that throws dice and another game that draws playing cards. Or another game that rolls letters of the alphabet.

In other words, suppose I want 3 separate games. Dice, Cards, Alpha, if you want to name them. What parts of the original script could I change so that I can install this game a second and third time (in a different place, not overwriting the first game)?

Then, to play, users would type (or I'd create buttons for):

[dice=5]6[/dice]
to roll a 6 sided dice five times

[cards=5]52[/card]
to draw 5 cards from a 52-card deck

[alpha=9]26[/alpha]
to roll 9 letters out of the 26 letter alphabet

I'm dreaming big here folks! :P

Another idea....suppose for the card game users are drawing 5 cards and I don't want them to draw the same card twice (this could also apply to dice). Is there a way to limit it so the same card/dice isn't drawn/rolled more than once in a roll of multiple die or cards?

Yeah, this is all pretty much off-base for the current project, but I thought I'd just throw these ideas out there.

cclaerhout 05-27-2006 04:31 PM

Quote:

Originally Posted by Eq4bits
So you can only roll 1 dice at a time with this version?

No, as many as you want.

The dice are still in database.

Eikinskjaldi 05-27-2006 05:00 PM

Well a standard deck has 52 cards so you bbcode would probaly look more like [cards]5[/cards]. With private text you could be on your way to having poker in threads. as far as limiting it, ya, it could be limited, it'd be as simple as stoirng the values in a array and testing to make shure none equal eachother.

However back on dice, Another idea is a prompt box which you can enter the number to roll after having selected the sides from a drop down.I'll look into that avenue. I am going to making a steep departure from the old system of rolling dice as it doesn't work for me, so this drop down idea won't work for me, in any case, all that well. Seeing as I help run one of the largest gaming sites for PbP it isnt easy to keep everything simple. A sample new style roll would be:
[dice=Dice Title]1d20 1d20 1d6[/dice]

Which would provide a much cleaner more cingular less bulky output. I also don't want images, so I will probaly provide to XML's, one with them and one without. If you visit my forum and check out some of the dice rolls you can see the output I will probaly be aiming for as I want to try and keep my dice standard.

The cards thing shouldn't be to hard and i'll look into it if I have time.

cclaerhout 05-27-2006 10:32 PM

Here is the kind of interface i'd like. It would be a popup. I'm going to ask Michelle if she can help us.

cclaerhout 05-28-2006 07:38 AM

Michelle is sorry but she doesn't have time to work on this. If an advanced coder can have a look, it would be nice.

Emmy2 05-28-2006 11:49 PM

Could the "onclick" command be used in conjuction with an image button to insert the roll into the textarea?

I've been looking at the smilie code and that's what it does. Click a smilie and it inserts something like :smilie: into the text box. Instead of :smilie: I need it to insert the code for a dice roll.

So something like this to create a button (this is just me expressing my idea, it is NOT real code):
Code:

<img src="http://www.mysite.com/dicebutton.gif" onclick="return value('[dice=5]6[/dice]')">
Then I think you'd have to create a little javascript to put in the page head for the onclick command, right? Can anyone help with this? I'm really keen to get it working.

Emmy2 05-29-2006 05:48 PM

Quote:

Originally Posted by cclaerhout
Michelle is sorry but she doesn't have time to work on this. If an advanced coder can have a look, it would be nice.

I'm not a coder but I think I did it! I've created code that will add an image button or a regular button to the quick reply and regular editors that when clicked by user automatically inserts the text for one pre-defined dice roll. It doesn't have a drop-down menu for multiple options, but hey it's a start! And maybe with the base code in place someone can look at it and see how to add a menu. All I did was research on google and played with some code I found and kept testing and this one finally worked.

I will post the code late tonight when I get home from work...I have been working on this all day.

:banana:


All times are GMT. The time now is 01:05 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.01525 seconds
  • Memory Usage 1,919KB
  • 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
  • (8)bbcode_code_printable
  • (13)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
  • (40)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