BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => BeBot 0.2 support => Topic started by: Malosar on April 25, 2006, 06:46:23 pm

Title: make_item problem
Post by: Malosar on April 25, 2006, 06:46:23 pm
I'mj trying to make a blob with item links using the bots make_item function. It seems to make it correctly in the blob however the link doesn't work, it doesn't switch to the item when it's clicked. This is the part of my code where I lookup the item value and make the item:

Code: [Select]
$idata = $this -> bot -> db -> select("SELECT lowid, highid, highql, name FROM items WHERE name LIKE '%$phats[0]%' ORDER BY highql DESC");
$item = $this -> bot -> make_item($idata[0][0],$idata[0][1],$idata[0][2],$idata[0][3]);
$res .= "$item\n";

The $res part is what im including in the blob I make at the end of the function. Any ideas what im doing wrong? I've tested the actual data from the $idata array and it has the correct values it's sending to make_item.
Title: Re: make_item problem
Post by: Alreadythere on April 25, 2006, 07:12:34 pm
You have to replace " with ' for item refs in blobs (or the other way around, just check what make_item is producing).
Title: Re: make_item problem
Post by: Malosar on April 25, 2006, 07:56:38 pm
Thanks, that worked easy enough.
Title: Re: make_item problem
Post by: Malosar on April 25, 2006, 09:50:55 pm
Any idea why I would get a "Cannot use string offset as an array" error only when I try to search for a specific name? Works for all other names I have in the db, however when I try to bring up a list of items for the beast it causes that error. The error occurs on this line:

$item = $this -> bot -> make_item($idata[0][0],$idata[0][1],$idata[0][2],$idata[0][3]);
Title: Re: make_item problem
Post by: Xenixa on April 25, 2006, 10:13:44 pm
Because in you can't offset the first key in a string array. heheh

use this:
Code: [Select]
$item = $this -> bot -> make_item($idata[0],$idata[0][1],$idata[0][2],$idata[0][3]);
In other words, bad mojo on string array's to try to reference key
Code: [Select]
[0] as [0][0]
Title: Re: make_item problem
Post by: Malosar on April 25, 2006, 10:44:23 pm
Well I still get the same error with that change.

edit: nvm, worked out it was a few spelling mistakes in the list of items for the beast which caused the fault. The key would be null. Might have to put some error trapping in.
SimplePortal 2.3.7 © 2008-2025, SimplePortal