1. When a script is worth it
When a script is worth it

The most important rule first: what the editor can do, you build in the editor. Actions are visible, you can click and test them, and everybody on the team understands them. A script only becomes the better choice when the editor gets cumbersome.
| Situation | Better in the editor | Better with Lua |
|---|---|---|
| A text, an animation, a scene change | always | never |
| A check in one place | "If condition", "If value" | |
| The same check in many places | write it once as a function, call it everywhere | |
| Calculations, randomness with rules, going through lists | tedious | a few lines |
| Reacting to the mouse wheel or certain keys throughout the game | partly (key actions) | event handler |
| Something should keep running in the background | event handler, used sparingly |
An example from Pia's cellar
Pia fiddles around with the grate. After the first wrong attempt she should just sigh, after the third she should give a clear hint. You can do that with action parts, but it needs a check of its own for every attempt. With a small function it is one line per place. You will build this function in chapter 5.
Rule to remember
Build in the editor first. Reach for a script when you click the same logic together for the third time.
Your task
Find a check in your project that you have already built several times. That is your first candidate for a script.