Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Maintenance & Feedback » Site and Forum Rules, Questions & Feedback

MiniGIP

Sonyk

JCF Member

Joined: Feb 2005

Posts: 2,409

Sonyk is doing well so far

Mar 17, 2005, 02:53 AM
Sonyk is offline
Reply With Quote
MiniGIP

Out of curiousity, would we be allowed to use the MiniGIP script that's on the front page of J2O? I've noticed it's not available anywhere on the website, and I wouldn't want to take it without permission.

Last edited by Sonyk; Mar 17, 2005 at 03:45 PM.
Link

Untitled

Joined: Apr 2001

Posts: 2,099

Link is doing well so far

Mar 17, 2005, 07:17 PM
Link is offline
Reply With Quote
If you want to use it on your site, that's fine, as long as you give credit to J2O. Internet Explorer displays it slightly incorrectly (gives it a border and does not transfer cell background colour). You could also use the image mini-GIP that seems to work now and appears correctly in all browsers.

Exempli gratia:

__________________
With our extreme gelatinous apology,
We beg to inform your Imperial Majesty,
Unto whom be dominion and power and glory,
There still remains that strange precipitate
Which has the quality to resist
Our oldest and most trusted catalyst.
It is a substance we cannot cremate
By temperatures known to our Laboratory.

~ E.J. Pratt
 
Sonyk

JCF Member

Joined: Feb 2005

Posts: 2,409

Sonyk is doing well so far

Mar 18, 2005, 03:06 AM
Sonyk is offline
Reply With Quote
Yes, I'm aware of the problem with embedded pages in IE, but my site looks better in Firebox regardless, so I urge users to view it in that. And that image version looks rather spiffy, if I do say so myself.
Also, would you prefer I have the script myself, instead of linking to the one on J2O?I would assume so...

Last edited by Sonyk; Mar 18, 2005 at 03:46 AM.
blurredd

JCF Member

Joined: Nov 2001

Posts: 1,896

blurredd is an asset to this forumblurredd is an asset to this forum

Mar 18, 2005, 09:30 AM
blurredd is offline
Reply With Quote
I don't think it would hurt to use .gif images instead of .png, but then again, I don't know what it would look like with the change.
__________________
D3
Extra. No CTO v0.75
Animating Tiles Properties.
ATB Contest. Scripting Language.
Gameplay Theories.
1UP. Pitfall. Desolation.
SC2.

Link

Untitled

Joined: Apr 2001

Posts: 2,099

Link is doing well so far

Mar 18, 2005, 10:29 AM
Link is offline
Reply With Quote
Here's the script for the one currently used on J2O. If you want to display the MOTD from the list server, uncomment the relevant portions, but this may be impractical as the MOTD is sometimes quite big. You'll also need to make a script to create a .j2i file (or link to the one on J2O) if you want to be able to join games from this. And finally you'll need to get the images (or create your own) and change the script to output the correct locations. They are in http://www.jazz2online.com/J2Ov2/panels/gip_stuff/.

If you link to the script with textColor, linkColor, and hoverColor in the query string (without a '#' preceding), they will be used instead of the default colours.

The preg_match function should all be on one line, with a single space between (.*?) and the final (.*).

If you want to completely customize the script, you can just take the portion up to (but not including) where it says "echo <<<END". At this point, all the server information is in the array $valid_servers, and you can loop through and display it how you want.

PHP Code:
<?php

/* Mini Games in Progress Script for Jazz Jackrabbit 2
   Copyright (c) 2004 Jazz2Online (http://www.jazz2online.com)

   You are free to use and modify this script, but you must
   keep the above copyright notice in place.
*/

$servers[0] = 'uk.jazzjackrabbit.net';
//$servers[1] = 'us.jazzjackrabbit.net';

