Bug - Not A Bug untinker tries to create the item first if you do not already have it

taltamir

Member
If you try to untinker an item you do not have via cli command "untinker name" then it tries to create the item first before untinkering it

Here is the gCLI output
Code:
> test.ash

counting batteries
[battery (AAA)] amount = 6
[battery (AA)] amount = 2
[battery (D)] amount = 0
[battery (9-Volt)] amount = 1
[battery (lantern)] amount = 0
[battery (car)] amount = 0

Verifying ingredients for battery (D) (1)...
Creating 1 meat paste...
You acquire an item: meat paste
You lose 10 Meat
Successfully created meat paste (1)
Creating battery (D) (1)...
You acquire an item: battery (D)
Successfully created battery (D) (1)
Untinkering battery (D)...
untinker 1 battery (D)
You acquire an item: battery (AAA)
You acquire an item: battery (AA)
Successfully untinkered battery (D)

Here is the code of the test function
Code:
void countBat()
{
    print("counting batteries");
    foreach it in $items[battery (AAA), battery (AA), battery (D), battery (9-Volt), battery (lantern), battery (car)]
    {
        print("[" +it+ "] amount = " +available_amount(it));
    }
    print("");
}

countBat();
cli_execute("untinker battery (D)");
 

Rinn

Developer
I looked at the mafia code and there's an explicit call to retrieve the item first, so it seems like that was intended? I'm not sure, this code is ancient and I'd be concerned touching it
 

taltamir

Member
I looked at the mafia code and there's an explicit call to retrieve the item first, so it seems like that was intended? I'm not sure, this code is ancient and I'd be concerned touching it
I would guess this was for the days where abridged dictionary was untinkered into bridge.
so it was hardcoded to always retrive the item first before untinkering it to save having to first buy it?

in that case instead of changing the CLI command behavior, how about making an ash command for untinkering that can be called from scripts and does not automatically retrieve the target first?
 

Veracity

Developer
Staff member
Seems like it is behaving as intended.
If you specifically told KoLmafia to untinker something, the first thing it needs to do is make sure it is inventory.
If you don't actually have a way to do that without creating it from items you CAN retrieve, it does creates it and the item is now in inventory.

Short answer: if you don't actually have the item. your script can choose to not try to untinker it.
KoLmafia is behaving as intended.
Fix your script to not be stupid.
 
Top