destroy_char_item only destroys equipped items?

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: destroy_char_item only destroys equipped items?
Warrior
Member # 4202
Profile Homepage #0
I wouldn't do this in a normal scenario, but here's my troublesome code. It's supposed to destroy all of the party's items, equipped or in their pack. It seems to only destroy equipped items.

i = 0;
while(i < 40) {
j = 0;
while(j < 4) {
if(char_ok(j))
destroy_char_item(j,i);
j = j + 1;
}
i = i + 1;
}


--------------------
Creator of the 3D Blades of Avernum Editor for Mac. Get it at Ingenious Isaac's Illusion, my web page. Better yet, get Battle for Wesnoth, a wonderful free TBS game.
Posts: 192 | Registered: Sunday, April 4 2004 08:00
Shock Trooper
Member # 4180
Profile #1
Total shot in the dark here, but could it be choking on empty slots? I'd try putting a check to make sure there's something in the slot in front of the destroy_char_item() call, to see if that helps. If not, it definitely seems like a bug in either the implementation or documentation of the call...

-spyderbytes

EDIT: Left out a word. :o

[ Saturday, April 10, 2004 11:21: Message edited by: spyderbytes ]

--------------------
-spyderbytes
Posts: 200 | Registered: Wednesday, March 31 2004 08:00
Warrior
Member # 4202
Profile Homepage #2
I tried putting in a check for that, but it still doesn't work:
i = 0;
while(i < 40) {
j = 0;
while(j < 4) {
if(char_ok(j))
if(item_type_in_slot(j,i) != -1)
destroy_char_item(j,i);
j = j + 1;
}
i = i + 1;
}


--------------------
Creator of the 3D Blades of Avernum Editor for Mac. Get it at Ingenious Isaac's Illusion, my web page. Better yet, get Battle for Wesnoth, a wonderful free TBS game.
Posts: 192 | Registered: Sunday, April 4 2004 08:00
Board Administrator
Member # 1
Profile Homepage #3
When you remove an item in a pack, all items above it shift down. So if you destroy item 18, say, item 19 shifts down into 18's spot.

- Jeff

--------------------
Official Board Admin
spidweb@spiderwebsoftware.com
Posts: 960 | Registered: Tuesday, September 18 2001 07:00
...b10010b...
Member # 869
Profile Homepage #4
Ah, of course. The first pack slot is #13, right? So all the script has to do is destroy all equipped items, then repeatedly check if there's an item in slot 13 and destroy it.

[ Monday, April 12, 2004 17:31: Message edited by: Thuryl ]

--------------------
The Empire Always Loses: This Time For Sure!
Posts: 9973 | Registered: Saturday, March 30 2002 08:00