[BETA] - Dices Game

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
Mighty Gorgon
Registered User
Posts: 616
Joined: Thu May 23, 2002 2:56 pm
Location: Italy
Name: Luca Libralato
Contact:

[BETA] - Dices Game

Post by Mighty Gorgon »

Hi Guys!

Here is a very simple dice game mod based on ElbMag mod by tHe LiNk.

All instructions and files are attached to the zip file.

You can download it from here:

Downolad Dices Mod

You can test the mod on my site, but since this mod actually requires points mod, you should register to test it.

Feedbacks and comments should be very appreciated.

Thank you.

Here is the text part of the mod:

Code: Select all

############################################################## 
## MOD Title: Dices
## MOD Author: Mighty Gorgon < mightygorgon@supereva.it > (L. L.) http://www.mightygorgon.cjb.net 
## MOD Description: A very simple dice game based on ElbMag mods. Points Mod Required.
## MOD Version: 0.1.0 
## 
## Installation Level: easy
## Installation Time: 5 Minutes
## Files To Edit: 6
##                viewonline.php
##                admin/index.php
##                includes/constants.php
##                includes/page_header.php
##                language/lang_english/lang_main.php
##                templates/subSilver/overall_header.tpl
## Included Files: 4
##                 dices.php
##                 language/lang_english/lang_dices.php
##                 language/lang_italian/lang_dices.php
##                 templates/subSilver/dices_body.tpl
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: Points Mod Required.
############################################################## 
## MOD History: 
##
##   2003-11-12 - Version 0.1.0 - First Release
##   
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
copy root/dices.php
copy root/language/lang_english/lang_dices.php to language/lang_english/
copy root/language/lang_italian/lang_dices.php to language/lang_italian/
copy root/templates/subSilver/dices_body.tpl to templates/subSilver/
#
#-----[ OPEN ]------------------------------------------
#
viewonline.php
#
#-----[ FIND ]------------------------------------------
#
				case PAGE_FAQ:
					$location = $lang['Viewing_FAQ'];
					$location_url = "faq.$phpEx";
					break;
#
#-----[ AFTER, ADD ]------------------------------------------
#
				case PAGE_DICES:
					$location = $lang['Dices'];
					$location_url = "dices.$phpEx";
					break;
#
#-----[ OPEN ]------------------------------------------
#
admin/index.php
#
#-----[ FIND ]------------------------------------------
#
						case PAGE_FAQ:
							$location = $lang['Viewing_FAQ'];
							$location_url = "index.$phpEx?pane=right";
							break;
#
#-----[ AFTER, ADD ]------------------------------------------
#
						case PAGE_DICES:
							$location = $lang['Dices'];
							$location_url = "index.$phpEx?pane=right";
							break;
#
#-----[ FIND ]------------------------------------------
#
					case PAGE_FAQ:
						$location = $lang['Viewing_FAQ'];
						$location_url = "index.$phpEx?pane=right";
						break;
#
#-----[ AFTER, ADD ]------------------------------------------
#
					case PAGE_DICES:
						$location = $lang['Dices'];
						$location_url = "index.$phpEx?pane=right";
						break;
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
define('PAGE_FAQ', -8);
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('PAGE_DICES', -37);
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
	'U_GROUP_CP' => append_sid('groupcp.'.$phpEx),
#
#-----[ AFTER, ADD ]------------------------------------------
#
	'L_DICES' => $lang['Dices'],
	'U_DICES' => append_sid('dices.'.$phpEx),

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['Dices'] = "Dices";
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
&<a href="{U_PROFILE}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />{L_PROFILE}</a>
#
#-----[ AFTER, ADD ]------------------------------------------
#
&<a href="{U_DICES}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_DICES}" hspace="3" />{U_DICES}</a>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Last edited by Mighty Gorgon on Fri Dec 14, 2007 12:35 am, edited 3 times in total.

madnessmotors
Registered User
Posts: 269
Joined: Sun Aug 17, 2003 7:33 pm
Contact:

Post by madnessmotors »

What is the game exactly?

mm3guy
Registered User
Posts: 197
Joined: Tue Oct 14, 2003 8:13 pm

Re: [BETA] - Dices Game

Post by mm3guy »

Found 2 boo boos ;)

This step:

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
admin/index.php
#
#-----[ FIND ]------------------------------------------
#
						case PAGE_FAQ:
							$location = $lang['Viewing_FAQ'];
							$location_url = "index.$phpEx?pane=right";
							break;
#
#-----[ AFTER, ADD ]------------------------------------------
#
						case PAGE_DICES:
							$location = $lang['Dices'];
							$location_url = "dices.$phpEx?pane=right";
							break;
