IF NOT storage.doorIds THEN storage.doorIds = { 5129, 5102, 5111, 5120, 1644, 1648, 1646, 6262} END LOCAL moveTime = 2000 -- Wait time between Move, 2000 milliseconds = 2 seconds LOCAL moveDist = 1 -- How far to Walk LOCAL useTime = 2000 -- Wait time between Use, 2000 milliseconds = 2 seconds LOCAL useDistance = 1 -- How far to Use LOCAL FUNCTION properTable(t) LOCAL r = {} FOR _, entry IN pairs(t) do TABLE.insert(r, entry.id) END RETURN r END UI.Label("Door IDs") LOCAL doorContainer = UI.Container(FUNCTION(widget, items) storage.doorIds = items doorId = properTable(storage.doorIds) END, TRUE) doorContainer:setHeight(35) doorContainer:setItems(storage.doorIds) doorId = properTable(storage.doorIds) clickDoor = macro(1000, "Use Doors", FUNCTION() FOR i, tile IN ipairs(g_map.getTiles(posz())) do LOCAL item = tile:getTopUseThing() IF item AND TABLE.find(doorId, item:getId()) THEN LOCAL tPos = tile:getPosition() LOCAL distance = getDistanceBetween(pos(), tPos) IF (distance <= useDistance) THEN USE(item) RETURN delay(useTime) END IF (distance <= moveDist AND distance > useDistance) THEN IF findPath(pos(), tPos, moveDist, { ignoreNonPathable = TRUE, PRECISION = 1 }) THEN autoWalk(tPos, moveTime, { ignoreNonPathable = TRUE, PRECISION = 1 }) RETURN delay(waitTime) END END END END END)