The Dink Network

item_check

January 17th 2007, 02:32 PM
wizardb.gif
how do I check to see if dink has a particular item.
January 17th 2007, 03:21 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
From DinkC.chm (in the \develop subfolder of where you have Dink installed)

count_item
Category: Inventory, Script
Version: 1.00+
Prototype: int count_item(string script[9]);

count_item counts the number of items with the script script in the weapon/item inventory. Interestingly, the specified script need not actually exist: it only has to be the same as the corresponding add_item command's script-name argument.


For example:

void main( void )
{
int &nuts = count_item("item-nut");
if (&nuts == 0)
{
say_stop("I don't have any nuts!",1);
return;
}
say_stop("I have &nuts nuts!",1);
}
January 17th 2007, 03:59 PM
peasantmb.gif
Lunacre
Peasant He/Him Finland
 
Or if you want to check that if Dink has a specific item equiped, a sword for example, you can try this:

void main(void)

{
int &sword = compare_weapon("item-sw");
if (&sword == 1)
{
say_stop("I'm holding a sword in my hand!", 1);
return;
}

say_stop("I don't have my sword equiped.", 1);
}
January 18th 2007, 01:10 AM
wizardb.gif
thanks, I'll try it.