#
#-----[ FIND ]------------------------------------------
#
					case PAGE_FAQ:
						$location = $lang['Viewing_FAQ'];
						$location_url = "index.$phpEx?pane=right";
						break;
#
#-----[ AFTER, ADD ]------------------------------------------
#
					case PAGE_DICES:
						$location = $lang['Dices'];
						$location_url = "dices.$phpEx?pane=right";
	
Notice you don't have frames in this MOD ;)
Should be:

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
admin/index.php
#
#-----[ FIND ]------------------------------------------
#
						case PAGE_FAQ:
							$location = $lang['Viewing_FAQ'];
							$location_url = "index.$phpEx?pane=right";
							break;
#
#-----[ AFTER, ADD ]------------------------------------------
#
						case PAGE_DICES:
							$location = $lang['Dices'];
							$location_url = "dices.$phpEx";
							break;
#
#-----[ FIND ]------------------------------------------
#
					case PAGE_FAQ:
						$location = $lang['Viewing_FAQ'];
						$location_url = "index.$phpEx?pane=right";
						break;
#
#-----[ AFTER, ADD ]------------------------------------------
#
					case PAGE_DICES:
						$location = $lang['Dices'];
						$location_url = "dices.$phpEx";
	
2nd Error:
Notice this step:

Code: Select all

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
Errrm, what do we add? :P

User avatar
Mighty Gorgon
Registered User
Posts: 616
Joined: Thu May 23, 2002 2:56 pm
Location: Italy
Name: Luca Libralato
Contact:

Explainations & Bugs

Post by Mighty Gorgon »

madnessmotors wrote: What is the game exactly?

It's a classic dice game. You can bet a sum on a number (1 to 6) and then throw the dice. If the number comes out you win your bet multiplied 6, otherwhise, you lose the bet.

mm3guy, thanks for your observations, I've missed the lang variable. I have corrected it :wink: ! But regarding the admin/index.php you have to keep the ?pane=right because the ACP is using frames and ?pane=right is necessary if you would visualize the while you are in the admin section (keeping the admin menu on the left).

Any other suggestions?

Thank you!

User avatar
NoahK
Registered User
Posts: 217
Joined: Wed Nov 12, 2003 4:49 am
Location: Atlanta, GA
Contact:

Post by NoahK »

NT

mm3guy
Registered User
Posts: 197
Joined: Tue Oct 14, 2003 8:13 pm

Re: Explainations & Bugs

Post by mm3guy »

Mighty Gorgon wrote: mm3guy, thanks for your observations, I've missed the lang variable. I have corrected it :wink: ! But regarding the admin/index.php you have to keep the ?pane=right because the ACP is using frames and ?pane=right is necessary if you would visualize the while you are in the admin section (keeping the admin menu on the left).

But is ?pane=right specified in the .php file?

User avatar
NoahK
Registered User
Posts: 217
Joined: Wed Nov 12, 2003 4:49 am
Location: Atlanta, GA
Contact:

Post by NoahK »

Installed it. Works great. Though I did change the english file around a tad.

http://www.fftrealm.com/forum/dices.php

User avatar
Mighty Gorgon
Registered User
Posts: 616
Joined: Thu May 23, 2002 2:56 pm
Location: Italy
Name: Luca Libralato
Contact:

Re: Explainations & Bugs

Post by Mighty Gorgon »

mm3guy wrote: But is ?pane=right specified in the .php file?


Yes, it's specified in the same way also for other pages. I think it's correct, because it's needed to show the pages in the admin section without exiting the ACP! Sorry, but maybe I'm not understanding what you are meaning :roll: .
NoahK wrote: Installed it. Works great. Though I did change the english file around a tad.


Thanks NohaK, could you write the changes please? I'm Italian, and of course some english lang vars should be corrected. (Your site rocks 8) !)



Thanks for the help.

User avatar
NoahK
Registered User
Posts: 217
Joined: Wed Nov 12, 2003 4:49 am
Location: Atlanta, GA
Contact:

Post by NoahK »

Well I kind of customized it to my site. I have this guy "Mustadio" who runs the Dicing Game..

Code: Select all

<?php

$lang['Dices_Rules'] = '<b>Mustadio</b>: Ah! I see you\'ve stumbled upon my Dicing Game! Just bet any amount of Gil, choose a number, and roll! If your number comes up on the dice you win 6 times your bet, otherwise you just lose. Come on... give it a shot!!<br /><br />';
$lang['Dices_Choose'] = 'Choose a number between 1 and 6:';
$lang['Dices_Play'] = '>> ROLL <<';
$lang['Dices_Bet'] = 'Your bet ';
$lang['Dices_Ballot'] = 'Your roll lands on... ';
$lang['Dices_Win'] = '<br /><br /><b>Mustadio</b>: Congratulations! You just won ';
$lang['Dices_Lose'] = '<br /><br /><b>Mustadio</b>: Aww well, better luck next time right? You lose ';
$lang['Dices_Leaves'] = '.<br />Now you have ';
$lang['Dices_Retry'] = 'Play again?';

