Topic: Webmap For SFC3 Need SFC2 Minds for help!!!  (Read 3615 times)

0 Members and 1 Guest are viewing this topic.

Offline S31-Riptide

  • Lt. Junior Grade
  • *
  • Posts: 142
  • Gender: Male
    • Chaotic Network & SFC3.net
Webmap For SFC3 Need SFC2 Minds for help!!!
« on: August 25, 2006, 10:14:03 am »
One way to get your attention  ;D

I've been working on a conversion for Webmap to SFC3... I've gotten most of it done... but.... I still can't get the news to show up properly.... anyone with experience in webmap if you can point me in the right direction, it would be greatly appreciated!  I'm not that strong in PhP, but the info being grabbed from the database is pure text, hence why I'm confused as to why it is not showing up as text????

http://www.gameserver.sfc3.net/wm/

I don't have the IRC hooked up yet, as I'm still waiting for the connection info from Scratch.

 ;D

here is the php script in question.... I did have to rename the "Idiom" to "MessageEnglish" as there is a slight difference between the sfc2 db and the sfc3 db... is the Idiom column in sfc2 text or hex??? anyone know???  Thanks in advance...

Here is the php script....
Quote
  $ID = array();
                $PersistenceLevel = array();
                $UrgencyLevel = array();
                $Category = array();
                $MessageEnglishSize = array();
                $MessageEnglish = array();
                $NewsTime = array();
                $TimeDetail = array();
                $Color = array();

                $MessageEnglishtext = "";
                $MessageEnglishtextcorr = "";
                $testchar = "";
                $test=0;

                $caturgcolor = array();
                $caturgcolor[0][0] = "#B6B7FE";
                $caturgcolor[0][1] = "#A9A9F1";
                $caturgcolor[0][2] = "#9594E0";
                $caturgcolor[0][3] = "#8282CE";
                $caturgcolor[0][4] = "#6C6CBA";
                $caturgcolor[0][5] = "#5B5CAA";
                $caturgcolor[1][0] = "#EB873D";
                $caturgcolor[1][1] = "#DE7032";
                $caturgcolor[1][2] = "#CE5524";
                $caturgcolor[1][3] = "#BE3B18";
                $caturgcolor[1][4] = "#AF210B";
                $caturgcolor[1][5] = "#A20C01";
                $caturgcolor[2][0] = "#00EB72";
                $caturgcolor[2][1] = "#00D668";
                $caturgcolor[2][2] = "#00BC5B";
                $caturgcolor[2][3] = "#00A44F";
                $caturgcolor[2][4] = "#008A42";
                $caturgcolor[2][5] = "#007639";


                $link = mysql_connect($D2dbhostname .":" .$D2dbport, $D2dbuser, $D2dbpass);
                mysql_select_db($D2db);

                    $query = "SELECT UrgencyLevel,Category,MessageEnglish FROM newsstory ORDER BY NewsTime,MessageEnglish";
                    $result = mysql_query($query);
                $a=0;
                while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

                $UrgencyLevel[$a] = $line['UrgencyLevel'];
                $Category[$a] = $line['Category'];
                $MessageEnglish[$a] = $line['MessageEnglish'];

                $a=$a+1;
                    }
                    mysql_free_result($result);
                    mysql_close($link);
           

                echo ("<br>");
                for ($i=$a;$i--;) {
                   
                    for ($j=0; $j<strlen($MessageEnglish[$i])/2; $j++) {
                        $MessageEnglishtext.=chr(base_convert(substr($MessageEnglish[$i],$j*2,2),16,10));
                    }

                    $test=0;                   
                    for ($k=0; $k<strlen($MessageEnglishtext)-1; $k++) {
                        $testchar = substr($MessageEnglishtext, $k, 1);
                        if($testchar == ".") {
                            $MessageEnglishtextcorr = substr($MessageEnglishtext, $k+2);
                            $test=1;
                        }
                        if($testchar == "!") {
                            $MessageEnglishtextcorr = substr($MessageEnglishtext, $k+2);
                            $test=1;
                        }
                   
                    }
                    if($test == 0) {
                        $MessageEnglishtextcorr = substr($MessageEnglishtext, 1);
                    }

                    echo ("<b>");                   
                    echo ("<font color=");
                    echo $caturgcolor[$Category[$i]][$UrgencyLevel[$i]];
                    echo (">");

                    echo $MessageEnglishtextcorr;
                   
                    echo ("</font>");
                    echo ("</b><br><br>");

                    $MessageEnglishtext = "";
                    $MessageEnglishtextcorr = "";
               }
