[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4280: ob_start(): output handler 'ob_gzhandler' conflicts with 'zlib output compression'
Oolite Bulletins • [Release]Missile warning
Page 1 of 2

[Release]Missile warning

Posted: Wed Oct 14, 2015 7:30 pm
by Anonymissimus
I should have my first OXP almost ready (tested successfully :) ):
In the core game, a sound is played only at the launch of a missile at you, but not later on when the missile is still there. This is a problem, the missile may not get destroyed by auto ECM, or I may want to shoot something else previously. I tend to forget about the still incoming missile while doing that. Then there are the extremely dangerous Kamikaze orbiters from TCAT OXP which seem to not even emit the usual "woop woop" missile launch sound and I sure want a warning for those. Furthermore, that same "woop woop" sound is also used when ships start to attack you, which happens that frequently I tend ignore the sound. In combat situations with more than 2 parties, hostile NPCs tend to toggle between the player and something else as their target causing woop woop all the time.
So, my OXP shall play a unique sound repeatedly for as long as there is at least one missile in the player's scanner range which is targeting the player ship, so the player is reminded he should use key_target_missile and deal with it.
I've created a poor alert like sound with audacity that suits for now - maybe someone can point me to something with a compatible license I could use ? It should be less alerting than the Q-bomb detector sound as a missile is a lesser threat and they should not be confused in combat. The sound from asteroid storm is the same as from thargoid wars and I don't want to use it. Any others available ?

