L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 21, 2008, 08:26:16 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Modules for older versions > 0.2.x Custom/Unofficial Modules > Topic: Another Modified TowerAttack
Pages: 1 [2]   Go Down
« previous next »
Print
Author Topic: Another Modified TowerAttack  (Read 2350 times)
0 Members and 1 Guest are viewing this topic.
Xenixa
BeBot Contributor
Expert
*******
Offline Offline

Posts: 307



Re: Another Modified TowerAttack
« Reply #15 on: January 03, 2007, 08:56:57 PM »

Quote from: Mephistobane on June 26, 2006, 12:27:56 PM
so,will Xenixa's work with having JUST installed the whois cache(meaning it hasn't had time to put anything into the cache yet)?

and the link to the AOchat.php thing is broke, i would have liked to have looked at that thread Cheesy

anyways, it says meh bot crashs whenever it does a member lookup (Towerattack.php line 305) cuz member_lookup() is a non-object,or soemthing. sorry i dont have anything to paste atm, i clicked and the bot log disappeared. i'm thinking this is because there's nothing in the cache yet so i turned towerattack.php off a while until it does.

if anyone has comments they are welcome.

Yes, in a nut shell if you have a just installed the whois cache module anytime a tower attack happens this module calls on that whois module which in turn looks for the name of attacker in the local DB, if it doesn't find it it pulls from FC server. Once it has that info it cache's it and sends it back to the TowerAttack module which originally requested it.

And since there still seems to be a problem with my FTP server(which is running but for some reason not accessable) I'll attach my latest version(knock off the .txt to use).

Note: You still need the Whoiscache and LCA(with supporting SQL file) modules for this version to work.
Also note as I mentioned a ways back I also worked out a new solution to a Anti-Battle spam filter.

Enjoy. Smiley
Logged

<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Another Modified TowerAttack
« Reply #16 on: January 04, 2007, 05:36:46 AM »

Works with my 2.10 bot, I love it. Smiley Thanks for posting as attachment.
Logged

Luuv  Bot-Keeper of Vengeance ^^*
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Another Modified TowerAttack
« Reply #17 on: March 27, 2007, 11:33:35 AM »

Added settings to control where the module puts itw output. Requires Glarawyn's Settings module, me thinks. Careful, default is not to output at all.
Logged

Luuv  Bot-Keeper of Vengeance ^^*
shadowballs
Freshman
*
Offline Offline

Posts: 6


Re: Another Modified TowerAttack
« Reply #18 on: March 27, 2007, 05:28:43 PM »

first off, after some tweaking I just love BeBot. Smiley

I run it in my guild chat, and as some people in my guild are more or less heavily into PvP a functioning !battle command is a must, and youre detailed commands would suit us perfect. Ive sucsessfully installed whoiscache and LCA which both works (more or less, whoiscache spams alot of notices during updates)

well, Ive downloaded the updated Towerattack.php file and when someone tries the !battle I get a >>clicky<< in our chat but when I open it up its empty and if I check the bot's logs this shows up every time someone does a !battle command

Code:
Warning: Invalid argument supplied for foreach() in C:\Program Files (x86)\BeBot_v0.2.11\modules\TowerAttack.php on line 148

Im no php whizz so what could be wrong here?
Logged
Blueeagle
Omnipotent
BeBot Developer
Expert
********
Offline Offline

Gender: Male
Posts: 313



Re: Another Modified TowerAttack
« Reply #19 on: March 27, 2007, 07:44:42 PM »

The "Invalid argument supplied for foreach()" warning occures when you attempt to run a foreach-loop on a value that is not an array.

This frequently occures when you neglect to error check if the result returned from $this -> bot -> db -> select() is infact an array and not ie. false.

