How can i shut down my Mac using script idle?

Hi everyone,
I am currently using my Mac notebook, and I want to learn, about shutting down the Mac automatically when it is not being used within fifteen minutes.
I know where the script is located on my Mac, but I don't understand how it works.
Does anyone have an idea of using script in shutting down the Mac notebook?
How can I apply Mac shutdown script idle?
I really need your help.
I will appreciate it.
Thanks!