« Last Edit: August 26, 2006, 04:48:36 pm by Riptide »

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: Webmap For SFC3 Need SFC2 Minds for help!!!
« Reply #1 on: August 27, 2006, 08:17:02 am »
The news idioms are stored as a blob in the OP database, but are stored as plain text in the SFC3 database.

SFC3 news table:
Code: [Select]
create table NewsStory
(
ID bigint not null,
Locked DateTime,
LockID int,

PersistenceLevel bigint not null,
UrgencyLevel bigint not null,
Category bigint not null,
MessageEnglish text not null,
MessageGerman text not null,
NewsTime bigint not null,
TimeDetail bigint not null,
Color bigint not null,

primary key (ID)
);

SFC:OP news table
Code: [Select]
CREATE TABLE newsstory (
  ID int(11) NOT NULL default '0',
  LOCKED datetime default NULL,
  LOCKID int(11) default NULL,
  PersistenceLevel int(11) NOT NULL default '0',
  UrgencyLevel int(11) NOT NULL default '0',
  Category int(11) NOT NULL default '0',
  IdiomSize int(11) NOT NULL default '0',
  Idiom blob NOT NULL,
  NewsTime int(11) NOT NULL default '0',
  TimeDetail int(11) NOT NULL default '0',
  Color int(11) NOT NULL default '0',
  PRIMARY KEY  (ID)
) TYPE=MyISAM;


So you can just dump the code that translates the blob into plain text and try something like this:

Code: [Select]
<?php
$UrgencyLevel 
= array();
$Category = array();
$MessageEnglish = array();

$caturgcolor = array();
$caturgcolor[0][0] = "#B6B7FE";
$caturgcolor[0][1] = "#A9A9F1";
$caturgcolor[0][2] = "#9594E0";
$caturgcolor[0][3] = "#8282CE";
$caturgcolor[0][4] = "#6C6CBA";
$caturgcolor[0][5] = "#5B5CAA";
$caturgcolor[1][0] = "#EB873D";
$caturgcolor[1][1] = "#DE7032";
$caturgcolor[1][2] = "#CE5524";
$caturgcolor[1][3] = "#BE3B18";
$caturgcolor[1][4] = "#AF210B";
$caturgcolor[1][5] = "#A20C01";
$caturgcolor[2][0] = "#00EB72";
$caturgcolor[2][1] = "#00D668";
$caturgcolor[2][2] = "#00BC5B";
$caturgcolor[2][3] = "#00A44F";
$caturgcolor[2][4] = "#008A42";
$caturgcolor[2][5] = "#007639";

$link mysql_connect($D2dbhostname .":" .$D2dbport$D2dbuser$D2dbpass);
mysql_select_db($D2db);
$query "SELECT UrgencyLevel,Category,MessageEnglish FROM NewsStory ORDER BY NewsTime,MessageEnglish";
$result mysql_query($query);
$a=0;
while (
$line mysql_fetch_array($resultMYSQL_ASSOC)) {
$UrgencyLevel[$a] = $line['UrgencyLevel'];
$Category[$a] = $line['Category'];
$MessageEnglish[$a] = $line['MessageEnglish'];
$a=$a+1;
}
mysql_free_result($result);
mysql_close($link);
           
