sea.cgi

sea.cgiの簡単な説明。
間違っていたらすみません。


require 'jcode.pl';
require 'setting.cgi';        # セッティングファイル
require 'sys.cgi';

requireはファイルの読み込みと考えてください。



# 設定ここまで

# ###################################################################
&error("ユーザーディレクトリ名を変更して下さい[setting.cgi]") if $usrdir eq 'userdir';
&decode;
if ($F{'id'} =~ /\W/) { &error('不正な入力です') }
if (!$F{'mode'})      { require 'rank.cgi'; &start_view }
else                  {
                if    (($F{'mode'} eq 'trade_sell') || ($F{'mode'} eq 'trade_buy')) { require 'trade.cgi' }
                elsif ($F{'mode'} eq 'move') { require 'move.cgi' }
                elsif (($F{'mode'} eq 'bar_trade') || ($F{'mode'} eq 'adven')) { require 'bar.cgi' }
                elsif (($F{'mode'} eq 'rep_ship') || ($F{'mode'} eq 'buy_ship') || ($F{'mode'} eq 'sell_ship')) { require 'yard.cgi' }   
                elsif ($F{'mode'} eq 'battle') { require 'battle.cgi' }
                elsif ($F{'mode'} =~ /city/) { require 'city.cgi' }
                elsif ($F{'mode'} =~ /ctrade/) { require 'ctrade.cgi' }
                elsif ($F{'mode'} =~ /cadmin/) { require 'cadmin.cgi' }
                elsif ($F{'mode'} eq 'cbattle_atk')    { require 'cbattle.cgi' }
    &{$F{'mode'}}   }
exit;
# ###################################################################

ここでは例えばtrade_sellの場合、交易の売却を選択した場合、trade.cgiを読み込むという処理をしています。
交易に新しい処理、例えば交易品の発明を追加した場合、選択判定を追加しないと処理されませんので注意してください。


# Sub Ships #
sub ships {
    if ( $#ship_ind < 0 && $money < 2000 ) {
        print qq|<form method=$method action=$seacgi>船を失い、<br>資金も底をつきました。<br>一から出直しますか?<br>\n|;
        print qq|<input type=hidden name=mode value="restart">\n|;
        &id_ps;
        &submit_button;
        print qq|</form>\n|;
        return
    }
    for ($i=0; $i <= 16; $i++){
        if(!$ship[$i][0]){ $ship[$i][0] = $damgif; }
    }
print <<SHIP_TABLE;
<table border=0 cellspacing=0 cellpadding=0 background="$img/$seaimg" cols=5>
<tr>
<td height=40 width=40 align=center valign=center><br></td>
<td height=40 width=40 align=center valign=center><br></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[11][0]" alt="$ship[11][4](HP$ship[11][2])"></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[15][0]" alt="$ship[15][4](HP$ship[15][2])"></td>
<td height=40 width=40 align=center valign=center><br></td>
</tr>
<tr>
<td height=40 width=40 align=center valign=center><br></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[9][0]" alt="$ship[9][4](HP$ship[9][2])"></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[3][0]" alt="$ship[3][4](HP$ship[3][2])"></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[7][0]" alt="$ship[7][4](HP$ship[7][2])"></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[13][0]" alt="$ship[13][4](HP$ship[13][2])"></td>
</tr>
<tr>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[6][0]" alt="$ship[6][4](HP$ship[6][2])"></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[2][0]" alt="$ship[2][4](HP$ship[2][2])"></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[0][0]" alt="$ship[0][4](HP$ship[0][2])"></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[1][0]" alt="$ship[1][4](HP$ship[1][2])"></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[5][0]" alt="$ship[5][4](HP$ship[5][2])"></td>
</tr>
<tr>
<td height=40 width=40 align=center valign=center><br></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[10][0]" alt="$ship[10][4](HP$ship[10][2])"></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[4][0]" alt="$ship[4][4](HP$ship[4][2])"></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[8][0]" alt="$ship[8][4](HP$ship[8][2])"></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[14][0]" alt="$ship[14][4](HP$ship[14][2])"></td>
</tr>
<tr>
<td height=40 width=40 align=center valign=center><br></td>
<td height=40 width=40 align=center valign=center><br></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[12][0]" alt="$ship[12][4](HP$ship[12][2])"></td>
<td height=40 width=40 align=center valign=center><img src="$img/$ship[16][0]" alt="$ship[16][4](HP$ship[16][2])"></td>
<td height=40 width=40 align=center valign=center><br></td>
</tr>
</table>
SHIP_TABLE
}

再出発の処理とプレー画面の船の表示設定です。
$img/$ship[11][0]" alt="$ship[11][4](HP$ship[11][2])
は12番目の船の0番目のデータ(画像名)で画像を表示し、12番目の船の5番目のデータ(船の名前)と3番目のデータ(HP)を表示しています。
ここを弄る事で他のデータも表示が可能です。例えば2番目のデータ(積載)を表示等

最終更新:2010年09月20日 20:03
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。