TinyPortal

Development => Block Codes => Topic started by: PfalzNacht on December 31, 2007, 01:12:25 AM

Title: Problem with a Code for Arcade
Post by: PfalzNacht on December 31, 2007, 01:12:25 AM
Hi!

I use this Code, and it works, but i can't see the thumpnails.

Where do i have to edit the code? The images are all in different subfolders. I tried to save all images in the path "Games", but there aren't any images.

I hope someone could help me.

Here's the Code:

/******************************************************************************
* Tiny Portal/SMF Arcade - Fading Random Game Block                           *
*******************************************************************************
* Version:            1.0 - for SMFARCADE V2                                  *
* File by:            Eric Lawson - www.ericsworld.eu                    *
*******************************************************************************
*                                                                             *
* To install:                                                                 *
* Copy the entire contents (crtl+a)(ctrl+c) of this file into a phpblock      *
*                                                                         *
* Edits:                                                                      *
* Change the txt 'play' to suit your language.                                *
* Set $no_of_games = <the number of games installed in your arcade            *
*                                                                             *
* You may also edit some of the java settings further down the file           *
* to change speed, text colour if you know what you are doing!                *
*                                                                             *
* This file is distributed in the hope that it is and will be useful,         *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of            *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
*******************************************************************************

********EDITS*****************************************************************/

$no_of_games = 116;
$txt['arcade_play']='Spielen';


//******NOTHING TO EDIT BELOW HERE********************************************

global $context, $txt, $modSettings, $scripturl, $db_prefix;

$no = rand(5,$no_of_games-10);

$sql = "SELECT ID_GAME, gameName, thumbnail, gameDirectory
        FROM {$db_prefix}arcade_games
        LIMIT $no,10";
$result = db_query($sql, __FILE__, __LINE__);


$i=0;

echo'
<div align="center">
<table width="100%" border="0" cellpadding="1">
<tr>
<td><span class="smalltext">
<script type="text/javascript">

/***********************************************
* Fading Scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var delay1 = 3000; //set delay between message change (in miliseconds)
var maxsteps1=30; // number of steps to take to change from start color to endcolor1
var stepdelay1=40; // time in miliseconds of a single step
//**Note: maxsteps1*stepdelay1 will be total time in miliseconds of fading effect
var startcolor1= new Array(255,255,255); // start color (red, green, blue)
var endcolor1=new Array(0,0,0); // end color (red, green, blue)

var fcontent1=new Array();
begintag1=\'<div align="center"style=" padding: 5px;">\'; //set opening tag, such as font declarations
';
//foreach($rg as $rg_out)
while ($rg_out = mysql_fetch_array($result))
{
$gameico1 = !$rg_out['gameDirectory'] ? $modSettings['gamesUrl'].$rg_out['thumbnail'] : $modSettings['gamesUrl'].$rg_out['gameDirectory']."/".$rg_out['thumbnail'];

echo 'fcontent1[',$i,']="<a href=\"',$scripturl,'?action=arcade;sa=play;game=',$rg_out['ID_GAME'],'\"><img border=\"0\" src=\"',$gameico1, '\" alt=\"ico\" width=\"60\" height=\"60\" title=\"',$txt['arcade_play'],' ', $rg_out['gameName'],'\"></a><br /><br /><a href=\"',$scripturl,'?action=arcade;sa=play;game=',$rg_out['ID_GAME'],'\">',$rg_out['gameName'],'</a>";
';
$i++;
}
echo'
closetag1=\'</div>\';

var fwidth1=\'100%\'; //set scroller width
var fheight1=\'100px\'; //set scroller height
var fadelinks1=1;  //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////

var ie41=document.all&&!document.getElementById;
var DOM21=document.getElementById;
var faderdelay1=3;
var index=0;

/*Rafael Raposo edited function*/
//function to change content
function changecontent1(){
if (index>=fcontent1.length)
index=0
if (DOM21){
document.getElementById("fscroller1").style.color="rgb("+startcolor1[0]+", "+startcolor1[1]+", "+startcolor1[2]+")"
document.getElementById("fscroller1").innerHTML=begintag1+fcontent1[index]+closetag1
if (fadelinks1)
linkcolorchange1(1);
colorfade1(1, 15);
}
else if (ie41)
document.all.fscroller1.innerHTML=begintag1+fcontent1[index]+closetag1;
index++
}

// colorfade1() partially by Marcio Galli for Netscape Communications.  ////////////
// Modified by Dynamicdrive.com

function linkcolorchange1(step1){
var obj=document.getElementById("fscroller1").getElementsByTagName("A");
if (obj.length>0){
for (i=0;i<obj.length;i++)
obj[i].style.color=getstepcolor1(step1);
}
}

