Page 1 of 1

Play alarm sound

Posted: Fri Nov 04, 2011 1:56 am
by lisa
Ok I just put this together and it may evolve into more or it might just be kept simple.

Near the top of the userfunction has this.

Code: Select all

	local permanantadjust = 0
You can adjust that so it is always louder or softer by default.

Usage

Code: Select all

playalarm() -- default volume
playalarm(10) -- a little louder then default
playalarm(-10) -- a little softer then default
userfunction_soundalarm.lua
(1.14 KiB) Downloaded 388 times
alarm high volume.zip
save the alarm.wav file to the interface/addons/ingamefunctions folder
(9.05 KiB) Downloaded 342 times

I am going to add the usage of this userfunction into GMDetect.

--=== added suguestions ===--

start bot using commandline

Code: Select all

rom/bot path:commandline
At the prompt type

Code: Select all

playalarm()
to test the volume, if it seems to soft then add with increments of 10

Code: Select all

playalarm(10)
playalarm(20)
until you get a volume you like
If playalarm() seemed to loud then adjust with -5 increments.

Code: Select all

playalarm(-5)
until you get a volume you like

You can then open up the userfunction and adjust

Code: Select all

local permanantadjust = 0
replace the 0 with the value that made the sound seem a good volume.

Code: Select all

local permanantadjust = 10
local permanantadjust = -5
Then just use playalarm() and it should play the alarm at the volume you like any time you call the function.

--=== ideas for usage ===--

Obviously GMDetect and has been added in to V 2.3 of the userfunction, I made it do double play of the sound, to tell when GM and not just another usage of playalarm().

When you reach the end of a WP and use player:sleep()

Basically any time you want to hear the sound to get your attention.

Re: Play alarm sound

Posted: Fri Nov 04, 2011 2:14 am
by rock5
So what is the range of values accepted by the function?

Re: Play alarm sound

Posted: Fri Nov 04, 2011 2:17 am
by lisa
Master volume is 20 by default.

So you can go -20 and +80

I did do a check though for the adjustment and if you do 1000000000 it will set to the max of 100.
same with less then -20, if you do -48753247863475 it will set to -20.


-20 is actually 0 on volume so you won't hear anything.

Re: Play alarm sound

Posted: Thu Nov 17, 2011 5:53 am
by spawni
think a nice feature for the function is to play a sound when bot gets stucked for more than x times...
So you can go to pc before bot logs out or shows unnormal behaviour "in the wild".

Re: Play alarm sound

Posted: Thu Nov 17, 2011 7:35 am
by lisa
i added in calling a userfunction for unstick tries a while ago now.
3 choices to use can use 1 none or all.

Code: Select all

unStick3()
unStick6()
unStick9()
So you could make a userfunction with this

Code: Select all

function unStick9()
playalarm()
end

Re: Play alarm sound

Posted: Thu Dec 27, 2012 3:32 pm
by kuripot
how can i use this when my client got crash??

Re: Play alarm sound

Posted: Thu Dec 27, 2012 5:48 pm
by lisa

Code: Select all

atError(function(script, line, message)
playalarm()
playalarm()
end
Add that to an onload somewhere, be it profile or WP.
Basically it tells the bot when an error message is called to also do that code.
So assuming when client crashes MM will error with some message it will now also do the sound thing, keep in mind this userfunction uses the in game sound though so it won't work like that, it might still play the system speaker though, you will have to test it =)