What do you consider to be the bug?
1) Is the bug in your program where you attempted to lock an item that is not lockable?
2) Is the bug in your program where you did not capture the return value of lock_familiar_equipment()? That function returns true on success and false - with an error - on failure. As in any function which throws an error, you can keep it from stopping your program by capturing the value.
3) Is the bug that lock_familiar_equipment is not checking if the familiar equipment is lockable before issuing a request to KoL?
All three, probably. I can add a check to lock_familiar_equipment for whether the equipment is lockable, but if it is not, that continues to be a bug in the calling program, and it will still still generate an ERROR.
Perhaps either your program or ASH itself could provide a
boolean is_familiar_equipment_lockable( item it )
function - although that is simply a call to boolean_modifier.
Code:
boolean is_familiar_equipment_lockable( item it )
{
return boolean_modifier( it, "Generic" );
}
boolean is_familiar_equipment_lockable()
{
return is_familiar_equipment_lockable( equipped_item( $slot[ familiar ] ) );
}
foreach it in $items[ lead necklace, tiny bindle, antique shield ] {
print( "A " + it + " is " + ( is_familiar_equipment_lockable( it ) ? "" : " not " ) + "lockable." );
}
yields
Code:
[color=green]> feql.ash[/color]
A lead necklace is lockable.
A tiny bindle is not lockable.
A antique shield is not lockable