GenieClient / Genie4

.NET 6 Update of Genie
GNU General Public License v3.0
20 stars 14 forks source link

4.0.2.6 - evalmath min() not working properly #151

Closed hat071af closed 9 months ago

hat071af commented 1 year ago

As the title says, the min function doesn't seem to work most of the time, although it is consistent in whichever error it is making.

For example, here's a debug 4 output where the first two checks output the wrong minimum while the third output the correct one:

weapon.cmd(406): evalmath: lowest_weapon.mainhand.learning min(10,12,0,0,0,0,0)
weapon.cmd(406): evalmath result: lowest_weapon.mainhand.learning=10

weapon.cmd(414): evalmath: lowest_weapon.missile.learning min(20,1,0)
weapon.cmd(414): evalmath result: lowest_weapon.missile.learning=1

weapon.cmd(422): evalmath: lowest_weapon.offhand.learning min(0,32,1,0)
weapon.cmd(422): evalmath result: lowest_weapon.offhand.learning=0

And this is the same script but with different variables where none of the three is correct.

weapon.cmd(406): evalmath: lowest_weapon.mainhand.ranks min(711.97,371.24,711.72,370.71,370.83,371.34,371.54)
weapon.cmd(406): evalmath result: lowest_weapon.mainhand.ranks=371.24

weapon.cmd(414): evalmath: lowest_weapon.missile.ranks min(371.19,711.99,371.13)
weapon.cmd(414): evalmath result: lowest_weapon.missile.ranks=371.19

weapon.cmd(422): evalmath: lowest_weapon.offhand.ranks min(711.62,371.93,711.86,373.19)
weapon.cmd(422): evalmath result: lowest_weapon.offhand.ranks=371.93
hat071af commented 1 year ago

Upon researching this more, it appears to only be comparing the first two numbers in the list.

If that's the case, please upgrade this to a suggestion to implement a more robust min and max formula.

mj-colonel-panic commented 10 months ago

The min function was receiving the array of numbers but only evaluating the first two. I've changed this to a loop through every number in the array. I've also applied this to the max function which worked the same.