Page 1 of 1

getMainHandDurability() not returning dura in % anymore

Posted: Wed Dec 26, 2012 9:07 am
by Rickster
Hello,

I just wondered why my scripts make my characters running to the mearchant all the time :D

I set the userprofile to check MainHandDurability after each fight end then decide wether to go to repair or not at 90% of the main hand dura.

some characters are equiped with weapons with over 90 durability e.g. 97/97, and they repair their weapons when dura drops below 90 (absolute value)
others are equiped with weapons with lower dura e.g. 85/85. they alway want to repair, coz they never reach a MainHandDurability over 85 for exsample.

inventory:getMainHandDurability() no more returns the dura in %. It returns the absolute value of the actual dura.
This behaviour seems to be new, since I used the scripts for a long time, but now i run into this prob.

Can we fix this or how do i get the actual dura and the max dura of the mainhand weapon to calculate the durability in %?

Thanx
Ric

Re: getMainHandDurability() not returning dura in % anymore

Posted: Wed Dec 26, 2012 9:37 am
by rock5
As far as I can see, getMainHandDurability still returns % and hasn't been changed.

Re: getMainHandDurability() not returning dura in % anymore

Posted: Wed Dec 26, 2012 10:15 am
by Rickster
I am using this

Code: Select all

dura = inventory:getMainHandDurability()
to get the dura and it returns the actual dura, not % of max dura.
Am I doing somethinig wrong to get the dura?

Can someone please check this also?
I do not know where else I can look at my side for errors :(

Thanx
Ric

Re: getMainHandDurability() not returning dura in % anymore

Posted: Wed Dec 26, 2012 11:38 am
by rock5
I have an item to test that has durability of 101/105

Code: Select all

Command> print(inventory:getMainHandDurability())
96.590476190476
96.5% is correct. What version of the bot are you using?

Re: getMainHandDurability() not returning dura in % anymore

Posted: Wed Dec 26, 2012 12:55 pm
by Rickster
actual revision is 744.

using the commandline like you did it returns "74" for a 74/80 item, that should be at 92,5% :(

Re: getMainHandDurability() not returning dura in % anymore

Posted: Wed Dec 26, 2012 1:19 pm
by rock5
All I can think of is maybe you have a userfunction that overwrites that function. Maybe you could try renaming your userfunctions folder temporarily and see if it still does it.

Re: getMainHandDurability() not returning dura in % anymore

Posted: Thu Dec 27, 2012 12:39 pm
by Rickster
I disabled all of my userfunctions and the behaviour is just the same, but i figured out, that this happens only with items, which have a dura below 100.
for dura 100 and above it shows the correct %, otherwise it shows the absolut dura.

I am not sure, if it is exact 100 for making this difference. I tested with a weapon 69/80 and another 111/113.

can you reproduce this on your side?

i am sorry, i can not find the code for this calculation to have a look at it myself.
can you tell me, where to find it?


[edit] found the code for equipment in rom\classes\equipment.lua ... and tried this for

1. mainhand weapon 69/80 which returns the absolut value

Code: Select all

Command> print(equipment:getDurability(15))
69.99
2. ranged weapon 111/113 which returns the % value

Code: Select all

Command> print(equipment:getDurability(10))
98.530973451327
Ric

Re: getMainHandDurability() not returning dura in % anymore

Posted: Thu Dec 27, 2012 1:16 pm
by rock5
I just tried an item with 83/84 dura and got 99% so it worked. I'm at a loss.

Re: getMainHandDurability() not returning dura in % anymore

Posted: Thu Dec 27, 2012 3:30 pm
by Rickster
hehe, ok ;) ... so lets leave it at this. and thanx for having a look at.
I´ll report, if I can find anything about it.