krasi wrote:Could somebody tell me how the bot calculates the durability and what does 0.9 represent ?
0.9 represents the percentage of the max durability of an item. So if an item has a max durability of 125 and the current durability is 100 then dura will equal 100/125 = 0.8
krasi wrote:Also what does this line do ?
if( dura < 0.9 ) then
I believe < is equivalent to < so it equates to;
if( dura < 0.9 ) then
I think they use it because < doesn't seem to work. Don't know why. Maybe someone else can enlighten us. I usually just flip it around like so;
if( 0.9 > dura ) then
It has the same effect.
krasi wrote:If durability is lower then 0.9 then set flag true, is that what this line is and if it is then why wont the bot start the repair macro ?
You really should be reading the instructions properly. The tutorial you are talking about clearly shows 2 pieces code, 1 for the onLeaveCombat section and 1 for the waypoint file.
As you understand, what you have done is just changed the flag. In the waypoint where you want to go for repairs, you check the flag then loadPaths.
Personally I don't know why you would check durability after every fight if you only need it in the waypoint file when deciding to go for repairs.
It's probably better to just use this in the waypoint file;
Code: Select all
local dura = inventory:getMainHandDurability();
printf("Durability:%s\n", dura);
if( dura < 0.9 ) then
loadPaths("your_repair_path.xml");
end
krasi wrote:Is it normal to see the durability like "0.8734573645876345 in the bot window ?
It's just showing you the current dura. If you don't want to see it just get rid of the printf statement.