$news_html '<br>
'
;
for (
$i=$a;$i--;) {     
$news_html .= '<b><font color="'$caturgcolor[$Category[$i]][$UrgencyLevel[$i]]. '">'$MessageEnglish[$i]. '</font></b><br><br>
'
;
}
echo 
$news_html;
?>


Quite a bit simpler and should work for you. (<?php ?> tags added to code snippet here for forums syntax highligting only).
« Last Edit: August 27, 2006, 09:42:01 am by Bonk »

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: Webmap For SFC3 Need SFC2 Minds for help!!!
« Reply #2 on: August 27, 2006, 08:41:47 am »
I just had a look at your link and noticed a few things...

The stardate is not correct. It looks like they have stripped some of the blobs from the database and are storing the values as integers (makes good sense). So, on the index page code you should modify the stardate code accordingly, just ditch the blob conversion stuff and use the integers from the db to caclulate the stardate directly.

It also looks like the racelist is no longer stored as a blob, so you will want to modify its code accordingly and edit the racenames in the webmap config file for SFC3 as well.

The map itself poops out on a max execution time error (30s). The SQL webmap should only take a second or two to generate. I suspect that it is generating loads of undefined index errors on the webserver related to the lack of a cartel layer on the SFC3 map (which will increase the execution time hideously as it logs all those errors). Strip all the cartel layer related code and that ought to help.

It will help considerably if you have access to the webserver logs to see what errors are actually being generated.

The two dynaverse server database creation queries are attached for comparison to aid in your conversion.
« Last Edit: August 27, 2006, 08:58:20 am by Bonk »

Offline S31-Riptide

  • Lt. Junior Grade
  • *
  • Posts: 142
  • Gender: Male
    • Chaotic Network & SFC3.net
Re: Webmap For SFC3 Need SFC2 Minds for help!!!
« Reply #3 on: August 27, 2006, 09:11:22 am »
Thanks Bonk... you are the undisputed Ubber Dynaverse Man!!!

Offline Chris Jones

  • MOD PRODUCER
  • Lt.
  • *
  • Posts: 541
  • Gender: Male
  • Galaxy Class - as seen in DS9
    • Chris Jones Gaming
Re: Webmap For SFC3 Need SFC2 Minds for help!!!
« Reply #4 on: September 06, 2006, 11:50:35 pm »
Riptide =

Did you get this to work in any form yet?

I'm thinking of setting up a D3 for my Mega Mod..
..Because the game does not have to, and will not, remain the same..


Celebrating Life!
Favorite TNG: Yesterday's Enterprise

Offline S31-Riptide

  • Lt. Junior Grade
  • *
  • Posts: 142
  • Gender: Male
    • Chaotic Network & SFC3.net
Re: Webmap For SFC3 Need SFC2 Minds for help!!!
« Reply #5 on: September 07, 2006, 01:21:01 am »
Chris, I've gotten the MySQL portion working but, mysql is just as unstable in sfc3 as sfc2 if not a bit more... we've been doing some testing with it..  I'm still trying to track down the version someone has done already for SFC3 for the flatfile.  I'm struggling with the flatfile conversion. >:(

Offline S31-Riptide

  • Lt. Junior Grade
  • *
  • Posts: 142
  • Gender: Male
    • Chaotic Network & SFC3.net
Re: Webmap For SFC3 Need SFC2 Minds for help!!!
« Reply #6 on: September 07, 2006, 08:37:45 pm »
This is what I have so far for MySQL....   www.gameserver.sfc3.net/wm/

Offline S31-Chuck

  • Section 31 CO
  • Lt. Junior Grade
  • *
  • Posts: 10
    • S31-IKS Forums
Re: Webmap For SFC3 Need SFC2 Minds for help!!!
« Reply #7 on: September 08, 2006, 09:13:06 am »
So far it seems stable and running well... I love the MySQL and real time updates in the viewer.