So basically I found this big Sound list on the wiki
https://wiki.esoui.com/Sounds, so I decided to go through it and maybe find some sounds for my next addon. Entering everything by myself in chat with "/script PlaySound(SOUNDS.ABILITY_CASTER_DEAD)" wasn't the right solution for me so I decided to write a little script which iterates through the list and play each sound one by one after a certain amount of delay.
My list structure was this:
Lua Code:
UAN.Sounds = {
["ABILITY_CASTER_BUSY"] = SOUNDS.ABILITY_CASTER_BUSY,
["ABILITY_CASTER_DEAD"] = SOUNDS.ABILITY_CASTER_DEAD,
["ABILITY_CASTER_DISORIENTED"] = SOUNDS.ABILITY_CASTER_DISORIENTED,
["ABILITY_CASTER_FEARED"] = SOUNDS.ABILITY_CASTER_FEARED,
["ABILITY_CASTER_LEVITATED"] = SOUNDS.ABILITY_CASTER_LEVITATED,
["ABILITY_CASTER_PACIFIED"] = SOUNDS.ABILITY_CASTER_PACIFIED,
}
After my game freezed, everytime I wanted to make a pause between the sounds, some kindly devs suggested me to use LibAsync for my purpose.
LibAsync:
https://www.esoui.com/downloads/info2125-LibAsync.html
How to LibAsync:
https://wiki.esoui.com/Running_LUA-Code_asynchroneously
The solution for my problem which worked at the end was the following code:
Lua Code:
local async = LibStub("LibAsync")
local task = async:Create("wait")
local count = 1;
local function someFunction(key, value)
PlaySound(value)
d(strfmt("[%d]: %s", count, key))
count = count + 1
-- delay my own task by doing nothing for 3s
task:Delay(3000, function() end)
end
local function testSounds()
-- go through the list asynchronous and execute someFunction() in each step
task:For(pairs(UAN.Sounds)):Do(someFunction)
count = 0
end
SLASH_COMMANDS["/test"] = testSounds