Difference between revisions of "Cabal Common Library Doc Music"

From Elite Wiki
(Started Doc for CCL_Music)
 
m
Line 4: Line 4:
 
The script handles incoming data from worldScripts to play music in specific situations.
 
The script handles incoming data from worldScripts to play music in specific situations.
 
OXPs can place or remove their sets fairly simple and a few parameters are handled.
 
OXPs can place or remove their sets fairly simple and a few parameters are handled.
  +
The inserted data is associated to the inserting worldScript by ID and the whole group
  +
of events can be easily de/activated at every time via [[#changeStatus()|.changeStatus()]].
  +
Additionally a property can be assigned to a specific event, means that different entries
  +
can be de/activated by using different properties.
   
   
Line 10: Line 14:
 
On startUp created set of handlers for Cabal_Common_Music.
 
On startUp created set of handlers for Cabal_Common_Music.
   
'''TODO''' - Example.
 
  +
{{CodeEx|codeex=var a = worldScripts.Cabal_Common_Music.requestHandlerSet;
  +
a -> [ [aegis, enter, exit], [alert, red, ... ]}}
   
   
Line 17: Line 22:
 
{{CodeEx|codeex=addMedia = function( obj )}}
 
{{CodeEx|codeex=addMedia = function( obj )}}
 
Adds incoming object to the list and associates the entries to the sending worldScript.
 
Adds incoming object to the list and associates the entries to the sending worldScript.
  +
Internally every entry gets an ID, so don't pass non-writable, sealed or frozen objects.
   
 
'''Properties:'''
 
'''Properties:'''
 
:;who:String. Required. Name of the sending worldScript.
 
:;who:String. Required. Name of the sending worldScript.
 
:;start:Boolean. Required. Starting state after insertion.
 
:;start:Boolean. Required. Starting state after insertion.
:;aegis:Object. Allowed members: '''TODO'''
+
:;aegis:Object. Allowed members: enter, exit.
:;alert:Object. Allowed members: '''TODO'''
+
:;alert:Object. Allowed members: red, yellow, green.
:;destroyed:Object. Allowed members: '''TODO'''
+
:;destroyed:Object. Allowed members: ent.
:;exitWS:Object. Allowed members: '''TODO'''
+
:;exitWS:Object. Allowed members: inter, goneNova, doNova, standard, any.
:;launch:Object. Allowed members: '''TODO'''
+
:;launch:Object. Allowed members: ent, inter, goneNova, doNova, main, any.
:;planet:Object. Allowed members: '''TODO'''
+
:;planet:Object. Allowed members: ent, enterMain, enterSun, exitMain, exitSun.
:;scooped:Object. Allowed members: '''TODO'''
+
:;scooped:Object. Allowed members: ent.
:;track:Object. Allowed members: '''TODO'''
+
:;track:Object. Allowed members: byName.
   
 
'''Returns'''
 
'''Returns'''
Line 34: Line 40:
   
   
'''TODO''' - Infos about members.
 
  +
The above mentioned members are all of type Array and are holding the music related objects.
  +
See [[#Structure|Structure]] for a overview.
   
   
Line 59: Line 66:
 
:;Boolean: True on success, false on failure.
 
:;Boolean: True on success, false on failure.
   
  +
  +
== Structure ==
  +
A short overview about the expected structure:
  +
{{CodeEx|codeex=var eventMusic = {
  +
:who:this.name,<br>
  +
:start:true,<br>
  +
:aegis:{<br>
  +
::exit:[<br>
  +
:::{prop:"myProperty",music:"myMusic.ogg"}<br>
  +
::]<br>
  +
:}<br>
  +
};<br>
  +
worldScripts.Cabal_Common_Music.addMedia(eventMusic);}}
  +
  +
The objects that are holding the music itself have a set of available properties as well, but only '''music''' is required.
  +
:;dist:Number. Min. distance to entity. Only available in '''track'''.
  +
:;ent:String. Entity name. Available in '''destroyed''', '''launch''', '''planet''', '''scooped''' and '''track'''.
  +
:;fadeQ:Number. Sound as transition between musicfiles. If used must be 1 (will be expanded).
  +
:;music:String. Filename with fileextension.
  +
:;prop:String. Name of worldScript property to be checked.
  +
  +
  +
----
   
 
[[Category:OXPDoc]]
 
[[Category:OXPDoc]]

Revision as of 23:53, 8 August 2011

Overview

This is the main class for the event driven inflight music for missions.

The script handles incoming data from worldScripts to play music in specific situations. OXPs can place or remove their sets fairly simple and a few parameters are handled. The inserted data is associated to the inserting worldScript by ID and the whole group of events can be easily de/activated at every time via .changeStatus(). Additionally a property can be assigned to a specific event, means that different entries can be de/activated by using different properties.


Properties

requestHandlerSet

On startUp created set of handlers for Cabal_Common_Music.

var a = worldScripts.Cabal_Common_Music.requestHandlerSet;

a -> [ [aegis, enter, exit], [alert, red, ... ]


Functions

addMedia()

addMedia = function( obj )

Adds incoming object to the list and associates the entries to the sending worldScript. Internally every entry gets an ID, so don't pass non-writable, sealed or frozen objects.

Properties:

who
String. Required. Name of the sending worldScript.
start
Boolean. Required. Starting state after insertion.
aegis
Object. Allowed members: enter, exit.
alert
Object. Allowed members: red, yellow, green.
destroyed
Object. Allowed members: ent.
exitWS
Object. Allowed members: inter, goneNova, doNova, standard, any.
launch
Object. Allowed members: ent, inter, goneNova, doNova, main, any.
planet
Object. Allowed members: ent, enterMain, enterSun, exitMain, exitSun.
scooped
Object. Allowed members: ent.
track
Object. Allowed members: byName.

Returns

Boolean
True on success, false on failure.


The above mentioned members are all of type Array and are holding the music related objects. See Structure for a overview.


removeMedia()

removeMedia = function( who )

Removes entries from the stored list.

Properties:

who
String. Name of the worldScript.

Returns

Boolean
True on success, false on failure.


changeStatus()

changeStatus = function( who, status )

Removes entries from the stored list.

Properties:

who
String. Name of the worldScript.
status
Boolean. Changes the active flag for all inserted files of a specific worldScript.

Returns

Boolean
True on success, false on failure.


Structure

A short overview about the expected structure:

var eventMusic = {
who:this.name,
start:true,
aegis:{
exit:[
{prop:"myProperty",music:"myMusic.ogg"}
]
}

};
worldScripts.Cabal_Common_Music.addMedia(eventMusic);

The objects that are holding the music itself have a set of available properties as well, but only music is required.

dist
Number. Min. distance to entity. Only available in track.
ent
String. Entity name. Available in destroyed, launch, planet, scooped and track.
fadeQ
Number. Sound as transition between musicfiles. If used must be 1 (will be expanded).
music
String. Filename with fileextension.
prop
String. Name of worldScript property to be checked.