I have tried to fix this code many times but it ends up not working. Please look over this code and help me adjust it as needed. Thanks!
while True do
local enemy = hero:findNearestEnemy()
local item = hero:findNearestItem()
if not (enemy.type is "peon") then end
hero:attack(enemy)
if not (item.type is "poison") then end
hero:move(item.pos)
Please give more information about what is happening when you run your code, if it is informing you about any errors, and etc. A screenshot would help…