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: Persistent Whois Cache buggy  (Read 4272 times)

0 Members and 1 Guest are viewing this topic.

Offline Mephistobane

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Persistent Whois Cache buggy
« on: June 24, 2006, 10:59:19 pm »
Reference: http://bebot.link/index.php/topic,223.0.html

ok,so,i've been working on this for a few days,and i've exhausted everything i can think of,so i'm asking for help. im trying to do it myself but i just started a couple weeks ago,i can't learn a language that quickly, so plz bear with me.
    First,i did my best to follow the instructions and read the thread. it worked for others,should work for me,right? well,it didn't.
    so i started with a working bot,version 0.2.5. i downloaded the 2 .php files and the 3rd conf file. i added the variable $var whois into the bottom of the class list in bot.php,like it said. i don't know how to code,so this next part gave me some trouble...

"- To use the the cache you need to modify all get_site() calls done to get user information. Just repace the get_site() with $this -> [bot ->] lookup($username), and modify the result handling. The return value of the lookup() function has speaking names, so it shouldn't be hard."

i have truly no idea where to edit this. *sigh* everything i do seems to make things worse.

"- the WhoisCache.php still has the calls to the get_tablename() function I use to get more then one bot into a single database. If you aren't using that, either replace the calls with direct links to the tablenames, or add the following code to your Bot.php in the Bot class (yes, sloppy programming, I haven't gotten around to move that into a module myself yet)."

ill be using one bot, one Dbase... do i need to do anything here?

from here...it SHOULD run..right? well everytime i could get the bot to run past these errors,i got the problem that there's no MySQL table "whois" in my database. so i would make one manually,all is well and good...until i start it up and this:

"Fatal error: Call to undefined method Bot::define_tablename() in C:\Documents
d Settings\Andrew\My Documents\BeBot_v0.2.5\modules\WhoisCache.php on line 12"

what's wrong with it now?

*sigh* learning a language in a few weeks is tough


Offline lonillen

  • BeBot Rookie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #1 on: June 25, 2006, 10:43:22 am »
can you post the line that's giving you the error? i can't find define_tablename() call in stock WhoisCache.php. There is however bot->get_tablename("whois") call on that line you might have modified... The error you receive means you're calling a function that does not exist.

If you added get_tablename() function to bot.php as Alreadythere written you shouldn't run into much trouble.

Quote
"- To use the the cache you need to modify all get_site() calls done to get user information. Just repace the get_site() with $this -> [bot ->] lookup($username), and modify the result handling. The return value of the lookup() function has speaking names, so it shouldn't be hard."

Try reading second post by Alreadythere in that thread, might give you some pointers.  ;)

Basicly you need to replace
Code: [Select]
$content = $this -> bot -> get_site("http://www.anarchy-online.com/character/bio/d/" . $this -> bot -> dimension . "/name/" . strtolower($name) . "/bio.xml");
$who["nick"] = $this -> bot -> xmlparse($content, "nick");
$who["firstname"] = $this -> bot -> xmlparse($content, "firstname");
$who["lastname"] = $this -> bot -> xmlparse($content, "lastname");
$who["level"] = $this -> bot -> xmlparse($content, "level");
$who["gender"] = $this -> bot -> xmlparse($content, "gender");
$who["breed"] = $this -> bot -> xmlparse($content, "breed");
$who["profession"] = $this -> bot -> xmlparse($content, "profession");
$who["faction"] = $this -> bot -> xmlparse($content, "faction");
$who["rank"] = $this -> bot -> xmlparse($content, "rank");
$who["org"] = $this -> bot -> xmlparse($content, "organization_name");
$who["at_name"] = $this -> bot -> xmlparse($content, "defender_rank");
$who["at"] = $this -> bot -> xmlparse($content, "defender_rank_id");
with
Code: [Select]
      $who = $this -> bot -> whois -> lookup($name);
in Whois.php and in any other module that does char parsing

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #2 on: June 25, 2006, 01:10:46 pm »
I think you need to add this line somewhere at the bottom of bot.php:

function get_tablename($table)
{
return $table;
}

to get round the table name error :)

-jj-

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #3 on: June 25, 2006, 03:17:25 pm »
i have truly no idea where to edit this. *sigh* everything i do seems to make things worse.
Check the files for get_site calls to the FC server for character information. You have to adapt the calls to use the whois function of the cache, it does any needed http lookups.

"- the WhoisCache.php still has the calls to the get_tablename() function I use to get more then one bot into a single database. If you aren't using that, either replace the calls with direct links to the tablenames, or add the following code to your Bot.php in the Bot class (yes, sloppy programming, I haven't gotten around to move that into a module myself yet)."

ill be using one bot, one Dbase... do i need to do anything here?
Yes, you do. Just add the emtpy function into bot.php, should solve the get_tablename problem.

from here...it SHOULD run..right? well everytime i could get the bot to run past these errors,i got the problem that there's no MySQL table "whois" in my database. so i would make one manually,all is well and good...until i start it up and this:

"Fatal error: Call to undefined method Bot::define_tablename() in C:\Documents
d Settings\Andrew\My Documents\BeBot_v0.2.5\modules\WhoisCache.php on line 12"
what's wrong with it now?
Oh, sorry. Think I uploaded a newer version of the cache, which uses define_tablename() too.
Just add the following to your Bot.php, similar to get_tablename()
Code: [Select]
function define_tablename($table, $pre, $suf)
{
  return $table;
}

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #4 on: June 25, 2006, 04:15:51 pm »
A... ,

