Like topic says. I have sth like that
local npc = findcreature('Pompan') if npc.dist > 3 then reachcreature(npc)
waitping() end
npctalk('hi', 'trade') waitping()
local currentamount = itemcount('power bolt') if not $tradeopen then opentrade() end
amount = maxpb-currentamount
while amount > 0 --[[and (tradecount('buy',itemname) >= amount or tradecount('buy',itemname) == 100)--]]
do buyitems('power bolt', amount) waitping(3,4)
moveitems('power bolt', pbbp) waitping(3,4)
amount = amount-100 end if itemcount('power bolt') < maxpb then gotolabel('pbbuy')
end additemcounter('power bolt', maxpb-100)

but doesn't work. How to make it work? Thanks for answers.