TheRPGSite

The Lounge => Help Desk => Topic started by: Guest (Deleted) on March 04, 2006, 02:30:42 PM

Title: Well I thought I was done :(
Post by: Guest (Deleted) on March 04, 2006, 02:30:42 PM
I thought I had the play by post section done, but the fucking thing only grabs single lines.  I can't come up with a regex expression that will grab everything so it might be a while till it works.

You see the [noparse][announcement], [links] and [synopsis][/noparse] tags parse their contents into an HTML comment into the post.  When the first post reader reads it back it tages that text out of the comment and puts it where it belongs using the side blocks.

Well that's the theory.  I think I can safely say that writing regex expressions are the most difficult task a programmer ever has to do.
Title: Well I thought I was done :(
Post by: Maximum Fu on March 04, 2006, 02:33:32 PM
Hey.  I know that can't be easy.  I want to thank you for putting in the effort so that we can have our fun.

It is much appreciated.
Title: Well I thought I was done :(
Post by: Guest (Deleted) on March 04, 2006, 03:10:32 PM
And I got it! :)

Here's the code - note it cost me about 20 sanity points.

if ($this->forum['showfirstpost']==1 AND $post['postid']==$this->thread['firstpostid'])
{
$game = array();
preg_match('//', $post['message'], $matches);
$game['synopsis'] = $matches[1];

preg_match('//', $post['message'], $matches);
$game['links'] = $matches[1];


preg_match('//', $post['message'], $matches);
$game['announce'] = $matches[1];

$this->templatename = 'postbit_first';
}
Title: Well I thought I was done :(
Post by: Knightcrawler on March 04, 2006, 03:15:18 PM
AHHHHH!!!!!!!

Roll for sanity loss.

[dice=1]6[/dice]
Title: Well I thought I was done :(
Post by: Megamieuwsel on March 04, 2006, 03:18:55 PM
Sanity check as well:
[dice=6]1[/dice]
Title: Well I thought I was done :(
Post by: Name Lips on March 06, 2006, 01:04:34 AM
No mortal programmer could have done that. It's certain now. There's a ghost horse in the machine...