/*Rafael Raposo edited function*/
var fadecounter1;
function colorfade1(step1) {
if(step1<=maxsteps1) {
document.getElementById("fscroller1").style.color=getstepcolor1(step1);
if (fadelinks1)
linkcolorchange1(step1);
step1++;
fadecounter1=setTimeout("colorfade1("+step1+")",stepdelay1);
}else{
clearTimeout(fadecounter1);
document.getElementById("fscroller1").style.color="rgb("+endcolor1[0]+", "+endcolor1[1]+", "+endcolor1[2]+")";
setTimeout("changecontent1()", delay1);
}
}
function getstepcolor1(step1) {
var diff1
var newcolor1=new Array(3);
for(var i=0;i<3;i++) {
diff1 = (startcolor1[i]-endcolor1[i]);
if(diff1 > 0) {
newcolor1[i] = startcolor1[i]-(Math.round((diff1/maxsteps1))*step1);
} else {
newcolor1[i] = startcolor1[i]+(Math.round((Math.abs(diff1)/maxsteps1))*step1);
}
}
return ("rgb(" + newcolor1[0] + ", " + newcolor1[1] + ", " + newcolor1[2] + ")");
}
if (ie41||DOM21)
document.write(\'<div id="fscroller1" style="border:0px solid black;width:\'+fwidth1+\';height:\'+fheight1+\'"></div>\');

if (window.addEventListener)
window.addEventListener("load", changecontent1, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent1)
else if (document.getElementById)
window.onload=changecontent1
</script>
</span>
</td>
</tr>
</table>
</div>';

/******************************************************************************
* Tiny Portal/SMF Arcade - GAMES BLOCK                                        *
*******************************************************************************
* Version:            1.0 - for SMFARCADE V2                                  *
* File by:            Eric Lawson - www.ericsworld.eu                    *
*******************************************************************************
*                                                                             *
* To install:                                                                 *
* Copy the entire contents (crtl+a)(ctrl+c) of this file into a phpblock      *
*                                                                         *
* Edits:                                                                      *
* Set $no = <number of games to show>                                         *
* Set $icons_per_row = <number if icons accross>                              *
* (eg 8 for a centre block - 2 for a side block)             *
*                                                                             *
* This file is distributed in the hope that it is and will be useful,         *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of            *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
*******************************************************************************

********EDITS*****************************************************************/

$no=10;
$icons_per_row = 5;

//******NOTHING TO EDIT BELOW HERE********************************************

$random_games_choice = rand(1,4);
$games_choice = 'games'.$random_games_choice;
$curr_position = 0;
$games_choice($no,$curr_position,$icons_per_row);

Function games3($no,$curr_position,$icons_per_row)
{
global $scripturl,$db_prefix,$modSettings;
//show the latest games
echo '<div align="center">Letzte Spiele<br />
<table cellpadding="2" cellspacing="5">
<tr>';

$sql = "SELECT ID_GAME, gameName, thumbnail, gameDirectory
FROM {$db_prefix}arcade_games
ORDER BY ID_GAME DESC , gameName ASC LIMIT 0,{$no}";
$result = db_query($sql,__FILE__,__LINE__);
while($game = mysql_fetch_array($result))
{
$game_thumb = !$game['gameDirectory'] ? $modSettings['gamesUrl']."/".$game['thumbnail'] : $modSettings['gamesUrl'].$game['gameDirectory']."/".$game['thumbnail'];
if($curr_position == $icons_per_row)
{
echo '</tr><tr>';
$curr_position=0;
}
echo'
<td>
<a href="'.$scripturl.'?action=arcade;sa=play;game='.$game['ID_GAME'].'">
<img src="'.$game_thumb.'" border="0" alt="'.$game['gameName'].'" width="60" height="60" title="Play '.$game['gameName'].'"/></a>
</td>';
$curr_position++;
}
mysql_free_result($result);

echo '
</tr>
</table></div>';
}

Function games1($no,$curr_position,$icons_per_row)
{
//show most played games (one score version only)
global $scripturl,$db_prefix,$modSettings;

echo '<div align="center">Meist gespielte<br />
<table cellpadding="2" cellspacing="5">
<tr>';

$sql = "SELECT ID_GAME, gameName, thumbnail, gameDirectory
FROM {$db_prefix}arcade_games
ORDER BY numPlays DESC , gameName ASC LIMIT 0,{$no}";
$result = db_query($sql,__FILE__,__LINE__);
while($game = mysql_fetch_array($result))
{
$game_thumb = !$game['gameDirectory'] ? $modSettings['gamesUrl']."/".$game['thumbnail'] : $modSettings['gamesUrl'].$game['gameDirectory']."/".$game['thumbnail'];
if($curr_position == $icons_per_row)
{
echo '</tr><tr>';
$curr_position=0;
}
echo'
<td>
<a href="'.$scripturl.'?action=arcade;sa=play;game='.$game['ID_GAME'].'">
<img src="'.$game_thumb.'" border="0" alt="'.$game['gameName'].'" width="60" height="60" title="Play '.$game['gameName'].'"/></a>
</td>';
$curr_position++;
}
mysql_free_result($result);

echo '
</tr>
</table></div>';
}


Function games4($no,$curr_position,$icons_per_row)
{
//show least played games (one score version only)
global $scripturl,$db_prefix,$modSettings;
echo '<div align="center">Zuletzt gespielt<br />
<table cellpadding="2" cellspacing="5">
<tr>';

$sql = "SELECT ID_GAME, gameName, thumbnail, gameDirectory
FROM {$db_prefix}arcade_games
ORDER BY numPlays ASC , gameName ASC LIMIT 0,{$no}";
$result = db_query($sql,__FILE__,__LINE__);
while($game = mysql_fetch_array($result))
{
$game_thumb = !$game['gameDirectory'] ? $modSettings['gamesUrl']."/".$game['thumbnail'] : $modSettings['gamesUrl'].$game['gameDirectory']."/".$game['thumbnail'];
if($curr_position == $icons_per_row)
{
echo '</tr><tr>';
$curr_position=0;
}
echo'
<td>
<a href="'.$scripturl.'?action=arcade;sa=play;game='.$game['ID_GAME'].'">
<img src="'.$game_thumb.'" border="0" alt="'.$game['gameName'].'" width="60" height="60" title="Play '.$game['gameName'].'"/></a>
</td>';
$curr_position++;
}
mysql_free_result($result);

echo '
</tr>
</table></div>';
}


Function games2($no,$curr_position,$icons_per_row)
{
//show best rated games
global $scripturl,$db_prefix,$modSettings;
echo '<div align="center">Top Rated<br />
<table cellpadding="2" cellspacing="5">
<tr>';

$sql = "SELECT ID_GAME, gameName, thumbnail, gameDirectory
FROM {$db_prefix}arcade_games
ORDER BY gameRating DESC , gameName ASC LIMIT 0,{$no}";
$result = db_query($sql,__FILE__,__LINE__);
while($game = mysql_fetch_array($result))
{
$game_thumb = !$game['gameDirectory'] ? $modSettings['gamesUrl']."/".$game['thumbnail'] : $modSettings['gamesUrl'].$game['gameDirectory']."/".$game['thumbnail'];
if($curr_position == $icons_per_row)
{
echo '</tr><tr>';
$curr_position=0;
}
echo'
<td>
<a href="'.$scripturl.'?action=arcade;sa=play;game='.$game['ID_GAME'].'">
<img src="'.$game_thumb.'" border="0" alt="'.$game['gameName'].'" width="60" height="60" title="Play '.$game['gameName'].'"/></a>
</td>';
$curr_position++;
}
mysql_free_result($result);

echo '
</tr>
</table></div>';
}

/******************************************************************************
* Tiny Portal/SMF Arcade - SCROLLING CHAMPS BLOCK                             *
*******************************************************************************
* Version:            1.0 - for SMFARCADE V2                                  *
* File by:            Eric Lawson - www.ericsworld.eu                    *
*******************************************************************************
*                                                                             *
* To install:                                                                 *
* Copy the entire contents (crtl+a)(ctrl+c) of this file into a phpblock      *
*                                                                         *
* Edits:                                                                      *
* Change the txt strings to suit your language.                               *
* Set $no = <number of top players to show>                                   *
*                                                                             *
* Uploads:             *
* Upload a pic called arcade_block.gif                                        *
* (you can use you own gif - just name it arcade_block.gif) to each:          *
* Themes/<themename>/images/                                                  *
*                                                                             *
* This file is distributed in the hope that it is and will be useful,         *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of            *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
*******************************************************************************

********EDITS*****************************************************************/

$no = 10; //number of top players to show

// --LANGUAGE EDITS --
$txtplay = "Die besten Spieler"; // change "The Top Players" to your language
$txtwin = "Gewonnene Spiele :";// change "Number Of Wins :" to your language
$txtlate = "Letzte Highscore von: ";// change "Latest High Score set by" to your language
$txtwit = "mit ";// change "with" to your language
$txton = "an ";// change "on" to your language

//******NOTHING TO EDIT BELOW HERE********************************************

global $scripturl,$sourcedir,$boardurl,$db_prefix,$modSettings;
require_once($sourcedir.'/ArcadeStats.php');

//Get newest champ or die
$sql = "SELECT game.ID_GAME, game.gameName, game.thumbnail, game.gameDirectory,
        IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, IFNULL(mem.realName,'') AS realName, score.score
        FROM {$db_prefix}arcade_scores AS score
        LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = score.ID_MEMBER)
        JOIN {$db_prefix}arcade_games AS game ON (game.ID_GAME = score.ID_GAME)
        ORDER BY `championFrom` DESC
        LIMIT 0,1";
