A script is a behaviour with a name. It is written once, on its own, and attached to an object by that name: the three guards here run the same patrol at different speeds and distances, and the object never mentions what it does. The settings are declared by the code, because nothing outside a function can know what its variables are, and each carries a default, so an object that sets only one still gets both.
Why a name and not a function. The name is what a saved scene can hold: a file cannot carry code, so an editor attaching a behaviour writes down patrol and its settings, and the engine looks it up when the scene opens. The same indirection lets a behaviour gain a setting later without invalidating every scene saved before it.