Page 1 of 1
function playalarm(_adjust) add more sounds.
Posted: Mon Dec 07, 2015 8:51 pm
by beanybabe
I keep renaming this so I can add more sounds. I got to thinking why not just remake this so it includes several sounds.
I use the alarm sound and a chicken sound for catching eggs. I like to add sounds for if you get to some location. If a friend is near or guild or stranger and few extra for events join/end holiday stuff. I am not sure how to keep it compatible with the old function.
function playalarm(_adjust,sound)
alarm.wav
chicken.wav
guildie.wav
strangerdanger.wav
...
Re: function playalarm(_adjust) add more sounds.
Posted: Wed Dec 09, 2015 12:24 pm
by Iyfgf
To be compatible we just need to check for optional argument, something like the following.
-iyfgf
Code: Select all
function playalarm(_adjust, _sound)
-- usage
-- playalarm() -- default volume
-- playalarm(10) -- a little louder then default
-- playalarm(-10) -- a little softer then default, max of -20
_adjust = _adjust or 0
_sound = _sound or "alarm.wav"
--=== User option to adjust volume ===--
local permanantadjust = 0 -- set higher value to make sound louder.
--=== start of function ==---
local volumeadjustment = permanantadjust + _adjust
if -20 > volumeadjustment then volumeadjustment = -20 end -- make sure value isn't less then -20
if volumeadjustment > 80 then volumeadjustment = 80 end -- make sure value isn't more then 80
local interfacevolume = RoMScript("InterfaceSFXVolumeSlider_GetValue()")
local mastervolume = RoMScript("MasterVolumeSlider_GetValue()")
RoMScript("InterfaceSFXVolumeSlider_SetValue(100)")
RoMScript("MasterVolumeSlider_SetValue("..20 + volumeadjustment..")")
RoMScript("PlaySoundByPath('Interface/AddOns/ingamefunctions/".._sound.."')")
cprintf(cli.red,"Alarm has been sounded\n")
yrest(2000)
RoMScript("InterfaceSFXVolumeSlider_SetValue("..interfacevolume..")")
RoMScript("MasterVolumeSlider_SetValue("..mastervolume..")")
end
Re: function playalarm(_adjust) add more sounds.
Posted: Thu Dec 10, 2015 1:29 am
by beanybabe
ok ill work on a few small audio wav