if(!($result = db_query($sql,__FILE__,__LINE__)))
{
die("Could not get the newest champ");
}
$row = mysql_fetch_assoc($result);
mysql_free_result($result);

if(isset($row['gameDirectory']))
{
$row['gameDirectory']=$row['gameDirectory']."/";
}

//newest champ details
$playerid = $row['ID_MEMBER'];
$player = $row['realName'];
$game_id = $row['ID_GAME'];
$game_name = $row['gameName'];
$score = $row['score'];
$game_pic = $modSettings['gamesUrl'].$row['gameDirectory'].$row['thumbnail'];

$bp=ArcadeStats_BestPlayers($no);

$score_poss=0; //players position

?>

<script type="text/javascript">

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scrollx=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeedx=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseitx=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeedx=marqueespeedx
var pausespeedx=(pauseitx==0)? copyspeedx: 0
var actualheightx=''

function scrollmarqueex(){
if (parseInt(cross_marqueex.style.top)>(actualheightx*(-1)+8))
cross_marqueex.style.top=parseInt(cross_marqueex.style.top)-copyspeedx+"px"
else
cross_marqueex.style.top=parseInt(marqueeheightx)+8+"px"
}

function initializemarqueex(){
cross_marqueex=document.getElementById("vmarqueex")
cross_marqueex.style.top=0
marqueeheightx=document.getElementById("marqueecontainerx").offsetHeight
actualheightx=cross_marqueex.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marqueex.style.height=marqueeheightx+"px"
cross_marqueex.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarqueex()",30)', delayb4scrollx)
}

