Thx broI suggest next time you want some help with a script, try and post the script you tried to make or something that shows you've at least tried to do it. Just asking for a script without even trying to make it first isn't helping you or anybody else.
It doesn't matter if you can't do it, or get stuck on parts of it. What matters is that you try first, then ask if you get stuck. Otherwise you'll never learn anything.
Ugh.. so many n00bs who can't be bothered learning the most simple scripts.That wasn't necessary was it..
To add on to this, You can learn a LOT by just reading through the command documentation and actively trying to switch to a more logical mindset to solving script problems.
With those two things, You can figure out the steps required to accomplish an action, And know which commands and conditionals will be relevant to making your script work.
If you are trying to think of how to make a script that does X, And you don't know where to start, It's best to just jump in with what you do know how to do and test it, Observe the results, And adjust accordingly.
That's what I do when trying something I have never tried before like my climbing axe script, Or my Domino script.