BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => BeBot 0.5 support => Topic started by: Karsta on November 08, 2008, 04:35:09 am
-
Kbot [GROUP] [MSG] [Northern Star] Karstasbiatc: !symb int control eye
Warning: implode(): Invalid arguments passed in /home/karstas/kbot541/core/Professions.php on line 198
and symb module arent giving info what PB drops those symbs
and still got same PB problem as in
http://bebot.link/bebot-0-5-support/!pb-command/ (http://bebot.link/bebot-0-5-support/!pb-command/)
Kbot [GROUP] [MSG] [Northern Star] Karstasbiatc: !pb oak
string(3) "Imk"
Kbot [GROUP] [MSG] [Northern Star] Kbot: [link]Remains of Imk[/link]
Kbot [GROUP] [MSG] [Northern Star] Karstasbiatc: !pb zoetic
string(3) "Bia"
Kbot [GROUP] [MSG] [Northern Star] Kbot: [link]Remains of Bia[/link]
Karsta
-
Well I found the problem but I'm not quite sure how to fix it.
The function best_match uses a function called levenshtein() that computes the number of characters that need to be replaced, added, or deleted for the search string to match one of the pocket boss names.
levenshtein() is currently set up to use equal weights for replacing, adding, or removing characters. The reason you're seeing "Imk" when you search for "oak" is because the cost to replace "o" and "a" is less than the cost of adding "Zoetic".
The weights can be changed so one operation is favored over another but the result isn't always what's expected.
For example, if you replace
levenshtein($search, $straw[0])
with
levenshtein($search, $straw[0], 1, 20, 30)
Then insertions (1) are strongly favored over replacing (20) and deletion (30).
I have a hard time predicting the output of the levenshtein function so I am not willing to spend a great amount of time making the function work in a predictable manner.
I'll check back when I have some time and look into replacing the function with something I consider to be more predictable if someone else hasn't fixed the issue.
-
yer we need to add a search before the current that will check for names containing wat u put 1st, if more than 1 do 2nd search on those only, if none so 2nd search on all
which im going to do NOW
-
The PB module Search is now Fixed in SVN
-
the Symb Implode Error is now Fixed
-
and symb module arent giving info what PB drops those symbs
Fast fix:
- Search for $readable_output .= "$link\n"; (should be line 263) in /modules/AO/Symbiants.php
- Add under it:
$rPB = mysql_fetch_Array(mysql_query("SELECT boss_id FROM symbiants WHERE itemref='".$symb['itemref']."'"));
$namePB = mysql_fetch_Array(mysql_query("SELECT name FROM pocketbosses WHERE ID='".$rPB['boss_id']."'"));
$linkPB = "- <a href='chatcmd:///tell ".$this -> bot -> botname." <pre>pb ".$namePB[0]."'>".$namePB[0]."</a>";
$readable_output .= "$linkPB\n";
- Restart bot.