Archive > AO official modules
modified AlienAttack_GUILD
Khalem:
Whoops. Updated update with an update.
Been doing too much Ruby as of late and forgot curly braces.
Also made a small cosmetical fix.
Xenixa:
Heheh I was gunna post something about the curly braces.
Zend Studio tosses ya Syntax errors so when I paste stuff like that I just automatically add whats missing. *shrug*
Looks good though. Made quite a few org members happy that they no long have to watch the clock or look for the bot to say it can be switched.
Akarah:
yeah coming from primarily a perl background, i habitually use curly brackets in php even when it is apparently not necessary (like when an if (condition) only has one action) like:
--- Code: ---
if ($stuff) do_stuff();
--- End code ---
i'd write like this:
--- Code: ---
if ($stuff) { do_stuff(); }
--- End code ---
or even more likely:
--- Code: ---
if ($stuff)
{
do_stuff();
}
--- End code ---
hehe
Khalem:
Same actually Akarah, aside from i come from C, not Perl.
I favour overuse of brackets even on one line if's for the sake of readability (and less typing later if more needs to be added to the conditional check)
mookie:
Have a console error when using this patch. I am using the 1171 aochat, and the suggested modified Bot.php with PHP 4.41.
Here is the error in the console:
--- Code: ---
[2005-11-29 09:54:55] [TELL] [INC] Darkztrader: !city
Warning: Invalid argument supplied for foreach() in H:\bebot\modules\
_GUILD.php on line 100
Warning: date(): Windows does not support dates prior to midnight (00
nuary 1, 1970 in H:\bebot\modules\AlienAttack_GUILD.php on line 120
Warning: date(): Windows does not support dates prior to midnight (00
nuary 1, 1970 in H:\bebot\modules\AlienAttack_GUILD.php on line 121
--- End code ---
Here is the code for error in line 100
--- Code: ---
Line 95] function city_blob()
Line 96] {
Line 97] $city = "<font color=CCInfoHeadline>::::: Recent City activity :::::</font><font color=CCInfoText>\n\n";
Line 98]
Line 99] $result = $this -> bot -> db -> select("SELECT time, action, player FROM org_city ORDER BY time DESC LIMIT 0, 12");
Line 100] foreach ($result as $res)
Line 101] {
Line 102] $city .= "<font color=CCInfoHeader>Time:</font> <font color=CCCCHeaderColor>" . gmdate("M j, Y, G:i", $res[0]) . " GMT</font>\n";
--- End code ---
Here is the lines for 120 and 121:
--- Code: ---
Line 120] $avilmin = date("i",3600-(time()-$result[0][0]));
Line 121] $avilsec = date("s",3600-(time()-$result[0][0]));
--- End code ---
I checked placement of the { }'s and tried changing date variables. This error happens with tell, pg and Gc.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version