I posted an example on how to take a script with multiple chained conditionals and replace it with a single conditional loop a while back (5 years ago?! wow...). It's sort of like separating the data (item numbers and NPC spam) from the logic (conditionals, function calls, etc).
Thread can be found
here. The example I'm referring to is the last post in the thread.