matt.chugg
Moderator
I use the following to smash items in a cleanup script
(don't ask why I check if count > 0 AND whether count > numbertokeep, I really can't remember why I did that. There was a reason i'm sure of it, it just evades me for now!)
I've recently noticed if I run this in ronin (before pulling the hammer) that whilst my routine reports "Smashing Failed" mafia still believes that smashing was ok and deducts the relevant quantity of the relevant item from its local version of my inventory.
Please note: this isn't a bug report. I'm fully aware that I could fix this by checking for the hammer before calling my smash_stuff() routine, or possibly checking if the skill is available (although if the skill is permed but a hammer isn't present will the skill still be available?) but I seem to remember that mafia handled this differently in the past, before I changed the routine to use the new craft page. I could be wrong about that though, which having thunk about it would make this post somewhat redundant.
Code:
void smash(item itemtosmash, int numbertokeep) {
if (item_amount(itemtosmash) != 0){
if (item_amount(itemtosmash) > numbertokeep) {
print("Smashing " + itemtosmash+ " (" + (item_amount(itemtosmash) - numbertokeep) + ") (Keeping " + numbertokeep + ")");
int quant = item_amount(itemtosmash) - numbertokeep;
string pret = visit_url("craft.php?action=pulverize&pwd=&qty=" + quant + "&smashitem=" + item_to_int(itemtosmash));
if (contains_text(pret, "You smash")) {
print("Smashing OK");
} else {
print("Smashing Failed");
}
}
}
}
(don't ask why I check if count > 0 AND whether count > numbertokeep, I really can't remember why I did that. There was a reason i'm sure of it, it just evades me for now!)
I've recently noticed if I run this in ronin (before pulling the hammer) that whilst my routine reports "Smashing Failed" mafia still believes that smashing was ok and deducts the relevant quantity of the relevant item from its local version of my inventory.
Please note: this isn't a bug report. I'm fully aware that I could fix this by checking for the hammer before calling my smash_stuff() routine, or possibly checking if the skill is available (although if the skill is permed but a hammer isn't present will the skill still be available?) but I seem to remember that mafia handled this differently in the past, before I changed the routine to use the new craft page. I could be wrong about that though, which having thunk about it would make this post somewhat redundant.