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

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

Author Topic: make_item problem  (Read 2112 times)

0 Members and 3 Guests are viewing this topic.

Offline Malosar

  • BeBot Expert
  • ****
  • Posts: 259
  • Karma: +0/-0
    • http://www.lowerdimension.com
make_item problem
« 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.
Eternalist
General of The Syndicate

Offline Alreadythere

  • BeBot Maintainer
  • BeBot Hero
  • ******
  • Posts: 1288
  • Karma: +0/-0
Re: make_item problem
« Reply #1 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).

Offline Malosar

  • BeBot Expert
  • ****
  • Posts: 259
  • Karma: +0/-0
    • http://www.lowerdimension.com
Re: make_item problem
« Reply #2 on: April 25, 2006, 07:56:38 pm »
Thanks, that worked easy enough.
Eternalist
General of The Syndicate

Offline Malosar

  • BeBot Expert
  • ****
  • Posts: 259
  • Karma: +0/-0
    • http://www.lowerdimension.com
Re: make_item problem
« Reply #3 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]);
« Last Edit: April 25, 2006, 09:53:29 pm by Malosar »
Eternalist
General of The Syndicate

Offline Xenixa

  • Contributor
  • *******
  • Posts: 307
  • Karma: +0/-0
Re: make_item problem
« Reply #4 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]
<<< Hack's in Zend Studio

All my Custom Bebot files may be Found Here <-clicky

Offline Malosar

  • BeBot Expert
  • ****
  • Posts: 259
  • Karma: +0/-0
    • http://www.lowerdimension.com
Re: make_item problem
« Reply #5 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.
« Last Edit: April 25, 2006, 11:21:54 pm by Malosar »
Eternalist
General of The Syndicate

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


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 ]

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