Page 1 of 1
problem on auto repairing based on dura
Posted: Mon Jan 25, 2010 10:52 am
by tomerr90
Code: Select all
<!-- # 16 --><waypoint x="-18218" z="6095">
if( player.free_flag1 == true ) then
player.free_flag1 = false;
loadPaths("ret_k.xml");
end
</waypoint>
Code: Select all
<onLeaveCombat><![CDATA[
local dura = inventory:getMainHandDurability();
printf("Durability:%s\n", dura);
if( dura < 0.9 ) then
player.free_flag1 = true;
end
]]></onLeaveCombat>
and when i try to run the bot it says "Failed to compile and run lua code for Onleavecombat in character profile".
By the way i think you should redo the auto repairing part of the bot because the time and the fight based auto repairing doesnt work either.
Thanks.
Edit: Fixed it, the problem seems to be in the condition, this part: <
i replaced it with "< (Enter number here)" and it compiled properly, i'll check how it works now and update you
Update:
Works like a charm

Update 2:
it seems the game sends the dura in percent like 0.95 or whatever so dont write the dura number write the percent
Re: problem on auto repairing based on dura
Posted: Mon Jan 25, 2010 1:00 pm
by VoiD
You sure it works with loadPaths("ret_k.xml"); instead of loadPaths("ret_k"); ? Mine works fine without the .xml, wonder if it works in both cases...

Re: problem on auto repairing based on dura
Posted: Mon Jan 25, 2010 1:07 pm
by tomerr90
yea it does.
weird it shouldnt work without the .xml
Re: problem on auto repairing based on dura
Posted: Mon Jan 25, 2010 2:35 pm
by VoiD
Well I reused the examples in the demo for the most basic of commands... For example u have in your demo2.xml:
loadPaths("demo3");
Guess they made an if() and they added an .xml if it wasn't there...

Re: problem on auto repairing based on dura
Posted: Mon Jan 25, 2010 7:40 pm
by InadequateCoder
I had the same problem so I did the same thing.
And it works with and without the .xml I believe.