Hi Bruce,
I am creating facts like so:
^createfact(^owner ^location (^base_type ^other_type ^amount))
and I want to change the ^amount value afterwards.
Ordinarily I would delete the fact of a fact and create a new one. But I can’t figure out how to query the (^base_type ^other_type ^amount) fact and have it return itself so I can delete it.
This is what I have so far:
outputmacro: ^change_inv_item(^owner ^location ^base_type ^other_type ^amount)
[
@1 = ^query(direct_sv ^owner ^location)
if (@1)
{
loop()
{
@2 = @1
_1 = ^last(@1all)
if (^fact( _3 subject) == ^base_type and ^fact( _3 verb) == ^other_type)
{
^delete(@2) # Deletes the entire fact set under ^owner ^location, which is not what I want
}
}
}
]