[Javascript] causing script to pause before moving to next command

David Merchant merchant at LATECH.EDU
Fri May 3 16:13:52 CDT 2002


At 08:57 PM 5/3/2002 +0000, you wrote:
>David,
>You might want to use a setTimeout() command to pause the script before it 
>does its action.  Play around a little with the amount of milliseconds to 
>pause it, because you might need it to be long or short depending on the 
>sound.  Here is what the code might look like:
>
>if (player[sy][sx][0] < 100) {
>/* Hit something */
>/* need to have set timeout here to delay setting image and playing sound */
>setImage(sy,sx,103,false);
>setTimeout("playSound(0)", 20); /*  Pause for 20 millaseconds */

Brain dead me (really ought to take more breaks away from the computer) had 
it like setTimeout(200) .. duh, it does need to know what it is pausing...

Thanks!!!!

Time to go home,
David

Systems Librarian, Louisiana Tech University
merchant at latech.edu
JavaScript List Administrator (www.mountaindragon.com/javascript/)
Webmaster, HTML Encyclopedia (www.mountaindragon.com/html/)
Webmaster, Memorial Day Page (www.usmemorialday.org/)
Webmaster, Midori Ito Site (www.mountaindragon.com/midori/)




More information about the Javascript mailing list