Is there a later version than the one posted in page one of this topic (for people not using the current SVN version)?

Cheers,

-jj-

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #5 on: June 25, 2006, 05:57:53 pm »
Is there a later version than the one posted in page one of this topic (for people not using the current SVN version)?
All my versions use get_tablename()/define_tablename()/get_setting().

But:
You can just take out all get_tablename()/define_tablename() calls. Modify a line like
Code: [Select]
$this -> bot -> db -> select("SELECT * FROM " . $this -> bot -> get_tablename("whois") . " WHERE x=y" to
Code: [Select]
$this -> bot -> db -> select("SELECT * FROM whois WHERE x=y"
And remove the line
Code: [Select]
$db -> query("INSERT IGNORE INTO " . $bot -> get_tablename("settings") . " (setting, value) VALUES ('whois_cache_persist_time', '26')");, and replace
Code: [Select]
if (!(empty($lookup)) && $lookup[0][14] >= time() - $this -> bot -> get_setting("whois_cache_persist_time") * 3600) with
Code: [Select]
if (!(empty($lookup)) && $lookup[0][14] >= time() - 86400)
It should work then with most versions of bebot.

Offline Mephistobane

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #6 on: June 25, 2006, 11:51:42 pm »
ok so i made the changes acording to what lonillen,jj666,and alreadythere said..

had to make a few small adjustments but it works fine now i think :)

one small thing is weird though... Tfsbot doesnt show tower msgs in guildchat.. and he's a general,so he should see them. in fact,he is..

[2006-06-25 19:45:05]   [GROUP] [MSG]   [All Towers] 0: ~&!!!&r!5b/RR!!!8S!!!!!s
The Final StandIamgimpR!!!8S!!!!"s?3305 Locals?Athen Shirei!!!6=i!!!6=~

[2006-06-25 20:07:42]   [GROUP] [MSG]   [Tower Battle Outcome] 0: Notum Wars Upd
ate: Victory to the Neutrals!!!
[2006-06-25 20:07:42]   [GROUP] [MSG]   [Tower Battle Outcome] 0: The Neutral or
ganization The Final Stand attacked the Clan 3305 Local at their base in Athen S
hire. The attackers won!!

does this have something to do with the whois cache? (btw, does it work with !relay both on and off?)

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #7 on: June 25, 2006, 11:58:18 pm »
Regarding tower attacks, try this page (Xenixa's module takes advantage of the whois cache).

http://bebot.link/index.php/topic,243.0.html

PM me if you need any more help.

Cheers,

-jj-

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #8 on: June 26, 2006, 09:23:05 am »
does this have something to do with the whois cache?
No, that seems like wrong parsing of the new message format.

(btw, does it work with !relay both on and off?)
Tower alerts work both with and without relay.

Offline Mephistobane

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #9 on: June 26, 2006, 10:21:10 pm »
http://www.rafb.net/paste/results/h7P27381.html


followed all the instructions..im at a loss for words. but it runs though, however glitchily. whois cache is still empty,towerattack mod still turned off until the cache fills.

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #10 on: June 26, 2006, 11:44:55 pm »
Not 100% sure what you got in your files, but some things I noticed right away:

I designed the whoiscache to be a core module, that means it should be in the core/ and not the module/ directory. Shouldn't have any serious influence though, is more due to dependancies on the cache.

More important though: Move the update-script out of the module directory, in some script directory. It is no bebot module, but an independant script.

And I don't know where the following lines come from, they look like a bad try to query a master table for tablenames, like my fully working functions should do.
Code: [Select]
MySQL error (# 3) on query: SELECT * FROM  WHERE internal_name = 'whois'
 
MySQL error (# 4) on query: SELECT * FROM  WHERE internal_name = 'prefix'
 
MySQL error (# 5) on query: SELECT * FROM  WHERE internal_name = 'suffix'
 
MySQL error (# 6) on query: INSERT INTO  (internal_name, table_name, use_prefix,
 use_suffix) VALUES ('whois', 'whois', 'true', 'false')

Offline Mephistobane

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #11 on: June 27, 2006, 12:44:05 am »
well i went over it and over it and over it.

here's my Bot.php
[edit] it was getting errors becuase i had 2 get_table functions,one with return $table and one with a bunch of xml parsing etc.

and my bot as it starts up: clicky
the relay_guild module hasnt been updated to use the cache yet,but i will when there's a cache to use. :P.same goes for towerattack module(i have that _ turned off)[/edit]

there's nothing in the cache yet, that's why it's getting errors right? *hopes*
« Last Edit: June 27, 2006, 12:48:58 am by Mephistobane »

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #12 on: June 27, 2006, 09:33:44 am »
there's nothing in the cache yet, that's why it's getting errors right? *hopes*
Hm, guess some mysql versions or setups are more strict considering right type for fields on INSERTs/UPDATEs. That's why you get an error, it doesn't like an empty rank_id somehow.

I updated the whoiscache.phps with a simple check for empty string, please try that version - it should work this time.

Offline Mephistobane

  • BeBot User
  • **
  • Posts: 21
  • Karma: +0/-0
Re: Persistent Whois Cache buggy
« Reply #13 on: July 01, 2006, 08:44:36 am »
it works :) thanks all

 

* 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: 135
  • 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