There is a syntax error in your Lua code.
crista.0.shop_mushroom_done_dialog_finished is not a valid expression, you cannot index a table (crista) with 0 like this.
Also, the function you declare is not local, it is in a table because there are dots in the name.
You can do a local function like this:
local function shop_mushroom_done_dialog_finished()
game:set_value("i3001", game:get_value("i3001")+1)
hero:start_treasure("trading", 2)
end
if destination == main_entrance_shop and game:get_value("i2021") == 10 then
game:start_dialog("crista.0.shop_mushroom.7", shop_mushroom_done_dialog_finished)
end
But there is even a simpler way if the function is only used there:
if destination == main_entrance_shop and game:get_value("i2021") == 10 then
game:start_dialog("crista.0.shop_mushroom.7", function()
game:set_value("i3001", game:get_value("i3001")+1)
hero:start_treasure("trading", 2)
end)
end
Note: I removed the quotes around main_entrance, because since Solarus 1.0, the destination is a real entity type, not a string with the destination name.