L* R*
HOME FORUM DOWNLOADS
Content
  Links
     Browse SVN
     SVN Commit log
     Documentation (Wiki)
  Developers
     Taskmanager
User
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2008, 12:07:41 PM

Login with username, password and session length
Search



Advanced search
Support GoPHP5.org
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Modules for older versions > 0.2.x Custom/Unofficial Modules > Topic: Nano formulas module
Pages: 1 [2] 3   Go Down
« previous next »
Print
Author Topic: Nano formulas module  (Read 3739 times)
0 Members and 1 Guest are viewing this topic.
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Nano formulas module
« Reply #15 on: March 22, 2007, 09:28:05 PM »

Wolfbiter, put in your code, and this is what I get:
Code:
!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'

Code:
!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... Smiley 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. Smiley What the hell does it do?
« Last Edit: March 22, 2007, 09:35:49 PM by pusikas » Logged

Luuv  Bot-Keeper of Vengeance ^^*
Wolfbiter
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 141



WWW
Re: Nano formulas module
« Reply #16 on: March 22, 2007, 09:46:02 PM »

¤ 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.
Logged

220 Doctor | 220 Adventurer | 220 Shade
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Nano formulas module
« Reply #17 on: March 22, 2007, 11:46:08 PM »

yep, I commented out the two variables after the block you posted. So they are not reset to false after the block has run.
Logged

Luuv  Bot-Keeper of Vengeance ^^*
Wolfbiter
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 141



WWW
Re: Nano formulas module
« Reply #18 on: March 23, 2007, 02:02:31 AM »

Code:
$intput = preg_replace('¤".+"¤',"",$input);
Spot the typo...
Logged

220 Doctor | 220 Adventurer | 220 Shade
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Nano formulas module
« Reply #19 on: March 23, 2007, 09:24:41 AM »

Oh dear, that's PHP for you. Sometimes I miss good old Pascal, where you had to declare variables in a seperate block. Cheesy Will try it out right away when I get home from work.
Logged

Luuv  Bot-Keeper of Vengeance ^^*
Vhab
BeBot Contributor
Experienced
*******
Offline Offline

Posts: 158


WWW
Re: Nano formulas module
« Reply #20 on: March 24, 2007, 02:08:58 AM »

that's scary. i've lost count on many times i typoed input as intput. typo stealer!
Logged
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Nano formulas module
« Reply #21 on: March 24, 2007, 05:01:18 AM »

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.

Code:
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:

Code:
                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...
Logged

Luuv  Bot-Keeper of Vengeance ^^*
Wolfbiter
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 141



WWW
Re: Nano formulas module
« Reply #22 on: March 24, 2007, 05:06:24 AM »

Echo the query somewhere and check what it is (best way to spot errors).
Logged

220 Doctor | 220 Adventurer | 220 Shade
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Nano formulas module
« Reply #23 on: March 24, 2007, 10:25:09 AM »

This is what I got:

Code:
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:

Code:
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:

Code:
$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.
« Last Edit: March 24, 2007, 10:59:14 AM by pusikas » Logged

Luuv  Bot-Keeper of Vengeance ^^*
Wolfbiter
BeBot Contributor
Apprentice
*******
Offline Offline

Posts: 141



WWW
Re: Nano formulas module
« Reply #24 on: March 24, 2007, 11:44:01 AM »

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 Wink

But what happends if you do !nano soldier "empowered partial reflective field"?
Logged

220 Doctor | 220 Adventurer | 220 Shade
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Nano formulas module
« Reply #25 on: March 24, 2007, 11:54:25 AM »

weeee... that works. nice nice!  Cheesy
Logged

Luuv  Bot-Keeper of Vengeance ^^*
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: Nano formulas module
« Reply #26 on: March 25, 2007, 06:05:12 PM »

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).
« Last Edit: March 25, 2007, 06:06:52 PM by jjones666 » Logged
pusikas
Experienced
****
Offline Offline

Posts: 161


Re: Nano formulas module
« Reply #27 on: March 26, 2007, 03:31:09 AM »

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. Smiley

But... you current code references a table called items.nanos, not just nanos. That will cause problems for many peeps. Sad
« Last Edit: March 26, 2007, 03:35:18 AM by pusikas » Logged

Luuv  Bot-Keeper of Vengeance ^^*
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: Nano formulas module
« Reply #28 on: March 26, 2007, 05:15:44 AM »

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-
Logged
jjones666
BeBot Contributor
Champion
*******
Offline Offline

Posts: 353


Re: Nano formulas module
« Reply #29 on: March 26, 2007, 12:26:20 PM »

Ok, fixed the .PHP, if you downloaded before now, please re-download.

-jj-
Logged
Pages: 1 [2] 3   Go Up
Print
BeBot - An Anarchy Online/Age Of Conan chat automaton > Forum > Modules > Modules for older versions > 0.2.x Custom/Unofficial Modules > Topic: Nano formulas module
« previous next »
 
Jump to:  

Recent
Change text in remember "...
by gerborg
[November 21, 2008, 05:14:57 PM]

Log playtime from buddys ...
by Temar
[November 20, 2008, 10:33:57 AM]

Vote Core module and Simp...
by Temar
[November 19, 2008, 09:26:52 AM]

Restrict access for one m...
by Organizer
[November 19, 2008, 03:21:19 AM]

Custom / Revised Modules ...
by Elesar1
[November 17, 2008, 03:51:46 PM]

TWC
by Temar
[November 16, 2008, 11:39:12 AM]

Are there any FUN modules...
by Elesar1
[November 15, 2008, 07:39:15 PM]

Call to a member function...
by exxie
[November 15, 2008, 09:29:31 AM]

Ported Modules
by Alreadythere
[November 14, 2008, 06:10:07 PM]

cURL and other non-defaul...
by Temar
[November 14, 2008, 04:11:44 PM]
Stats
Members
Total Members: 1235
Latest: DDDepressionnn
Stats
Total Posts: 11037
Total Topics: 1496
Online Today: 18
Online Ever: 168
(July 01, 2007, 09:30:02 PM)
Users Online
Users: 4
Guests: 17
Total: 21
xlDanek
Temar
Stealth
gerborg

Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC
TinyPortal v0.9.8 © Bloc | NewDef design by Bloc
Page created in 0.353 seconds with 30 queries. (Pretty URLs adds 0.032s, 4q)
Loading...