Difference between revisions of "Cabal Common Library Doc Overlay"

From Elite Wiki
(started doc for overlay script)
 
m
Line 4: Line 4:
 
It handles 19 slots for inflight overlays (10x characters, 9x notifications) and uses shaders to place them on screen
 
It handles 19 slots for inflight overlays (10x characters, 9x notifications) and uses shaders to place them on screen
 
and works in a similiar way to the overlays in [[Vector_OXP|Vector]] (this OXP will be changed to use this mechanism).
 
and works in a similiar way to the overlays in [[Vector_OXP|Vector]] (this OXP will be changed to use this mechanism).
 +
 +
The underlaying shader uses <code>shaderInt1</code> and <code>shaderInt2</code> for moving the overlay, <code>shaderFloat1</code> for brightness, <code>shaderFloat2</code> for highlighting (see [[#ovSpeak()|ovSpeak()]]), <code>shaderVector1</code> for positioning (x/y) and size (z) and <code>shaderVector2</code> for coloring (only if cclov_color is used for character overlays).
 +
 +
As all overlays are done as screen aligned quads their appearance is based on the used screen resolution.
  
  
Line 10: Line 14:
 
{{CodeEx|codeex=worldScripts.Cabal_Common_Overlay.ovAdd( obj, off )}}
 
{{CodeEx|codeex=worldScripts.Cabal_Common_Overlay.ovAdd( obj, off )}}
 
Adds overlay to one of the available slots. Added overlays will stay inflight until the calling script explicitely removes them, the VisualEffect becomes invalid or the autoremove option is used. All overlays will be removed when the player docks or leaves the system, but are respawned (offscreen) when the player launches or enters a new system. The script does not store anything to the savedgame though, so scripts are responsible to add them if necessary.
 
Adds overlay to one of the available slots. Added overlays will stay inflight until the calling script explicitely removes them, the VisualEffect becomes invalid or the autoremove option is used. All overlays will be removed when the player docks or leaves the system, but are respawned (offscreen) when the player launches or enters a new system. The script does not store anything to the savedgame though, so scripts are responsible to add them if necessary.
 +
 +
If used when docked the overlay will be stored and spawned offscreen when the player launches.
  
 
'''Parameters:'''
 
'''Parameters:'''
Line 16: Line 22:
  
 
'''Returns:'''
 
'''Returns:'''
:;result:VisualEffect or false.
+
:;result:Visual Effect (or when docked true) or false.
  
 
'''Properties:'''
 
'''Properties:'''
:;cclov_id:String. Unique Identifier.
+
:;cclov_id:String. Unique Identifier. Required.
:;cclov_type:Number. 0=Notification, 1=Character.
+
:;cclov_type:Number. 0=Notification, 1=Character. Required.
 
:;cclov_blend:Number. Duration for effect in seconds. Set to -1 for permanent.
 
:;cclov_blend:Number. Duration for effect in seconds. Set to -1 for permanent.
 
:;cclov_autoremove:Boolean. Removes effect after cclov_blend seconds.
 
:;cclov_autoremove:Boolean. Removes effect after cclov_blend seconds.
 
:;cclov_fx:String. VisualEffect to be used instead.
 
:;cclov_fx:String. VisualEffect to be used instead.
 
:;cclov_png:String/Texture. Must be specified if cclov_fx is not used.
 
:;cclov_png:String/Texture. Must be specified if cclov_fx is not used.
:;cclov_color:Array. Color in rgb. Values should be in range 0...3.
+
:;cclov_color:Array. RGB values in range 0...3 for character overlays.
  
  

Revision as of 13:36, 22 November 2012

Overview

This is the main class for the overlay helpers with its members and part of the Cabal_Common_Library.

It handles 19 slots for inflight overlays (10x characters, 9x notifications) and uses shaders to place them on screen and works in a similiar way to the overlays in Vector (this OXP will be changed to use this mechanism).

The underlaying shader uses shaderInt1 and shaderInt2 for moving the overlay, shaderFloat1 for brightness, shaderFloat2 for highlighting (see ovSpeak()), shaderVector1 for positioning (x/y) and size (z) and shaderVector2 for coloring (only if cclov_color is used for character overlays).

As all overlays are done as screen aligned quads their appearance is based on the used screen resolution.


Methods

ovAdd()

worldScripts.Cabal_Common_Overlay.ovAdd( obj, off )

Adds overlay to one of the available slots. Added overlays will stay inflight until the calling script explicitely removes them, the VisualEffect becomes invalid or the autoremove option is used. All overlays will be removed when the player docks or leaves the system, but are respawned (offscreen) when the player launches or enters a new system. The script does not store anything to the savedgame though, so scripts are responsible to add them if necessary.

If used when docked the overlay will be stored and spawned offscreen when the player launches.

Parameters:

obj
Object. Properties see below.
off
Boolean. If true overlay is added, but offscreen.

Returns:

result
Visual Effect (or when docked true) or false.

Properties:

cclov_id
String. Unique Identifier. Required.
cclov_type
Number. 0=Notification, 1=Character. Required.
cclov_blend
Number. Duration for effect in seconds. Set to -1 for permanent.
cclov_autoremove
Boolean. Removes effect after cclov_blend seconds.
cclov_fx
String. VisualEffect to be used instead.
cclov_png
String/Texture. Must be specified if cclov_fx is not used.
cclov_color
Array. RGB values in range 0...3 for character overlays.


ovSpeak()

worldScripts.Cabal_Common_Overlay.ovSpeak( who, cclov_blend, message, whom, autoremove )

Lights up the overlay.

Parameters:

who
String. Identifier (see ovAdd() - cclov_id).
cclov_blend
Number. Duration for effect in seconds.
message
String.
whom
Entity.
autoremove
Boolean. Removes effect after cclov_blend seconds.

Returns:

result
Boolean. True on success. Otherwise false.


ovRemove()

worldScripts.Cabal_Common_Overlay.ovRemove( who )

Remove specified overlay.

Parameters:

who
String. Identifier (see ovAdd() - cclov_id).

Returns:

result
Boolean. True on success. Otherwise false.