BeBot - An Anarchy Online and Age Of Conan chat automaton
Archive => Anarchy Online Archive => 0.2.x Custom/Unofficial Modules => Topic started by: jjones666 on February 25, 2007, 01:49:27 am
-
One thing I saw from the !guides module was that having the nano formula locations in the bot was bloody handy. As we had a great codebase for searching database with Wolfbiter's !symb module, I spent the last few weeks taking a look at the in game nanos.
Information was taken from a variety of places, I checked all of the SL gardens myself - from what I remember RK nanos info mostly came from Jexai's, SL quest info from AO-Universe. As I mentioned 99.9% of the coding is Wolfbiter's original module.
- added all SL garden nanos.
- added all RK store nanos.
- added all RK mission nanos.
- added all RK dynaboss nanos.
- added all RK unique mob nanos.
- added all general type nanos.
- added SL static dungeon nanos.
- added SL quest nanos.
- added SL nanos which drop from random mobs.
- added SL jobe zone nanos (keeper and shade only).
- added LE VP nanos.
- search limited to 200 nanos to prevent bot crashing.
Obviously, this will work in same manner as the !symb module. Requires Glara's new module settings module (you can turn the icon display on and off in !settings).
As most of the work is manually done, its possibly got a few bad entries, please let me know if you find any.
Theres a nice little menu if you just do !nano, you can also see most of the searchterms in there.
PHP (http://www.jjones.co.uk/files/nano.php)
SQL (http://www.jjones.co.uk/files/nano.zip)
Help (http://www.jjones.co.uk/files/nano.txt)
Cheers,
-jj-
EDIT: includes Wolfbiter's fix posted below.
EDIT: module tested with bebot 0.2.11.
EDIT: spelling error fixed, help added (thanks Pusikas).
EDIT: helpfile updated - SQL updated to 17.2 - added exact string search (thanks Wolfbiter).
EDIT: SQL updated to 17.3.
-
function make_chatcommand($link, $title)
{
return '<a href=\'chatcmd:///tell '.$this->bot->botname.' '.$this->bot->commpre.$link.'\'>' . $title . '</a>';
}
Will cause problem on bots with stupid (regexp) triggers.
use: function make_chatcommand($link, $title)
{
return '<a href=\'chatcmd:///tell '.$this->bot->botname.' <pre>'.$link.'\'>' . $title . '</a>';
}
-
tried it today and did a search w/ !nano adv
then i get spammed from bot and eventually had to restart bot to stop the spam
bot will respond w/ found 2xx result with (page 1 of 2) then next is (page 2 of 2) then next is (page 1 of 2)(page 2 of 2) and go on
thought i would point it out so u can look into it ;)
-
[Uprising] Jackjonez: !nano adv
[Uprising] Uprnet: 231 nano formulas found (displaying only 1-200) :: click to view (page 1 of 4)
[Uprising] Uprnet: 231 nano formulas found (displaying only 1-200) :: click to view (page 2 of 4)
[Uprising] Uprnet: 231 nano formulas found (displaying only 1-200) :: click to view (page 3 of 4)
[Uprising] Uprnet: 231 nano formulas found (displaying only 1-200) :: click to view (page 4 of 4)
Can you confirm what version of bebot you run, this was fixed ages ago?
Cheers,
-jj-
-
Fix here:
http://bebot.link/index.php/topic,234.0
Would advise update to latest Bebot ASAP.
-jj-
-
As all mentioned problems were fixed, I added this to the A-Z.
Any comments on bad data yet or further problems with the plugin itself?
Cheers,
-jj-
p.s. tidied up the post somewhat also where problems had been fixed.
-
The help you get from !nano uses the word "nansense" under location. Is that supposed to mean "Nascence", or "Nonsense"? ;D
Edit: actually, the whole PHP file uses nansense... I, uhm... consider this a bug. ^^
Another Edit: wrong writing is in SQL as well
-
And since my org kept bugging me that there was a helpfile missing, I turned the output of !nano into a helpfile. Changed nansense into nascence, tho, so may not work with JJ's php until he fixes it. :)
-
Updated .php and .sql to fix spelling error, you will need to drop and reimport database. Added the help file to first post.
Thanks,
-jj-
-
How do I upload into SQL?
-
For SQL manipulation, use a program called SQLYog. It's free and fairly easy to use compared to most. You can edit existing data, create/modify tables, import/export data etc.
-
When I do something like
!nano Empowered Partial Reflective Field
to see in what garden it is sold, I get 2 pages of hits, all nanos listed containing at least one of the four words in their name. Would it be possible to change the module to look for an exact hit when I put the searchstring into quotes? So that
!nano "Empowered Partial Reflective Field"
returns only one hit? Or maybe something like
!nano exact Empowered Partial Reflective Field
Or maybe change the module so that the nanos are ordered by the number of "hits", meaning words that match in their name. Although I guess that would be harder to code than the two above suggestions.
I have tried to change that myself, but without much success yet. Gotta admit that I have trouble understanding some parts of the code. ???
-
Yeah the advantage to the current system is that you can use as many search terms as you like, ie. !nano soldier 100-125 slquest or whatever. So in the first case you're doing four seperate searches hence large amount of hits. The code is Wolfbiter's baby, and offhand, I can't think if this change is possible. Normally, I simply look by profession/QL for quickest results.
-jj-
-
I might look over my search methods after the weekend (if I feel like it or remember it) for something along the lines of "bla bla", I've had some other instances where this would have been usefull.
EDIT
Well.. sometimes I can't let go of an idea...
function nano($input)
{
$input = explode(" ",strtolower($input));
$type = false;
...
Replace that bit with
function nano($input)
{
$hftext = false;
$ftext = false;
preg_match_all('¤"([^"]+)"¤U',$input,$exact,PREG_SET_ORDER);
foreach ($exact as $loop) {
$ftext = ($ftext ? $ftext." or ":"")."name like '%".$loop[1]."%'";
$hftext = (!$hftext ? "'$loop[1]'" : $hftext.", '$loop[1]'");
}
$input = preg_replace('¤".+"¤',"",$input);
$input = preg_replace('|\s\s+|',' ',$input);
$input = explode(" ",strtolower($input));
$type = false;
...
//$ftext = false; <- if this isn't commented out the stuff in "" wont be searched for.
//$hftext = false; <- same here
I've not tested it with a real script, I'll leave that up to jj, but it *should* work.
EDIT2
Corrected a typo
-
Normally, I simply look by profession/QL for quickest results.
Thanks for mentioning this, it did not occur to me, and would help as well, ofc. Currently plyaing a new soldier. I use auno.org to dig up the nanos I want, but I do not trust the site to give me valid info on where to buy SL nanos. Hence my asking. Is not the first time this has come up, tho. Some peeps from org told me they'd like exact matches before. I just did not see why this would be good until I had the need myself. ;D
-
Wolfbiter, put in your code, and this is what I get:
!nano Empowered Partial Reflective Field
114 nano formulas found :: click to view (page 1 of 2)
114 nano formulas found :: click to view (page 2 of 2)
Header of the output shows this:
Matching name: 'empowered', 'partial', 'reflective', 'field'
!nano "Empowered Partial Reflective Field"
31 nano formulas found :: click to view
Header of the output shows this:
Matching name: 'Empowered Partial Reflective Field', '"empowered', 'partial', 'reflective', 'field"'
As you can see, it narrowed the search down, but not quite in the way expected... :) It finds fewer nanos, but only because it adds the quotes to empowered and to field.
I am not sure that copying your strange "¤"-symbol really works for me, tho. At least it looks kinda different when I paste it into putty. :) What the hell does it do?
-
¤ is just delimiter for regexp code (since I use | in the regexp). Did you // the $hftext, and $ftext lines? Did you add the preg_replace line? You can relace ¤ with | in the preg_replace stuff.
-
yep, I commented out the two variables after the block you posted. So they are not reset to false after the block has run.
-
$intput = preg_replace('¤".+"¤',"",$input);
Spot the typo...
-
Oh dear, that's PHP for you. Sometimes I miss good old Pascal, where you had to declare variables in a seperate block. :D Will try it out right away when I get home from work.
-
that's scary. i've lost count on many times i typoed input as intput. typo stealer!
-
Hmmm... still does not work for me. Now I do not get any hits, no matter what I set in quotes. Even if the name of the nano is only one word long.
To [bot]: !nano Empowered Partial Reflective Field
[bot]: 114 nano formulas found :: click to view (page 1 of 2)
[bot]: 114 nano formulas found :: click to view (page 2 of 2)
To [bot]: !nano "Empowered Partial Reflective Field"
[bot]: No matches found.
To [Vbot]: !nano "Extreme Prejudice"
[bot]: No matches found.
To [bot]: !nano "rapid weapon"
[bot]: No matches found.
To [bot]: !nano "Miniaturization"
[bot]: No matches found.
To [Vbot]: !nano "miniaturization"
[Vbot]: No matches found.
This is what my code looks like:
function nano($input)
{
$hftext = false;
$ftext = false;
preg_match_all('¤"([^"]+)"¤U',$input,$exact,PREG_SET_ORDER);
foreach ($exact as $loop) {
$ftext = ($ftext ? $ftext." or ":"")."name like '%".$loop[1]."%'";
$hftext = (!$hftext ? "'$loop[1]'" : $hftext.", '$loop[1]'");
}
$input = preg_replace('¤".+"¤',"",$input);
$input = preg_replace('|\s\s+|',' ',$input);
$input = explode(" ",strtolower($input));
$type = false;
$prof = false;
$ql = false;
// $ftext = false;
$hql = false;
// $hftext = false;
$location = false;
I can't spot any more obvious blunders...
-
Echo the query somewhere and check what it is (best way to spot errors).
-
This is what I got:
To [bot]: !nano "Empowered Partial Reflective Field"
[bot]: select * from nanos where (lowql=lowql) and (lowql=lowql) and (profession='adventurer') and (name like '%Empowered Partial Reflective Field%') ORDER BY lowql, profession
[bot]: select * from nanos where (lowql=lowql) and (lowql=lowql) and (profession='adventurer') and (name like '%Empowered Partial Reflective Field%') ORDER BY lowql, profession LIMIT 0, 200
[bot]: No matches found.
No idea where the adventurer stuff comes from... But it does not work for advy nanos, either, which kinda amazes me:
To [bot]: !nano "Improved Friend of the Wild"
[bot]: select * from nanos where (lowql=lowql) and (lowql=lowql) and (profession='adventurer') and (name like '%Improved Friend of the Wild%') ORDER BY lowql, profession
[bot]: select * from nanos where (lowql=lowql) and (lowql=lowql) and (profession='adventurer') and (name like '%Improved Friend of the Wild%') ORDER BY lowql, profession LIMIT 0, 200
[bot]: No matches found.
These are the original queries plus the tell-lines I added:
$count = $this->bot->db->select("select * from nanos where (".(!$ql ? "lowql=lowql" : $ql).") and (".(!$loc ? "lowql=lowql" : $loc).") and (".(!$type ? "lowql=lowql" : $type).") and (".(!$ftext ? "lowql=lowql" : $ftext).") ORDER BY lowql, profession");
$this->bot->send_tell("Luuv", "select * from nanos where (".(!$ql ? "lowql=lowql" : $ql).") and (".(!$loc ? "lowql=lowql" : $loc).") and (".(!$type ? "lowql=lowql" : $type).") and (".(!$ftext ? "lowql=lowql" : $ftext).") ORDER BY lowql, profession");
$qry = "select * from nanos where (".(!$ql ? "lowql=lowql" : $ql).") and (".(!$loc ? "lowql=lowql" : $loc).") and (".(!$type ? "lowql=lowql" : $type).") and (".(!$ftext ? "lowql=lowql" : $ftext).") ORDER BY lowql, profession LIMIT 0, 200";
$this->bot->send_tell("Luuv", $qry);
Edit: Just occured to me that he search for the advy nano can't work. The Nano Crystal does not have the word "improved" in it... !nano "Friend of the Wild" gives two matches, as it should. So, thanks, it works now, but only for advy nanos. ^^*
This is, btw, another downside of the way the module works. It looks for nano crystals, not for nanos. But the names of some of the nanos differ from that of their crystal. For example, the nano "Ranged Energy Weapon Mastery" comes from the crystal "Nano Crystal (LR Energy Weapon Mastery)". Not a real problem, the improved nanos are more of a prob.
-
Profession is part of the original script, same with searching for nano crystals.. this is jj's code, I just added the "" search stuff so I'll let him work out what's wrong with it adding adventurer ;)
But what happends if you do !nano soldier "empowered partial reflective field"?
-
weeee... that works. nice nice! :D
-
updated module:
- exact search string works now ie. !nano "guardian of might" (thanks Wolfbiter!).
- help file updated.
- code cleaned up somewhat.
- sql updated to include LE 17.2 nanos.
to-do:
- add nano name instead of item name (by the way, in the meantime static dungeon nanos are searchable).
-
Hey, and you removed the odd references to $symb in the code. I refrained from complaining about those, because I was complaining too much already. :)
But... you current code references a table called items.nanos, not just nanos. That will cause problems for many peeps. :(
-
ROFL, I always **** up the items.nanos (should be just nanos), again I shouldn't publish any module after midnight ;-p
I'll change it as soon as I get home from work.
And yeah, I did tidy the code up somewhat, with help from Wolfbiter, I'm surprised he didn't kick me on still having $symbs in there :-)
-jj-
-
Ok, fixed the .PHP, if you downloaded before now, please re-download.
-jj-
-
my quest for a great guild-bot continues and Ive noticed some problems with the !nano script. after Ive installed this script one of my guilder's typed !nano and dropped a ID into the chat, while the bot replied and showed a list with the nano that the ID would make I noticed later on that I got some warnings in the bot log.
[2007-03-28 12:31:55] [GROUP] [MSG] [Wanted] Laradvy: !nano [link]Instruction Disc (Chaotic Entropy)[/link]
Warning: preg_grep(): Compilation failed: missing ) at offset 8 in C:\Program Files (x86)\BeBot_v0.2.11\modules\Nano.php on line 158
Warning: preg_grep(): Compilation failed: missing ) at offset 8 in C:\Program Files (x86)\BeBot_v0.2.11\modules\Nano.php on line 164
Warning: preg_grep(): Unknown modifier 'a' in C:\Program Files (x86)\BeBot_v0.2.11\modules\Nano.php on line 158
Warning: preg_grep(): Unknown modifier 'a' in C:\Program Files (x86)\BeBot_v0.2.11\modules\Nano.php on line 164
[2007-03-28 12:31:56] [GROUP] [MSG] [Wanted] Wanbot: 6 nano formulas found :: [link]click to view[/link]
Ive tried that myself now with a ID for Complete Healing and the same thing happened again. from what I can tell, it looks like the search engine runs into troubles when the search contains an instruction disk.
Search 1.
Using a real Instruction Disc (Complete Healing) that I drop into the chat gives me a result list containing 6 nano's and the bot log spams the listed warnings above and the results window has the following header
Nanos
Matching name: 'itemref://147107/147107/169', '<a', 'href=>instruction', 'disc', '(complete', 'healing)'
Search 2.
Typing !nano Instruction Disc (Complete Healing) gives me a search result of 18 nano's, and these warnings
[2007-03-28 15:26:24] [GROUP] [MSG] [Wanted] Shadowballs: !nano Instruction Disc (Complete Healing)
Warning: preg_grep(): Compilation failed: missing ) at offset 9 in C:\Program Files (x86)\BeBot_v0.2.11\modules\Nano.php on line 158
Warning: preg_grep(): Compilation failed: missing ) at offset 9 in C:\Program Files (x86)\BeBot_v0.2.11\modules\Nano.php on line 164
Warning: preg_grep(): Compilation failed: unmatched parentheses at offset 7 in C:\Program Files (x86)\BeBot_v0.2.11\modules\Nano.php on line 158
Warning: preg_grep(): Compilation failed: unmatched parentheses at offset 7 in C:\Program Files (x86)\BeBot_v0.2.11\modules\Nano.php on line 164
Search 3.
Typing !nano Instruction Disc Complete Healing yields a search result of 27 nano's and no warnings.
to me it seems obvious that the search script cant handle parenthesis as search option so that might need fixing, but what I think would be a good option would be making the search script to search and list only the resulting nano when a ID is dropped into the search. With that function my guilders and anyone else using this script could just drop any ID's they might find into the search and immediately find out if the ID could be worth something or not without having to browse through a bunch of nano's that are partial hits.
-
Dropping an actual item into the search term will cause that. It's not designed to parse itemrefs, just text. The module's purpose is to advise where to obtain nanos, not for looking up what a nano does specifically. You can use !items for that. Or just type in "!nano com heal" etc
FYI, dropping an item will not send the text you see to the bot, it will send something like "itemref://12345/23443/100/Complete Healing/" etc. which is how we use other modules to parse items and find their id's and ql's.
-
Im aware of that, but what I thought might be a good idea is that if someone do drop an ID into the search the bot could reply with what nano the ID would would produce and whether it was a shop nano, mission loot/roll, dyna or other, just like the way the search lists nano searches.
So if some froob/noob is out hunting and finds the ID for Grid Armor MK I and have no clue whether he should sell it or not and no'one online in the guild that could answer he could use !nano on the ID and get a reply telling saying:
QL60 Nano Crystal (Summon Grid Armor Mk I)
- Location: RK Dyna - Profession: Fixer
and he would know with that reply that this disk had some significance if he had been told previously that dyna nano's where rare and could be worth alot of money while 'shop' nano's isn't something worth saving
Edit: typo..
-
Adding such a thing isn't a bad idea (I use the same idea for !pb and dropping patterns), but the first post was a "your script is broken" and not "I think you should add this".
Once you make a bad approach (criticize that it's broken when it isn't), people will have a negative first reaction to whatever you say after that (we're humans and lets face it... we suck ass).
-
Wolfbiter <3
... and yes, the reaction was extremely negative here too ;-)
-jj-
-
Updated nano SQL to 17.3.
There are some missing MP nanos, not in VP shop, so I left them out for the time being.
-jj-
-
hmm.. did you nerf shade nanos on purpose? :P
$this->proflist = Array("adventurer","agent","bureaucrat","doctor","enforcer","engineer","fixer","general","keeper","martial¤artist","meta¤physicist","nano¤technician","soldier","trader");
should be
$this->proflist = Array("adventurer","agent","bureaucrat","doctor","enforcer","engineer","fixer","general","keeper","martial¤artist","meta¤physicist","nano¤technician","shade","soldier","trader");
Cheers,
Tony
-
Updated PHP, thank you.
-jj-
-
One smallish detail caught my eye: Scheol seems to be consistently mistyped Schoel.
-
jjones download offline? Any alt site to grab updates?
-
Naming convention problem:
The nanos.sql file creates table nanos and the nanos.php script calls for items.nanos in the sql call. Changed the function to ("select * from nanosdb) and renamed the database table to nanodb. Everything works great after this small change.
-
Any plans to update the SQL with current data?
-
Fatal error: Call to a member function on a non-object in /home/ninpo/aobot-test/BeBot/core/nano.php on line 29
Version 0.4.1. I assumed the new modules settings module is in the latest version (can't find it here on the forums and jj didn't link it)...halp!
-
Well, ive got a similarly problem:
Fatal error: Cannot use object of type Settings_Core as array in D:\...\Nano.php on line 25
Maybe so can help me out ;)
version 0.4.1 (ive tried it several times, checked it but nothing)