GenieClient / Genie4

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

Else/Elseif does not function properly past first instance of `else`. #109

Closed AzaraelDR closed 2 years ago

AzaraelDR commented 2 years ago

When using else if after an if statement, the second else will recognize if the first if condition is true and skip evaluation, however the next else if will believe the previous evaluation was false and proceed to process its if statement. If this condition evaluates to True, the code for this statement will execute even though the initial condition should cause it to skip execution.

Sample script follows:

debug 10 var a 1 var b 1 var c 1 var d 0

if (%a) then { echo 1 } else if (%b) then { echo 2 } else if (%c) then { echo 3 } else if (%d) then { echo 4 } else echo 5

mj-colonel-panic commented 2 years ago

So I think I may have fixed this. Due to the ubiquitous nature of if statements this is a very dangerous change so I've made it a separate package on the Test Release. Please go there (link below) and try the 407-ELSE.Fix.zip client

https://github.com/GenieClient/Genie4/releases/edit/Test_Build

AzaraelDR commented 2 years ago

That link doesn't bring me anywhere, just back to my profile page.

mj-colonel-panic commented 2 years ago

That is because I'm an idiot and gave you the wrong link sorry try this one https://github.com/GenieClient/Genie4/releases/tag/Test_Build

AzaraelDR commented 2 years ago

That seems to have worked. My test script worked fine and ran through Geniehunter on a few cycles with no issue. I would still recommend letting other people test it some and make sure there isn't a fringe case.