The code causing the warning here is probably
Code:
    function battle_blob($pf)
    {
if ($pf != null) {
        $result = $this -> bot -> db -> select("SELECT time, off_guild, off_side, off_player, off_level, off_profession,
        def_guild, def_side, zone, x_coord, y_coord FROM tower_attack WHERE zone LIKE '%$pf%' ORDER BY time DESC LIMIT 0, 20");
        }
        else {
        $result = $this -> bot -> db -> select('SELECT time, off_guild, off_side, off_player, off_level, off_profession,
        def_guild, def_side, zone, x_coord, y_coord FROM tower_attack ORDER BY time DESC LIMIT 0, 20');
        }
        if (!empty($pf)){
$battle = "<center><font color=CCInfoHeadline>:::: <u>Recent Tower Battles for ".$pf."</u> ::::</font></center>\n\n".'<font color=CCInfoText>';
        }
        else {
        $battle = "<center><font color=CCInfoHeadline>:::: <u>All Recent Tower Battles</u> ::::</font></center>\n\n".'<font color=CCInfoText>';
        }
        foreach ($result as $res) {

Where the warning is generated by the last line. However that line is not the actual reason for the warning to be generated.

The reason is that the one of the above two calls to $this -> bot -> db -> select() that is actually called does not return any results.

This would be because there are no battles registered in the database. This should have been handled with a graceful exit, but such is omitted here. A graceful exit would look something like:

Code:
    function battle_blob($pf)
    {
if ($pf != null) {
        $result = $this -> bot -> db -> select("SELECT time, off_guild, off_side, off_player, off_level, off_profession,
        def_guild, def_side, zone, x_coord, y_coord FROM tower_attack WHERE zone LIKE '%$pf%' ORDER BY time DESC LIMIT 0, 20");
        }
        else {
        $result = $this -> bot -> db -> select('SELECT time, off_guild, off_side, off_player, off_level, off_profession,
        def_guild, def_side, zone, x_coord, y_coord FROM tower_attack ORDER BY time DESC LIMIT 0, 20');
        }
        if (empty($result))
        {
                return("No battles found");
        }
        if (!empty($pf)){
$battle = "<center><font color=CCInfoHeadline>:::: <u>Recent Tower Battles for ".$pf."</u> ::::</font></center>\n\n".'<font color=CCInfoText>';
        }
        else {
        $battle = "<center><font color=CCInfoHeadline>:::: <u>All Recent Tower Battles</u> ::::</font></center>\n\n".'<font color=CCInfoText>';
        }
        foreach ($result as $res) {

Keep in mind that I have note checked the code nor looked closely if it will work or not. It is just an example.

Now, this still isn't the source of the problem which is that no battles has been entered into your battle table. Now if you've upgraded the TowerAttack module you also need to upgrade the table holding the data, or at the very least delete it.

I am suspecting that your log also contains warnings about MYSQL not being able to insert data into the tower_attack table as it is in the wrong format.

You can attempt to fix this by deleting the tower_attack table in your mysql database. To do this open the mysql command prompt and use the database that BeBot uses (refer to your conf/MySQL.conf file if you're uncertain about the details).

There you run the commands:
Code:
DROP TABLE tower_attack;
DROP TABLE tower_result;

When you re-start BeBot it should re-create the two tables in the right format. Now you just need to wait until someone kills some towers.

Also note that your bot needs to be in the top three ranks of your org to recieve the ALL TOWERS channel needed to populate the tower_attack table.

Hope that helps.
Logged

The only problem that can't be solved by adding another wrapper is having too many wrappers.
shadowballs
Freshman
*
Offline Offline

Posts: 6


Re: Another Modified TowerAttack
« Reply #20 on: March 27, 2007, 08:21:11 PM »

hmm..  okay.  I allready had the tables but they where empty so I guess it was only my impatience that had any errors  Roll Eyes
I guess Ill just have to be patient and wait until someone actually attacks some towers before I complain any more Tongue

Anyhows, thanks for you're help
Logged
Blueeagle
Omnipotent
BeBot Developer
Expert
********
Offline Offline

Gender: Male
Posts: 313



Re: Another Modified TowerAttack
« Reply #21 on: March 27, 2007, 10:15:22 PM »

Yeah, an empty table will also cause that warning. That's where the graceful exit comes into play. Smiley

edit: Typo
Logged

The only problem that can't be solved by adding another wrapper is having too many wrappers.
Pages: 1 [2]   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Modules for older versions > 0.2.x Custom/Unofficial Modules > Topic: Another Modified TowerAttack
« previous next »
 
Jump to:  

Recent
Change text in remember "...
by gerborg
[Today at 05:14:57 PM]

Log playtime from buddys ...
by Temar
[November 20, 2008, 10:33:57 AM]

Vote Core module and Simp...
by Temar
[November 19, 2008, 09:26:52 AM]

Restrict access for one m...
by Organizer
[November 19, 2008, 03:21:19 AM]

Custom / Revised Modules ...
by Elesar1
[November 17, 2008, 03:51:46 PM]

TWC
by Temar
[November 16, 2008, 11:39:12 AM]

Are there any FUN modules...
by Elesar1
[November 15, 2008, 07:39:15 PM]

Call to a member function...
by exxie
[November 15, 2008, 09:29:31 AM]

Ported Modules
by Alreadythere
[November 14, 2008, 06:10:07 PM]

cURL and other non-defaul...
by Temar
[November 14, 2008, 04:11:44 PM]
Stats
Members
Total Members: 1235
Latest: DDDepressionnn
Stats
Total Posts: 11037
Total Topics: 1496
Online Today: 16
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 1
Guests: 9
Total: 10
upstart

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.25 seconds with 29 queries. (Pretty URLs adds 0.029s, 4q)
Loading...