if (!$textColor$textColor "000000";
if (!
$linkColor$linkColor "000000";
if (!
$hoverColor$hoverColor "B62700";

$num 0;

WHILE (
$servers[$num]) {
    
$sLink = @fsockopen($servers[$num], 10057, &$errorNum, &$errorString3);
    if (!
$sLink) {
        
$svrDown[$num] = $errorNum ': ' $errorString;
        
$svrError TRUE;
    } else {
        
$sRawData "";
        WHILE (!
feof($sLink)) {
            
$sRawData .= fgets($sLink,1024);
        }
        
fclose($sLink);
        
$svrError FALSE;
        
        
// Get MOTD
        /*$mLink = @fsockopen($servers[$num], 10058);
        if ($mLink) {
            while (!feof($mLink)) $motd .= fgets($mLink,256);
            $servername = $servers[$num];
        }*/
        
        
break;
    }
    
$num++;
}


$sData explode("\n",$sRawData);

FOR (
$num 0$num count($sData) - 1$num++) {
    
    
// $server    1    2     3              4                5    6           7     8     9
    
preg_match('/(.*):(\d*) (local|mirror) (private|public) (.*) (1\..{0,4}) (\d*) (.*?) (.*)/',$sData[$num],$server);
    
    
$valid_servers[$num]['ip'] = $server[1];
    
$valid_servers[$num]['port'] = $server[2];
    
$valid_servers[$num]['list'] = $server[3];
    
$valid_servers[$num]['access'] = $server[4];
    
$valid_servers[$num]['type'] = $server[5];
    
$valid_servers[$num]['version'] = $server[6];
    
$valid_servers[$num]['uptime'] = $server[7];
    
$valid_servers[$num]['capacity'] = $server[8];
    
$valid_servers[$num]['name'] = str_replace('|','',trim($server[9]));

}

echo <<<END

<html>
<head>
<title>Games in Progress</title>
<style type="text/css">
ul    { margin: 0; padding: 0; }
li    { list-style-type: none; padding-left: 0; line-height: 1; }
span    { font-family: Arial; }
.s    { font-size: 11px; font-weight: bold; }
.i    { font-size: 9px; color: #
$textColor; }
.m    { font-size: 10px; font-style: italic; }
body    { margin: 4px; }
a    { text-decoration: none; color: #
$linkColor; }
a:hover    { color: #
$hoverColor; }
img    { border: 0; }
</style>
</head>

<body>
<ul>

END;

if (
$svrError == TRUE) {
    echo 
"<li><span>Error connecting to list servers.  Errors listed below.</span></li>";
    foreach (
$svrDown as $errorText) echo "<li><span>$errorText</span></li>";
} elseif (
$num == 0) {
    echo 
"<li><span>No servers currently listed.</span></li>";
} else {

    foreach (
$valid_servers as $Server) {
        echo 
"<li>";
        switch (
$Server[type]) {
            case 
'battle':
                
$img "gip_battle.png";
                break;
            case 
'capture':
                
$img "gip_ctf.png";
                break;
            case 
'treasure':
                
$img "gip_treasure.png";
                break;
            default:
                
$img "gip_question.png";
        }
        
        
$encodedIP base64_encode($Server[ip].":".$Server[port]);
        
        if (
$Server[access] != "private") echo "<a href=\"gip_stuff/join.php?ip=$encodedIP\">";
        
        echo 
"<img src=\"gip_stuff/$img\" />&nbsp;";
        
        if (
$Server[access] == "private"$Server[name] .= " (P)";
        
        echo 
"<span class=\"s\">$Server[name]</span>";
        
        if (
$Server[access] != "private") echo "</a>";
        
        echo 
"";
        
        
$uptime round($Server[uptime] / 60);
        
        echo 
"<span class=\"i\">&nbsp;$Server[version] :: $Server[capacity] :: ".$uptime."min</span>";
        
        echo 
"</li>";
    }
    
    
/* if ($motd) {
        echo "<li></li>";
        echo "<li><span class=\"m\" title=\"Message of the Day at $servername\">";
        echo nl2br($motd);
        echo "</span></li>";
    } */
    
    
echo "</ul>";
    echo 
"</body>";
    echo 
"</html>";
            
}
            
?>
__________________
With our extreme gelatinous apology,
We beg to inform your Imperial Majesty,
Unto whom be dominion and power and glory,
There still remains that strange precipitate
Which has the quality to resist
Our oldest and most trusted catalyst.
It is a substance we cannot cremate
By temperatures known to our Laboratory.

~ E.J. Pratt
 
Sonyk

JCF Member

Joined: Feb 2005

Posts: 2,409

Sonyk is doing well so far

Mar 18, 2005, 02:46 PM
Sonyk is offline
Reply With Quote
Ah, thank you. But, according to what you said, I am allowed to link to the ones on J2O?
Either way, it's nice to have the source, so I can change it if I ever find the need to.
Sonyk

JCF Member

Joined: Feb 2005

Posts: 2,409

Sonyk is doing well so far

Mar 19, 2005, 04:43 PM
Sonyk is offline
Reply With Quote
Um... Just a question... I can tell the miniGIP times out a lot, but that's due to the PHP.ini's setting for maximum script execution, right?

Anyway, I've got it on my website, and it fit nicely. Thank you.
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT -8. The time now is 11:09 PM.