if (window.addEventListener)
window.addEventListener("load", initializemarqueex, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarqueex)
else if (document.getElementById)
window.onload=initializemarqueex

</script>
<?php
echo '<table width="100%">
<tr>
<td align="center">
<br />
<a href="'
,$scripturl,'?action=arcade"><img src="',$settings['images_url'],'/arcade_block.gif" border= "0" alt="Arcade" /></a>
<br /><br/>
</td>
</tr>
</table>
<div id="marqueecontainerx" style="position: relative; width: 95%; height:200px; overflow: hidden; border: 0px; padding: 2px; padding-left: 4px;" onmouseover="copyspeedx=pausespeedx" onmouseout="copyspeedx=marqueespeedx">
<div id="vmarqueex" style="position: absolute; width: 98%;">
<div align="center">
<a href="'
,$scripturl,'?action=arcade;sa=play;game=',$game_id,'"><img src="',$game_pic,'" border="0" alt="',$game_name,'" width="60" height="60"/></a>
<br />'
,$txtlate,'<br />
<a href="'
,$scripturl,'?action=profile;u=',$playerid,'">',$player,'</a>
<br/>'
,$txtwit,' ',$score,' ',$txton,'<br />',$game_name,'
<br />------------------<br />'
,$txtplay,'<br /><br />';
foreach ($bp as $out)
{
$score_poss++;
echo '',$score_poss,' - ',$out['link'],'<br />',$txtwin,' ',$out['champions'],'
     <br /><br />'
;
};
echo '</div>
</div>
</div>'
;

//---------END--------------
Title: Re: Problem with a Code for Arcade
Post by: Ken. on December 31, 2007, 02:09:44 AM
As noted in the code it was built by "Eric Lawson - www.ericsworld.eu "

Chances are you'll get better help for the code there, but one thing you can check is the path to the images to make sure the code is looking for them in the correct folder.
Maybe make a folder in the location where the code is pointed?


EDIT: edited to cross out part of my reply because after reading through the code again it dose not seem to fit the question.
Title: Re: Problem with a Code for Arcade
Post by: G6Cad on January 01, 2008, 09:05:03 PM
The images have their OWN folder under your forum category called arc_images and the game images (the one that should show right next to the games in the gamelisting inside the arcade is placed in the folder GAMES, but they need to have the EXACT sma ename as the gamename they are supporting.

If you cant get them to show, you have to ask on ericsworld as it's there you got the arcade from,
Title: Re: Problem with a Code for Arcade
Post by: Assistance on January 09, 2008, 10:32:19 AM
if you have updated your arcade
you should hit the download section and pick up a copy of the new block code

Version:              1.0 - for SMFARCADE V2 E2.3.3