vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Major Additions - Chess (https://vborg.vbsupport.ru/showthread.php?t=153638)

Ransack 08-25-2007 06:05 PM

Quote:

Originally Posted by Ransack (Post 1325563)
2. When a piece is replaced e.g. pawn promotion, the ajax update on the opponent's board shows the move, but not the changed piece. (It works if the entire page is refreshed though.) How do I fix that?

Ignore this one, sorry. This is not a bug. Works for me now.

Carnage 08-25-2007 07:03 PM

Quote:

Originally Posted by michael5472 (Post 1321122)
Got a problem - The pieces can move ANYWHERE

Basicly i was playing normally and someone moved their king 2spaces.........

I then proceded in selecting everypiece on the board and selecting queen and i had a board full of queen's.

Has this been fixed in the update ? it doesn't say.............

if you have a chessboard and play a friend at home the pieces can move anywhere. This mod was made to be as realistic as possible. That wouldn't be true if pieces had limited movement :p


Quote:

Originally Posted by Ransack (Post 1325563)
1. Why does the ajax not update the board state after moves for spectators? It seems to work for players, but people who are just watching the thread do not see the updates, though they see the chesschat text area get updated. Where do I fix that?

Theres no reason spectators shouldn't see new moves... i'll look into it.

Quote:

Originally Posted by Ransack (Post 1325578)
Also, why does the "moveno" tag in the AJAX xml reply not reflect the actual move number and what is the purpose of this tag?

It was orriginally the move number but invalid moves messed up the counter so it now represents the number of posts made in the thread - i should probably change the variable name but its a fairly minor issue.

Ransack 08-25-2007 07:27 PM

Quote:

Originally Posted by Carnage- (Post 1325640)

Theres no reason spectators shouldn't see new moves... i'll look into it.

This seems to be working for me again too now. Odd. I wonder if this is intermittent.

Ransack 08-25-2007 07:59 PM

Quote:

Originally Posted by michael5472 (Post 1321139)
oh well no point in installing it then - Thanks.

Whats the point in going in to making a mod like this if you are not going to do it properly ?

I am working on tweaking this mod to enforce valid moves and such. Hopefully Carnage can integrate this and offer different configurable modes of play, or they can stand alone as two separate products. Still I'm hoping for his help with some of my tweaks as some of the ajax code is a bit confusing to me :)

Our House 08-26-2007 04:04 AM

Quote:

Originally Posted by ramchip (Post 1309576)
My forum has a fixed width of 1000px but the forum with the chess games seems to be full width. Is there a way to restrict the chess forum to 1000px?

Thanks this is a great mod.

I'm having the same problem. My forum is 900px fixed width, but the chess template is stretching to the outside edge of my left/right margins instead of being inside of them.

Ransack 08-28-2007 12:39 AM

Quote:

Originally Posted by Our House (Post 1325827)
I'm having the same problem. My forum is 900px fixed width, but the chess template is stretching to the outside edge of my left/right margins instead of being inside of them.

In the chess template, you can change the outermost element (either table or div I forget) to 95% and then wrap the entire thing in a <center> tag. That fixed this issue for me.

Tulsa 08-28-2007 02:13 AM

I had to change mine to 94% to get it to line up properly. Maybe that's just the way it lines up using firefox?

Anyway at the very top line of the chess template change the 100% to 94% or 95% or whatever works for your site.

Code:

<table class="tborder" id="post$post[postid]" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="94%" align="center">
It's already aligned center.

Our House 08-28-2007 04:44 AM

Hi guys,

Thanks for the replies. Unfortunately, that doesn't fix it for me.

The problem is that the Chess plugin is missing the (forum's) page background. I have 3 skins and this disrupts two of them. We have a 10px border on both fixed-width sides of all forum pages. Chess is missing the CSS for that.

Hopefully I didn't butcher that explanation. :o

Fearlessninja 08-29-2007 03:20 AM

When will the official version which supports the rules be out?

abdulla1 08-31-2007 11:46 PM

Quote:

Originally Posted by aranthorn (Post 1320389)
I have a couple really nit-picky users complained about white/black, flipped board, etc. Because this mod uses style CSS definitions of alt1 and alt2 for the board (which I think was the right way to go in coding it, btw) some users of mine complained that the Queen's not on her color. She is, but my some of styles are defined with light and dark tones reversed from vB's default. So here's what I did:

I added this bit into every style's "Additional CSS Definitions" area in style manger
Code:

/** START Chess Board **/
                .chess1 {
                  background-color : #FFFFFF;
                }
               
                .chess2 {
                  background-color : #000000;
                }
/** END Chess Board **/

The I changed the plugin "showthread_complete" for the product "chess" to this:
Code:

if($forumid == $vbulletin->options['chess_forumid'])
{
$empty = array('a'=>'','b'=>'','c'=>'','d'=>'','e'=>'','f'=>'','g'=>'','h'=>'');
$board = array(1=>array('a'=>'wR','b'=>'wN','c'=>'wB','d'=>'wQ','e'=>'wK',f=>'wB','g'=>'wN','h'=>'wR'),
              2=>array('a'=>'wP','b'=>'wP','c'=>'wP','d'=>'wP','e'=>'wP','f'=>'wP','g'=>'wP','h'=>'wP'),
              3=>$empty,
              4=>$empty,
              5=>$empty,
              6=>$empty,
              7=>array('a'=>'bP','b'=>'bP','c'=>'bP','d'=>'bP','e'=>'bP','f'=>'bP','g'=>'bP',h=>'bP'),
              8=>array('a'=>'bR','b'=>'bN','c'=>'bB','d'=>'bQ','e'=>'bK','f'=>'bB','g'=>'bN','h'=>'bR'));

if(preg_match_all("#player\(1,([^)]+)\)#",$data[0][1],$matches,PREG_SET_ORDER))
{
        $player1 = $matches[0][1];
}
else
{
        $player1 = $data[0][0];
}
if(preg_match_all("#player\(2,([^)]+)\)#",$data[0][1],$matches,PREG_SET_ORDER))
{
        $player2 = $matches[0][1];
}

$moveno = 1;
$taken = array();
foreach($data AS $move)
{
        if(!$player2)
        {
                if($move[0] != $player1)
                {
                        $player2 = $move[0];
                }
        }
        $postcnt++;
       
        if( (($moveno % 2) && $move[0] == $player1) || (!($moveno % 2) && $move[0] == $player2))
        {         
                if(preg_match_all("#\(([a-h])([1-8]),([a-h])([1-8])\)#",$move[1],$matches,PREG_SET_ORDER))
                {
                        $moveno++;
                }
                foreach($matches AS $match)
                {
                        if($board[$match[4]][$match[3]] != '')
                        {
                                $taken[] = $board[$match[4]][$match[3]];
                        }
                        $board[$match[4]][$match[3]] = $board[$match[2]][$match[1]];
                        $board[$match[2]][$match[1]] = '';
                }
                preg_match_all("#\(([a-h])([1-8]),(w|b)(Q|R|N|B|K|P)\)#",$move[1],$matches,PREG_SET_ORDER);
                foreach($matches AS $match)
                {
                        $board[$match[2]][$match[1]] = $match[3].$match[4];
                }
        }

        $movestext[] =  implode($move,": ");

}

$post['signature'] =  "<div id=\"chesschat\" style=\"max-height:200px;overflow:auto;\">" . implode(array_reverse($movestext),"<br />") . "</div>";
if($vbulletin->userinfo['userid'] == 100000000)
{
print_r($vbulletin->options);
die($vbulletin->options['chess_rotation']);
}
if($vbulletin->options['chess_rotation'])
{
        $board = array_reverse($board,true);
}
foreach($board AS $row =>$rowdata)
{
        $output .= "<tr height=\"40px\"><td>$row</td>";
        foreach($rowdata AS $col => $coldata)
        {
                $class = ($class == 'chess1') ? 'chess2':'chess1';
                $imgstr = (($coldata == '') ? ('&nbsp;') : ('<img width="40px" height="40px" src="' . $vbulletin->options['bburl'] . '/images/chess/' . (($coldata[0] == 'b') ? ($vbulletin->options['chess_black']) : ($vbulletin->options['chess_white'])) . "/" . $coldata[1] . ".gif\" />"));
                $output .= "<td id=\"".$col.$row."\"width=\"40px\" onclick=\"move(event,'".$col.$row."')\" class=\"$class\">$imgstr</td>";
        }
        $output .= "</tr>";
        $class = ($class == 'chess1') ? 'chess2':'chess1';

}

foreach($taken AS $piece)
{
        if(substr($piece,0,1) == "w")
        {
                if(!$white)
                {
                        $white = "<tr>";
                        $whitecnt = 0;
                }
               
                $white .= "<td><img src=\"".$vbulletin->options['bburl']."/images/chess/".$vbulletin->options['chess_white']."/".$piece[1].".gif\" /></td>";
                $whitecnt ++;
               
                if(!($whitecnt % 6))
                {
                        $white .= "</tr><tr>";
                }
        }
        else
        {
                if(!$black)
                {
                        $black = "<tr>";
                        $blackcnt = 0;
                }

                $black .= "<td><img src=\"".$vbulletin->options['bburl']."/images/chess/".$vbulletin->options['chess_black']."/".$piece[1].".gif\" /></td>";
                $blackcnt ++;
               
                if(!($blackcnt % 6))
                {
                        $black .= "</tr><tr>";
                }
        }
}

$game_text = $player1 . " vs " . $player2;
$moveplr = (($moveno % 2) ? $player1 : $player2);
$move_text = "Move: $moveno <br /> " . $moveplr . " to move next.";

eval('$postbits = "' . fetch_template('chess') . '";');
}

All I did was replace the alt1 and alt2 references in the original product plugin with chess1 and chess2 which was defined with white and black backgrounds in the "Additional CSS Definitions" that I added. The part that has the tweaks is in bold / red.

I am going to start looking into making a marble chessboard, wood chessboard, etc.


I'm facing the same problem, they complains about not to flip for black. :(

what can i do? can u please modify it so it flips automaticaly for the other player.
it cant that one play from down to up, and the other from up to down. causes confusion
for black.

great mod though.


All times are GMT. The time now is 03:52 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.01290 seconds
  • Memory Usage 1,789KB
  • 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
  • (3)bbcode_code_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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