$lang['Dices_Stats'] = 'Temp';
$lang['Dices_Stats'] = 'Temp';

// Errors
$lang['Dices_Err_Values'] = '<b>Mustadio</b>: You can only bet Gil...';
$lang['Dices_Err_Golds'] = '<b>Mustadio</b>: Sorry you don\'t have that much Gil. Perhaps check the Ivalice Bank?';
$lang['Dices_Err_Points'] = '<b>Mustadio</b>: Oops, I spilled my ale!';


?>
I also centered and bolded the Dices_Retry.
Come play Final Fantasy Tactics: Online!
Features:
- Pick one of 351 class combinations. Battle 150 different monsters. Find over 2,200 weapons, armor, and items. Fight in tournaments or play the Gil Slots. Anything goes!

User avatar
Mighty Gorgon
Registered User
Posts: 616
Joined: Thu May 23, 2002 2:56 pm
Location: Italy
Name: Luca Libralato
Contact:

Translations & Bugs

Post by Mighty Gorgon »

mm3guy wrote: But is ?pane=right specified in the .php file?


You were right, there was an error on the code, but I was not able to figure out before... Thank you mm3guy, now it should be fixed.

NoahK wrote: Installed it. Works great. Though I did change the english file around a tad.


NohaK, very nice customization. 8)


Thanks for the help.

deny
Registered User
Posts: 565
Joined: Wed May 14, 2003 9:14 am
Location: Find-Ip-Address.org
Contact:

Negative value bug!!

Post by deny »

If you bet negative value you can't lose.Only win.

Replace:

Code: Select all

if ($_POST['bet'] > $userdata['user_points'])
with

Code: Select all

if ($_POST['bet'] > $userdata['user_points'] || $_POST['bet'] < 1)
For adds points view:

Find

Code: Select all

$dicebet = $lang['Dices_Bet'];
After add:

Code: Select all

$have = $board_config['points_name'];
Find:

Code: Select all

<input type="submit" name="play" value="' . $diceplay . '">
		<br />
After add:

Code: Select all

<span class="gensmall">'. $userdata['user_points'] . $have .'</span>
		<br />
Last edited by deny on Fri Jan 23, 2004 5:45 pm, edited 2 times in total.

pokemaster
Registered User
Posts: 361
Joined: Fri Aug 22, 2003 8:10 am
Location: UK

Post by pokemaster »

i know how to fix that:

Code: Select all


in dices.php

---FIND---

	if ($_POST['bet'] > $userdata['user_points'])

---REPLACE WITH---

    if ($HTTP_POST_VARS['bet'] > $userdata['user_points'] || $HTTP_POST_VARS['bet'] < 1)
My Newest Mods: Money Box ,P&J Mod , Fortune teller

User avatar
Mighty Gorgon
Registered User
Posts: 616
Joined: Thu May 23, 2002 2:56 pm
Location: Italy
Name: Luca Libralato
Contact:

Dices Fixing

Post by Mighty Gorgon »

Thanks Guys!

8)

Fluffy.be
Registered User
Posts: 1
Joined: Thu Mar 25, 2004 1:57 am
Location: Antwerpen
Contact:

Post by Fluffy.be »

am i wrong or right ???

Code: Select all

#-----[ FIND ]------------------------------------------
#
&nbsp;<a href="{U_PROFILE}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />{L_PROFILE}</a>
#
#-----[ AFTER, ADD ]------------------------------------------
#
&nbsp;<a href="{U_DICES}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_DICES}" hspace="3" />{U_DICES}</a>
#
must be

Code: Select all

#-----[ FIND ]------------------------------------------
#
&nbsp;<a href="{U_PROFILE}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_PROFILE}" hspace="3" />{L_PROFILE}</a>
#
#-----[ AFTER, ADD ]------------------------------------------
#
&nbsp;<a href="{U_DICES}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_profile.gif" width="12" height="13" border="0" alt="{L_DICES}" hspace="3" />{L_DICES}</a>
#
I just changed the last U_DICES to L_DICES otherwise it shows the dices.php in the links ;)
c")

User avatar
Mighty Gorgon
Registered User
Posts: 616
Joined: Thu May 23, 2002 2:56 pm
Location: Italy
Name: Luca Libralato
Contact:

Right

Post by Mighty Gorgon »

Yes, you're right... :oops:

Post Reply

Return to “[2.0.x] MODs in Development”