
-----------------------------------
white_dragon
Sat May 15, 2004 4:32 pm

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.

-----------------------------------
guruguru
Sat May 15, 2004 4:48 pm


-----------------------------------

var x, y, b : int

loop
    Mouse.Where (x, y, b)
    if b = 1 then
       play ("abcdefgabcd")
       delay(1000)
    end if
end loop


-----------------------------------
white_dragon
Sun May 16, 2004 4:58 pm


-----------------------------------
tks. about the reload time............... after they click a button, can i make it so they hafta wait before they can click again?

-----------------------------------
SuperGenius
Sun May 16, 2004 5:58 pm


-----------------------------------
That is already the case for that code because while the computer is waiting for the delay it will not recognize clicks.

-----------------------------------
Tony
Sun May 16, 2004 6:06 pm


-----------------------------------
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.

-----------------------------------
SuperGenius
Mon May 17, 2004 3:58 pm


-----------------------------------
I was assuming that this code would be run in it's own process in a loop.
