Latest Updates:
Page Index Toggle Pages: 1 ... 3 4 [5] 6 
Topic Tools
Very Hot Topic (More than 25 Replies) How to insert playable PGN games in your posts (Read 54904 times)
Smyslov_Fan
YaBB Moderator
Correspondence fan
*****
Offline


Progress depends on the
unreasonable man. ~GBS

Posts: 6902
Joined: 06/15/05
Re: Replayable chessgames
Reply #23 - 04/06/11 at 13:03:12
Post Tools
Woo hoo! Great job Jesse! (It's not too early to celebrate yet, is it?)
  
Back to top
 
IP Logged
 
Klick
God Member
*****
Offline



Posts: 528
Joined: 01/31/03
Re: Replayable chessgames
Reply #22 - 04/06/11 at 08:46:29
Post Tools
Regular expression? Should be relatively simple.

Edit: Changing the regular expression
Code
Select All
[pgn\](.*?)\[/pgn\]
 

in
Code
Select All
$message =~ s~\[pgn\](.*?)\[/pgn\]~<div><object type="application/x-shockwave-flash" data="http://chessflash.com/releases/latest/ChessFlash.swf" width="100%" height="350"><param name="movie" value="http://chessflash.com/releases/latest/ChessFlash.swf" /><param name="flashvars" fffff&pgndata=$1'/></object></div>~isg;

 

should do the trick, but I think it`s best if someone familiar with Perl tests it, just as Jesse requests.
  

There just isn't enough televised chess - DAVID LETTERMAN
Back to top
 
IP Logged
 
Jesse Gersenson
Full Member
***
Offline


Piece value = Mobility
+ targets

Posts: 162
Joined: 09/12/09
Re: Replayable chessgames
Reply #21 - 04/06/11 at 07:34:58
Post Tools
[highlight]Attention Perl Programers: help needed[/highlight]

For the chessflash feature to work correctly, Line breaks need to be removed and single quote characters need to be converted to single right quotation marks from $1 in this block:
[code]$message =~ s~\[pgn\](.*?)\[/pgn\]~<div><object type="application/x-shockwave-flash" data="http://chessflash.com/releases/latest/ChessFlash.swf" width="100%" height="350"><param name="movie" value="http://chessflash.com/releases/latest/ChessFlash.swf" /><param name="flashvars" fffff&pgndata=$1'/></object></div>~isg;[/code]

must work with perl version: 5.8.8

quick online search suggests these find/replace to remove the line breaks:
[code]$pgn =~ s/\015?\012?$//;[/code]
or
[code]$pgn =~ s/[\r\n]+//g;[/code]
  
Back to top
WWW  
IP Logged
 
Matemax
God Member
*****
Offline


Chesspub gives you strength!

Posts: 1302
Joined: 11/04/07
Re: Replayable chessgames
Reply #20 - 04/06/11 at 07:17:58
Post Tools


nice - only needs a bit correcting - all " " have to be deleted
  
Back to top
 
IP Logged
 
Klick
God Member
*****
Offline



Posts: 528
Joined: 01/31/03
Re: Replayable chessgames
Reply #19 - 04/06/11 at 06:48:35
Post Tools


Wow, way beyond cool.
Kudos to Jesse for the effort and Tony for adding the code.

Testing if this interfers with posting board-image:
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
*

As I post this there are 4 games being shown on the page. I`m not noticing that page-loading is getting particularly slow.
  

There just isn't enough televised chess - DAVID LETTERMAN
Back to top
 
IP Logged
 
Stigma
God Member
*****
Offline


There is a crack in everything.

Posts: 3147
Joined: 11/07/06
Gender: Male
Re: Replayable chessgames
Reply #18 - 04/06/11 at 02:14:01
Post Tools
Can you also get the pgn headers embedded in the viewer? Let me try:



This seems to work. But only if there are no line shifts ("enter") between the first pgn header and the first move. Maybe there's also some limitation on which headers are accepted.
  

Improvement begins at the edge of your comfort zone. -Jonathan Rowson
Back to top
 
IP Logged
 
GMTonyKosten
YaBB Administrator
*****
Offline


Mr Dynamic?

Posts: 3100
Location: Clermont-Ferrand
Joined: 12/19/02
Gender: Male
Re: Replayable chessgames
Reply #17 - 04/06/11 at 01:10:17
Post Tools
OK, I've added the code and now I'm going to give it a try:

Averbakh - Kotov, 1953



  
Back to top
IP Logged
 
Jesse Gersenson
Full Member
***
Offline


Piece value = Mobility
+ targets

Posts: 162
Joined: 09/12/09
Re: Replayable chessgames
Reply #16 - 04/05/11 at 12:42:23
Post Tools
should show a board with 2 moves

  
Back to top
WWW  
IP Logged
 
Jesse Gersenson
Full Member
***
Offline


Piece value = Mobility
+ targets

Posts: 162
Joined: 09/12/09
Re: Replayable chessgames
Reply #15 - 04/05/11 at 06:49:01
Post Tools
[b]testing ... why [b]was there an unclosed tag
[/b]
  
Back to top
WWW  
IP Logged
 
Jesse Gersenson
Full Member
***
Offline


Piece value = Mobility
+ targets

Posts: 162
Joined: 09/12/09
Re: Replayable chessgames
Reply #14 - 04/04/11 at 13:10:18
Post Tools
Markovich,

Yabb 2.4 is open source code written in Perl.

http://sourceforge.net/projects/yabb/files/YaBB%202/2.4/
  
Back to top
WWW  
IP Logged
 
Jesse Gersenson
Full Member
***
Offline


Piece value = Mobility
+ targets

Posts: 162
Joined: 09/12/09
Re: Replayable chessgames
Reply #13 - 04/03/11 at 18:56:13
Post Tools
Hi Tony,

attached is the (untested) code needed to enable a pgn] tag which displays the pgn with the chessflash viewer.

post the file to
[code]cgi-bin/yabb2/Sources/YaBBC.pl [/code]


note: if several boards appear on the same page, the page may get slow. There is a simple workaround which requires a few js's to be added to the site.

the line i added is a simple find and replace
[code]
$message =~ s~\[pgn\](.*?)\[/pgn\]~<div><object type="application/x-shockwave-flash" data="http://chessflash.com/releases/latest/ChessFlash.swf" width="100%" height="350"><param name="movie" value="http://chessflash.com/releases/latest/ChessFlash.swf" /><param name="flashvars" fffff&pgndata=$1'/></object></div>~isg;
[/code]


[Event "Ed vs. Bob"]
[Site "Ed's garage"]
[Date "2011.04.03"]
[Round "1"]
[White "Bob"]
[Black "Ed"]
[Result "*"]
[BlackElo "400"]
[ECO "A00"]
[Opening "Kadas (Desprez) Opening"]
[Time "21:36:59"]
[Variation "Grand Prix, Tal Defence, 1.e4 c5 2.f4 d5"]
[WhiteElo "2400"]
[TimeControl "120+6"]
[PlyCount "22"]
[WhiteType "human"]
[BlackType "human"]

[pgn] 1. h4 {The wild west of opening theory.} g5 {an unsound gambit.} 2. f4 e5 3. d4 d5 4. e4 c5 5. b4 a5 6. a4 b5 7. c4 f5 8. Rh3 h5 9. g4 Rh6 10. Ra2 Rha6 11. Rb3 R8a7 [/pgn]
« Last Edit: 04/06/11 at 00:55:53 by GMTonyKosten »  

YaBBC.txt ( 22 KB | Downloads )
Back to top
WWW  
IP Logged
 
Markovich
God Member
*****
Offline



Posts: 6099
Location: Columbus, Ohio
Joined: 09/17/04
Re: Replayable chessgames
Reply #12 - 04/03/11 at 16:25:42
Post Tools
Frankly I think the forum would need to be re-written outside Yabb to make this possible.  Perhaps I am wrong.
  

