Just a caveat ... it's not that hard for a script to do something you didn't intend for it to do. Bitcoin transactions are non-reversible, as you likely know, ... so a script doing something dumb like forgetting to calculate the change amount properly would result in the change going to the miner.
So, ... use testnet if you are developing a script, and have a second set of eyes on a script before you run it live on bitcoin main.