I've got a few questions:
-What's up with the $ or _ markers in front of what seem to be "private" functions/variables ? Is that just a so-so notation standard ?
-It's apparently not possible to pass an argument to the function called by a timer ?
-Is the shipAttackedWithMissile function only called if it's the player ship or if any ship is attacked by a missile ?
(That is another use of my OXP - if there are missiles in the scanner range but sound doesn't play, no need to check with key_target_missile whether they are targeting the player).
EDIT
The sound also needs to be very short (max 1 second) as the checking interval for whether there's currently a missile inbound should not be longer.

Re: missile warner

Posted: Wed Oct 14, 2015 8:29 pm
by spara
Anonymissimus wrote: I've got a few questions:
-What's up with the $ or _ markers in front of what seem to be "private" functions/variables ? Is that just a so-so notation standard ?
It's a convention to prevent possible future clashes with events. No event name will start with _ or $. Core local js functions start with _ and variables with $. I personally find it easier to read other peoples codes when they use the same convention.
Anonymissimus wrote: -It's apparently not possible to pass an argument to the function called by a timer ?
Here's one way to do it:

Code: Select all

this.$fooTimer = new Timer(this, function(){this._fooTimer(fooVariable)}, 1)
Hopefully someone else will be able to answer your other questions.

And congrats for you first OXP :D .

Re: missile warner

Posted: Wed Oct 14, 2015 8:35 pm
by Norby
Anonymissimus wrote:What's up with the $ or _ markers in front of what seem to be "private" functions/variables ?
It is important.
Anonymissimus wrote:It's apparently not possible to pass an argument to the function called by a timer ?
I use global variables like this.$var and .bind(this) as a workaround.
Anonymissimus wrote:Is the shipAttackedWithMissile function only called if it's the player ship
In a worldScript, yes. In a ship script, for a ship where the script is attached in shipdata.plist or ship.[url=http://wiki.alioth.net/index.php/Oolite_JavaScript_Reference:_Ship#setScript]setScript[/url]("some.js") (and not by ship.[url=http://wiki.alioth.net/index.php/Oolite_JavaScript_Reference:_Ship#script]script[/url]="some.js"; due to this parameter is read-only). You must attach it individually, there is no general attachment and you should not attach a script generally to do not break the ship scripts already attached is many OXPs. You should solve in a worldScript using filters, for example system.[url=http://wiki.alioth.net/index.php/Oolite_JavaScript_Reference:_System#allShips]allShips[/url] or ship.[url=http://wiki.alioth.net/index.php/Oolite_JavaScript_Reference:_Ship#checkScanner]checkScanner()[/url].

Soundbible.com and slicing with audacity can help also.

Re: missile warner

Posted: Thu Oct 15, 2015 5:47 pm
by Anonymissimus
Norby wrote: Soundbible.com and slicing with audacity can help also.
Unfortunately I can't find something that is in the public domain and sounds sufficiently alarming, but not too annoying, so that one can listen to it so often. The ladder condition is much harder to fulfill as it may seem...
A few others are okay to listen to but don't sound much like an alarm sound. More like a ping signal.

Re: missile warner

Posted: Fri Oct 16, 2015 4:43 am
by Diziet Sma
Anonymissimus wrote:
Norby wrote: Soundbible.com and slicing with audacity can help also.
Unfortunately I can't find something that is in the public domain and sounds sufficiently alarming, but not too annoying, so that one can listen to it so often.
Did you try searching Soundbible for buzzer type noises? Some of them may be suitable.

Here's a link that does a 'buzz' search at Soundbible for you:
http://soundbible.com/suggest.php?q=buzz&x=0&y=0

Of the 50+ sounds returned, there are only four items in the entire listing that are restricted in a way that would prevent use in Oolite. (my personal favourite is the Loud Alarm Clock Buzzer, though it would need trimming)

Re: missile warner

Posted: Fri Oct 16, 2015 2:21 pm
by Anonymissimus
Well, thanks, but...
my personal favourite is the Loud Alarm Clock Buzzer
Seriously ? Imagine you need to hear that all the time in a furball with assassins, maybe with some barracudas (from Aquatics OXP) equipped with pylon reloader, so 12 missiles per ship in total ?
Anyway, so Sampling Plus 1.0 and Attribution 3.0 are usable ? I like http://soundbible.com/1501-Buzzer.html although it's somewhat too long but an 1.5 s interval probably still suffices. Sounds as if you're one the engine deck of a freighter with a missile inbound. :)

Re: missile warner

Posted: Fri Oct 16, 2015 3:50 pm
by Wildeblood

Re: Missile warning

Posted: Fri Oct 16, 2015 7:33 pm
by Anonymissimus
It's now available at github https://github.com/anonymissimus/oolite-MissileWarning
(You must clone it into a folder in the addons directory where the manually installed addons are with a local git client and name the folder such as oolite-MissileWarning.oxp)
I don't see and docs about distribution via the oxz manager.
EDIT
You can also download a zip from github, then no need to bother with git:
https://github.com/anonymissimus/oolite ... master.zip

Re: missile warner

Posted: Sat Oct 17, 2015 1:14 am
by Diziet Sma
Anonymissimus wrote:Well, thanks, but...
my personal favourite is the Loud Alarm Clock Buzzer
Seriously ? Imagine you need to hear that all the time in a furball with assassins, maybe with some barracudas (from Aquatics OXP) equipped with pylon reloader, so 12 missiles per ship in total ?
<grins> Well, I would shorten it to just 3 or 4 beeps.. so, about a second at most.
Anonymissimus wrote:Anyway, so Sampling Plus 1.0 and Attribution 3.0 are usable ?
Yes.. Sampling Plus 1.0 is an old (and deprecated) Creative Commons licence that allows you to do what you like with it so long as you include attribution (e.g. - in the readme and on the OXP wiki page). Attribution 3.0 is similar, except that you must also provide a link to the licence, and indicate if you made any changes to the original product. See the links for details. (This is why you should always google licences, instead of making assumptions about them. :wink:)

Actually, the only truly restrictive licence at SoundBible, from a gaming point of view, is the "Personal Use Only" one. After all, the whole point of the website is to make the recordings available for others to use. As it happens, my first preference for the QBD alarm turned out to be a Personal Use Only sound.. which I was quite annoyed about, so I had to settle for the one now in use.
Anonymissimus wrote:I like http://soundbible.com/1501-Buzzer.html although it's somewhat too long but an 1.5 s interval probably still suffices. Sounds as if you're one the engine deck of a freighter with a missile inbound. :)
That one sounds good too. Though I bet if you had dozens of missiles flying about, per your example above, you'd probably get tired of hearing it too.. :mrgreen: :wink:
Anonymissimus wrote:I don't see and docs about distribution via the oxz manager.
So.. you're saying you totally missed the stickied thread here in the Expansion Pack section, titled The All-in-One Guide to OXZ Packaging and Distribution? :shock:

(It's also linked to at the wiki, on the [EliteWiki] OXP howto page)

Re: missile warner

Posted: Sat Oct 17, 2015 3:09 am
by Anonymissimus
Diziet Sma wrote:So.. you're saying you totally missed the stickied thread here in the Expansion Pack section, titled The All-in-One Guide to OXZ Packaging and Distribution? :shock:
IIRC it was more like...did not find something in the wiki...wrote that post...later on realized that I had that thread in an open tab in my browser, it must have been brought up by a previous search, perhaps google...and then didn't bother to edit the post.

Re: missile warner

Posted: Sat Oct 17, 2015 7:02 am
by Diziet Sma
Anonymissimus wrote:IIRC it was more like...did not find something in the wiki...
Now that we've had some time pass for any necessary corrections/additions to that thread to appear, I guess it's time I added the information to the wiki.

Re: [Release]Missile warning

Posted: Sat Oct 17, 2015 9:47 am
by Norby
Nice work! I can upload the oxz into the manager if you need but better if you ask your logins from cim and maik, especially if you plan regular updates.

A minot thing that the date in changelog should be updated, another is the category in manifest.plist must be filled. If you think this is a big help in gameplay then put into the Mechanics category, if not then Ambience.

Re: [Release]Missile warning

Posted: Sat Oct 17, 2015 12:57 pm
by Diziet Sma
Norby wrote:another is the category in manifest.plist must be filled. If you think this is a big help in gameplay then put into the Mechanics category, if not then Ambience.
Hmm.. as an (albeit minor) equipment upgrade, it belongs in Equipment, surely?

Re: [Release]Missile warning

Posted: Sat Oct 17, 2015 1:12 pm
by Amah
Just saved my behind in a property related disagreement with some spacewaymen. Cool project!

Re: [Release]Missile warning

Posted: Sat Oct 17, 2015 1:23 pm
by Diziet Sma
Amah wrote:Just saved my behind in a property related disagreement with some spacewaymen.
Therein lies a tale, by the sounds of things.. please tell us more.