The Great Oz has spoken!
Back to top
 
IP Logged
 
Jesse Gersenson
Full Member
***
Offline


Piece value = Mobility
+ targets

Posts: 162
Joined: 09/12/09
Re: Replayable chessgames
Reply #11 - 04/03/11 at 09:13:06
Post Tools
Here's the response from Glenn Wilson, the developer of chessflash.

Hi Jesse,

I appreciate your interest in ChessFlash and in trying to get it to work on your forum.  I have no particular Yabb knowledge and probably can't help with the specifics.  Many forums restrict what html and embedding users may post to make sure the forum continues to work -- I can't blame anyone for that.   But, that also means in some cases that ChessFlash can't be used.

I don't know if it is of any help but here is an example of a forum where they were able to make ChessFlash work.
http://icsdiscussion.forumotion.net/t40-display-testing-ground#200

I have looked at the links you sent and read your discussion and think you are likely on the right track -- the Yabb developers may need to add the functionality.  Another possibility (which may or may not apply to Yabb) is that an administrator can turn on/off certain restrictions which would allow the "normal" ChessFlash code to be embedded and interpreted correctly.

Regards and Good Luck,
Glenn
  
Back to top
WWW  
IP Logged
 
Jesse Gersenson
Full Member
***
Offline


Piece value = Mobility
+ targets

Posts: 162
Joined: 09/12/09
Re: Replayable chessgames
Reply #10 - 04/02/11 at 06:39:16
Post Tools
i read through yabb's [media] code. seems like it's only able to recognize a .swf file as a swf file if the file name ends with .swf. this means .swf?pgndatahere wouldn't work out of the box. but that it could work.

someone should write the yabb developers and ask them to build a [pgn] function. would be simple for them. they take the pgn and build this

Code
Select All
<object type="application/x-shockwave-flash" data="http://chessflash.com/releases/latest/ChessFlash.swf" width="100%" height="350">

<param name="movie" value="http://chessflash.com/releases/latest/ChessFlash.swf" />

<param name="flashvars" tbackground=ffffff&pgndata=_pgn_'/>

</object> 

  
Back to top
WWW  
IP Logged
 
Jesse Gersenson
Full Member
***
Offline


Piece value = Mobility
+ targets

Posts: 162
Joined: 09/12/09
Re: Replayable chessgames
Reply #9 - 04/02/11 at 05:55:31
Post Tools
base code:
[code][media]http://chessflash.com/releases/latest/ChessFlash.swf[/media][/code]

i'd guess the pgn data needs to be appended to the url. maybe something like
http://chessflash.com/releases/latest/ChessFlash.swf?flashvars='pgndata'

working example:
[url]http://chessflash.com/releases/latest/ChessFlash.swfFlashVars='orientation=H&tabmode=false&light=f4f4fF&dark=0072b9&bordertext=494949&headerforeground=ffffff&mtforeground=000000&mtvariations=FF0000&mtmainline=000000&mtbackground=ffffff&boardonly=true&autoplay=true&pgndata=[Event "Computer chess game"] [Site "somewhere"] [Date "2011.01.23"] [Round "?"] [White "Gersenson"] [Black "Bohuslav Krouzek "] [Result "1-0"] [BlackElo "1737"] [ECO "B19"] [Opening "Caro-Kann"] [Time "15:26:14"] [Variation "Classical, Spassky, 10.Qxd3 e6 11.Bf4"] [WhiteElo "1750"] [TimeControl "180"] [Termination "normal"] [PlyCount "149"] [WhiteType "human"] [BlackType "human"] 1. e4 d5'[/url]

i wrote the developer of chessflash - will report back if he says anything interesting. another option would be to make a plugin for the Yabb forum software which is running this site. such a plug exists for wordpress.

then, we could post a pgn and simply wrap it in the tags [pgn] ... [/pgn]
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1 ... 3 4 [5] 6 
Topic Tools
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo