Computer Science Canada

click a button, sound made

Author:  white_dragon [ Sat May 15, 2004 4:32 pm ]
Post subject:  click a button, sound made

this one should be easy but i can't figure it out.

how do u make it so then when someone clicks a button, it makes a sound. at the same time, they hafta wait a few seconds before they can fire again. something like a reload time.

Author:  guruguru [ Sat May 15, 2004 4:48 pm ]
Post subject: 

code:

var x, y, b : int

loop
    Mouse.Where (x, y, b)
    if b = 1 then
       play ("abcdefgabcd")
       delay(1000)
    end if
end loop

Author:  white_dragon [ Sun May 16, 2004 4:58 pm ]
Post subject: 

tks. about the reload time............... after they click a button, can i make it so they hafta wait before they can click again?

Author:  SuperGenius [ Sun May 16, 2004 5:58 pm ]
Post subject: 

That is already the case for that code because while the computer is waiting for the delay it will not recognize clicks.

Author:  Tony [ Sun May 16, 2004 6:06 pm ]
Post subject: 

umm... no... cuz delay would pause the program itself. To emplement cooldown, you take system's time and save it in a variable. The user then cannot fire untill systemTime > (fireTime + cooldownTime) is satisfied.

Author:  SuperGenius [ Mon May 17, 2004 3:58 pm ]
Post subject: 

I was assuming that this code would be run in it's own process in a loop.


: