Thread:LuxRegem/@comment-24003134-20131123012221/@comment-24108837-20131123020322

Currently programming is only a hobby of mine and I haven't really programmed for 2 months or something. So I need to get a bit back in it. But I looked at it a bit and I think you can make the code a lot shorter.

For instance all the if's in a row seem to do basically the same thing. Try to build it in a loop.

Readability is served with a switch/case in cases like this.

With some smarter structuring you can make it shorter and more flexible.

For instance you make arrays elementOne and elementTwo as I said and array armorName

then you fill them as follows: and so on

elementOne[0] = "earth" elementTwo[0] = "water" armorName[0] = "snakeskin" elementOne[1] = "earth" elementTwo[1] = "fire" armorName[1] = "volcanic mantle" elementOne[2] = "earth" elementTwo[2] = "air" armorName[2] = "crius" elementOne[3] = "earth" elementTwo[3] = "spirit" armorName[3] = "chimera"

Then you loop through it.

for(i=0, i = length(elementOne) - 1, i++) { if(armorElementOne == elementOne[i]  && armorElementTwo == elementTwo[i]  || armorElementOne == elementTwo[i]  && armorElementTwo == elementOne[i] ) info.text = "Possible Outcomes:\n(1*) armorName[i] "; exit; }

or something. That makes it manageable and maintainable and much shorter. It will be much easier to add or remove armours and to add processing for multiple element armours.

This code has terrible syntax errors and won't work straight away. I just try to explain the idea.