Template or script in an automation

“Best” is a pretty vague term… Are you looking for “Most Concise”, “Easiest to Read”, “Even a 7 year old could follow the logic”, or maybe “Shortest”. It is a lot easier to give applicable suggestions if you share a more specific description of your goals and methods #8, #9

From the minimal information you have given, you can likely accomplish setting the level using either templates or Choose actions.