tyilo
Member
Code:
boolean discard(int number, item stuff)
{
int amount = item_amount(stuff);
for counter from 1 upto number
{
visit_url("inventory.php?action=discard&pwd=" + my_hash() + "&whichitem=" + to_int(stuff));
}
if(amount == 0)
{
print("You don't have any " + to_plural(stuff) + ".", "red");
return false;
}
if(amount - number == item_amount(stuff))
{
print("Discarded " + number + " " + to_plural(stuff) + " successfully.", "green");
return true;
}
else
{
print("Could only discard " + (amount - item_amount(stuff)) + " out of " + number + ".", "red");
return false;
}
}
boolean discard(item stuff)
{
return discard(item_amount(stuff), stuff);
}
boolean discard(int amount, item it)
or
boolean discard(item it)
the last one discarding all items of that type
Last edited: