You are probably looking for conditional sleeps. You can find an example in this tutorial at 9.
But you can also use this:
to make your sleeps look nicer.
I have no clue about log files but im sure its possible.
And yes the only way to test scripts is to run them in the acutal game, but sometimes they have beta servers up that generally have everything unlocked. Beta servers are currently open until next thursday I believe.