collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Another Modified TowerAttack  (Read 18019 times)

0 Members and 1 Guest are viewing this topic.

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: Another Modified TowerAttack
« Reply #15 on: January 04, 2007, 02:56:57 am »
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 :D

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. :)
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: Another Modified TowerAttack
« Reply #16 on: January 04, 2007, 11:36:46 am »
Works with my 2.10 bot, I love it. :) Thanks for posting as attachment.
Luuv  Bot-Keeper of Vengeance ^^*

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: Another Modified TowerAttack
« Reply #17 on: March 27, 2007, 06:33:35 pm »
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.
Luuv  Bot-Keeper of Vengeance ^^*

Offline shadowballs

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Another Modified TowerAttack
« Reply #18 on: March 28, 2007, 12:28:43 am »
first off, after some tweaking I just love BeBot. :)

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: [Select]
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?

Offline Blueeagle

  • Omnipotent
  • BeBot Hero
  • ******
  • Posts: 323
  • Karma: +0/-0
Re: Another Modified TowerAttack
« Reply #19 on: March 28, 2007, 02:44:42 am »
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: [Select]
    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: [Select]
    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: [Select]
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.
The only problem that can't be solved by adding another wrapper is having too many wrappers.

Offline shadowballs

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Another Modified TowerAttack
« Reply #20 on: March 28, 2007, 03:21:11 am »
hmm..  okay.  I allready had the tables but they where empty so I guess it was only my impatience that had any errors  ::)
I guess Ill just have to be patient and wait until someone actually attacks some towers before I complain any more :P

Anyhows, thanks for you're help

Offline Blueeagle

  • Omnipotent
  • BeBot Hero
  • ******
  • Posts: 323
  • Karma: +0/-0
Re: Another Modified TowerAttack
« Reply #21 on: March 28, 2007, 05:15:22 am »
Yeah, an empty table will also cause that warning. That's where the graceful exit comes into play. :)

edit: Typo
The only problem that can't be solved by adding another wrapper is having too many wrappers.

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 297
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal