If your script has errors, the scripting engine will detect the error whenever the script is run. The error will appear in the event log. If your script is not working, check the log for errors. The log will contain the line number where the error occurred.
Do not allow your script to run for more than a few seconds. Scripts are to be used to perform a quick task that does not take a lot of time. The script engine will prompt you with a dialog box warning you that the script is taking a long time to run if the script is running for longer than 30 seconds. You can work around this, however. You can call the script function hs.WaitEvents() or hs.WaitSecs(). If you call this function within 30 seconds, the script will not time out. This will also let HomeSeer do other tasks while your script is executing.