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

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

Author Topic: Items lookup modules  (Read 3607 times)

0 Members and 1 Guest are viewing this topic.

Offline xxxKarynxxx

  • BeBot Rookie
  • *
  • Posts: 3
  • Karma: +0/-0
Items lookup modules
« on: April 24, 2006, 01:36:55 pm »
I wonder if anyone could help me please.
I recently downloaded BeBot after using IGNbot for sometime.
What struck me immediately about BeBot is that the items lookup function is very fast due to the database being held locally.
However, with my IGNbot I used to use a php file that would communicate with http://central.vhabot.net and I had the option of specifying it would return the results with lovely icons next to the items.
I'm not very good with php, in fact I have never touched it before in my life, but it seems that IGNbot and BeBot use very different procedures.

I was wondering basically if it is at all possible to make an items function for BeBot that gets info from the local database but displays it as lovely as Vhab's one with all the icons?

Any help would be very much appreciated  ;D

Thanks in advance.

Offline Vhab

  • Contributor
  • *******
  • Posts: 180
  • Karma: +0/-0
    • VhaBot Forum
Re: Items lookup modules
« Reply #1 on: April 24, 2006, 01:51:59 pm »
The database that ships with bebot doesn't hold icon ID's so it's not possible without getting a new database.
Also would say the database the central uses isn't exactly suitable for local use.
You could always use the central database with bebot :P (Don't think there's a plugin out there yet, but I could slap one together once I get home if you want)
I do recall someone created a database including icons for bebot once, but it's probebly outdated by now. Try searching trough old posts a bit.

Offline xxxKarynxxx

  • BeBot Rookie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Items lookup modules
« Reply #2 on: April 24, 2006, 02:10:53 pm »
Aww that would be awfully sweet of you if you did Vhab. I am trawling through old posts as we speak as I would much prefer that it got the information from my database here, but I haven't found anything yet, so if you could do that it would be awesome :)


Offline Vhab

  • Contributor
  • *******
  • Posts: 180
  • Karma: +0/-0
    • VhaBot Forum
Re: Items lookup modules
« Reply #3 on: April 24, 2006, 08:09:28 pm »
Didn't have the chance to test it, but I think this will work
Code: [Select]
<?
$VhItems = new VhItems($bot);

$commands["tell"]["items"] = &$VhItems;
$commands["pgmsg"]["items"] = &$VhItems;
$commands["gc"]["items"] = &$VhItems;

class VhItems
{
var $bot;
function VhItems (&$bot)
{
$this->bot = &$bot;
}
function tell($name, $msg)
{
$this->bot->send_tell($name, $this->process_command($name, $msg));
}
function pgmsg($name, $msg)
{
$this->bot->send_pgroup($this->process_command($name, $msg));
}

function gc($name, $msg)
{
$this->bot->send_gc($this->process_command($name, $msg));
}

function process_command($name, $msg)
{
if (preg_match('/^'.$this->bot->commpre.'items/i', $msg, $info)) {
$words = trim(substr($msg, strlen($this->bot->commpre.'items')));
if (!empty($words)) {
$parts = explode(' ', $words);
if (count($parts) > 1 && is_numeric($parts[0])) {
$ql = $parts[0];
unset($parts[0]);
$search = implode(' ', $parts);
} else {
$ql = 0;
$search = $words;
}
$result = file_get_contents('http://central.vhabot.net/data/items.php?bot=BeBot&search='.urlencode($search).'&ql='.$ql.'&output=rich2&max=50');
if (!empty($result))
return $result;
else
return "Unable to query database";
} else {
return "Usage: items [quality] [item]";
}
} else {
$this -> bot -> send_help($name);
}
}
}
?>
« Last Edit: April 24, 2006, 08:30:04 pm by Vhab »

Offline xxxKarynxxx

  • BeBot Rookie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: Items lookup modules
« Reply #4 on: April 24, 2006, 08:26:32 pm »
There was a bracket missing, but i fixed it.

You're an angel vhab, ty so much :)

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: Items lookup modules
« Reply #5 on: April 30, 2006, 11:39:29 am »
Also would say the database the central uses isn't exactly suitable for local use.
Why shouldn't it be suitable for local use? Tables too big?
Would you be willing to make an as-is dump of the table(s) available for use? If it's just the size, I could live with it.

Offline mookie

  • BeBot User
  • **
  • Posts: 27
  • Karma: +0/-0
Re: Items lookup modules
« Reply #6 on: April 30, 2006, 11:14:56 pm »
This is a great plugin. One thing we did notice there are some Items missing. For example we have tried !items (any value) albrech = (no results). But if you do !items albrech it shows 1 and 200.


Thanks !!

 

 

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


0.8.x updates for AoC by bitnykk
[January 30, 2024, 11:16:08 pm]


0.8.x updates for AO by bitnykk
[January 30, 2024, 11:15:37 pm]


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


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm]

* Who's Online
  • Dot Guests: 713
  • 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