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

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

Author Topic: Nano formulas module  (Read 44492 times)

0 Members and 3 Guests are viewing this topic.

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: Nano formulas module
« Reply #15 on: March 23, 2007, 03:28:05 am »
Wolfbiter, put in your code, and this is what I get:
Code: [Select]
!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: [Select]
!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?
« Last Edit: March 23, 2007, 03:35:49 am by pusikas »
Luuv  Bot-Keeper of Vengeance ^^*

Offline Wolfbiter

  • Contributor
  • *******
  • Posts: 149
  • Karma: +0/-0
    • KAZE
Re: Nano formulas module
« Reply #16 on: March 23, 2007, 03:46:02 am »
¤ 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.
Too many toons.

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: Nano formulas module
« Reply #17 on: March 23, 2007, 05:46:08 am »
yep, I commented out the two variables after the block you posted. So they are not reset to false after the block has run.
Luuv  Bot-Keeper of Vengeance ^^*

Offline Wolfbiter

  • Contributor
  • *******
  • Posts: 149
  • Karma: +0/-0
    • KAZE
Re: Nano formulas module
« Reply #18 on: March 23, 2007, 08:02:31 am »
Code: [Select]
$intput = preg_replace('¤".+"¤',"",$input);
Spot the typo...
Too many toons.

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: Nano formulas module
« Reply #19 on: March 23, 2007, 03:24:41 pm »
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.
Luuv  Bot-Keeper of Vengeance ^^*

Offline Vhab

  • Contributor
  • *******
  • Posts: 180
  • Karma: +0/-0
    • VhaBot Forum
Re: Nano formulas module
« Reply #20 on: March 24, 2007, 08:08:58 am »
that's scary. i've lost count on many times i typoed input as intput. typo stealer!

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: Nano formulas module
« Reply #21 on: March 24, 2007, 11: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: [Select]
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: [Select]
                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...
Luuv  Bot-Keeper of Vengeance ^^*

Offline Wolfbiter

  • Contributor
  • *******
  • Posts: 149
  • Karma: +0/-0
    • KAZE
Re: Nano formulas module
« Reply #22 on: March 24, 2007, 11:06:24 am »
Echo the query somewhere and check what it is (best way to spot errors).
Too many toons.

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: Nano formulas module
« Reply #23 on: March 24, 2007, 04:25:09 pm »
This is what I got:

Code: [Select]
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: [Select]
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: [Select]
$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, 04:59:14 pm by pusikas »
Luuv  Bot-Keeper of Vengeance ^^*

Offline Wolfbiter

  • Contributor
  • *******
  • Posts: 149
  • Karma: +0/-0
    • KAZE
Re: Nano formulas module
« Reply #24 on: March 24, 2007, 05:44:01 pm »
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"?
Too many toons.

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: Nano formulas module
« Reply #25 on: March 24, 2007, 05:54:25 pm »
weeee... that works. nice nice!  :D
Luuv  Bot-Keeper of Vengeance ^^*

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Nano formulas module
« Reply #26 on: March 26, 2007, 01:05:12 am »
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 26, 2007, 01:06:52 am by jjones666 »

Offline pusikas

  • BeBot Apprentice
  • ***
  • Posts: 161
  • Karma: +0/-0
Re: Nano formulas module
« Reply #27 on: March 26, 2007, 10: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. :)

But... you current code references a table called items.nanos, not just nanos. That will cause problems for many peeps. :(
« Last Edit: March 26, 2007, 10:35:18 am by pusikas »
Luuv  Bot-Keeper of Vengeance ^^*

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Nano formulas module
« Reply #28 on: March 26, 2007, 12:15:44 pm »
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-

Offline jjones666

  • Contributor
  • *******
  • Posts: 353
  • Karma: +0/-0
Re: Nano formulas module
« Reply #29 on: March 26, 2007, 07:26:20 pm »
Ok, fixed the .PHP, if you downloaded before now, please re-download.

-jj-

 

* Recent Posts
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 ]


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

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