I built in a logging function for my Cyclops-Bot. It used to work perfectly, but recently it can't read inventory.Money correctly anymore and keeps telling me that I have 0 gold. Here is my waypoint, in which the bot logs:
Code: Select all
<!-- # 1 --><waypoint x="-33358" z="-16212" y="411">
player:update();
moneyPrev = inventory.Money;
gProfitPrev = gProfitPrev + profit;
player:merchant("Carey Delis"); yrest(4000);
player:update(); yrest(50);
filename = getExecutionPath() .. "/logs/caProfit.xml";
file, err = io.open(filename, "a+");
if( not file ) then
error(err, 0);
end
player:update();
profit = inventory.Money - moneyPrev;
gProfit = gProfitPrev + profit;
timeTaken = (os.difftime(os.time(),startTime) - player.Sleeping_time) / 60;
moneyPerMinute = profit / timeTaken;
printf("It is " ..os.date().. " and I have " ..inventory.Money.. " Gold, since the last run gave " ..profit.. " Gold. It took " ..timeTaken.. " minutes. Thats a profit of " ..moneyPerMinute.. " Gold per minute and a total profit of " ..gProfit.. " Gold.\n\n")
file:write("It is " ..os.date().. " and I have " ..inventory.Money.. " Gold, since the last run gave " ..profit.. " Gold. It took " ..timeTaken.. " minutes. Thats a profit of " ..moneyPerMinute.. " Gold per minute and a total profit of " ..gProfit.. " Gold.\n\n")
file:close();
startTime = os.time();
</waypoint>How can I fix this problem?