| 02-05-2007, 04:45 AM | #1 |
Okay, I'm trying to use the mouse click sound in JASS, and It doesn't work the first time because it has to be preloaded first. My question is how? I tried using call Preload("Sound\\Interface\\MouseClick1.wav") but it still doesn't play the first time. I tried playing the sound at map init and it still didn't do anything. Before you all start telling me how this has been answered billions of times, I would like to add that I've been searching through old posts for over an hour, and found only fragments of information. Thanks in advance. |
| 02-05-2007, 08:31 PM | #2 |
Well if you've already found that the don't play the first time. Then run them all in a loop once at the beginning before they're used. |
| 02-06-2007, 12:03 AM | #3 |
You don't think I've tried that? 1) It doesn't work if you try call it at map init 2) It works if you add a delay so it plays immediately, but for every sub-sequent load of the map, you hear the sounds at the beginning of the map. So, could someone be kind enough (who has solved this problem) post and tell me what they did? It seems like a stupid problem, but I've been pulling my hair out because nothing is working. |
| 02-06-2007, 01:03 AM | #4 |
Play them at zero volume? |
| 02-06-2007, 01:08 AM | #5 |
Playing them at map init works, if it doesn't just do so after 0.01 seconds |
| 02-06-2007, 01:11 AM | #6 |
Oooh, you meant the first time you play a map! I thought you meant the first time you call the function. Sorry, I misunderstood. |
| 02-06-2007, 02:07 AM | #7 |
The 0 volume worked, and played at 0.00 seconds. @Naakaloh - I wanted to have the sounds loaded so that when the function is called (it could be an hour into the map, or it could never happen) the sounds are ready. Anyways, +rep to all 3 of you and the code follows (in case anyone else has these problems and starts searching old posts. JASS:function CISSoundsAction takes nothing returns nothing local sound soundHandle set soundHandle = CreateSound(CISClickSound(), false, false, true, 12700, 12700, "") call SetSoundVolume(soundHandle, 0) call StartSound(soundHandle) call KillSoundWhenDone(soundHandle) set soundHandle = null call DestroyTrigger(GetTriggeringTrigger()) endfunction function CISInitSounds takes nothing returns nothing local trigger trig = CreateTrigger() call TriggerRegisterTimerEvent(trig, 0.00, false) call TriggerAddAction(trig, function CISSoundsAction) set trig = null endfunction |
