/help /while
/help variables
/help Text and Number Identifiers

with those you should be able to do the script...
Or you could read trough the forums to find a script which does the job with little modification...