function playalarm(_adjust) add more sounds.

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

function playalarm(_adjust) add more sounds.

#1 Post by beanybabe » Mon Dec 07, 2015 8:51 pm

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
...

Iyfgf
Posts: 4
Joined: Sat Aug 29, 2015 2:32 pm

Re: function playalarm(_adjust) add more sounds.

#2 Post by Iyfgf » Wed Dec 09, 2015 12:24 pm

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

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: function playalarm(_adjust) add more sounds.

#3 Post by beanybabe » Thu Dec 10, 2015 1:29 am

ok ill work on a few small audio wav

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Semrush [Bot] and 2 guests