Difference between revisions of "Cabal Common Library Doc Comms"

From Elite Wiki
m
m
Line 18: Line 18:
 
=== addToComm() ===
 
=== addToComm() ===
 
{{CodeEx|codeex=addToComm = function( obj )}}
 
{{CodeEx|codeex=addToComm = function( obj )}}
 +
{{CodeExTime|native=0.000158|extension=0.000068|js=0.000124}}
 
Adds incoming object to the list.
 
Adds incoming object to the list.
  
Line 55: Line 56:
 
=== removeFromComm() ===
 
=== removeFromComm() ===
 
{{CodeEx|codeex=removeFromComm = function( obj )}}
 
{{CodeEx|codeex=removeFromComm = function( obj )}}
 +
{{CodeExTime|native=0.000038|extension=0.000010|js=0.000114}}
 
Removes object from the list.
 
Removes object from the list.
  
Line 62: Line 64:
 
=== changeChoicesComm() ===
 
=== changeChoicesComm() ===
 
{{CodeEx|codeex=changeChoicesComm = function( pID, newSet)}}
 
{{CodeEx|codeex=changeChoicesComm = function( pID, newSet)}}
 +
{{CodeExTime|native=0.000154|extension=0.000068|js=0.000124}}
 
Changes the stored actions for a specific entry.
 
Changes the stored actions for a specific entry.
  

Revision as of 10:26, 26 July 2011

Overview

This is the main class for the secure comms channels with its members.

The script is mainly used to store and handle incoming data from shipscripts and worldScripts for a secure communication channel. Entities can place, change or remove their data fairly simple and a few parameters are handled. The equipment itself is not visible to the player and added automagically by adding a entry.

Additionally entities can use script_info keys to give the player the option to open a channel.

script_info:

ccl_secureChannel
String. Property in the script that holds the comm object.
ccl_secureChannelPrep
String. Function in the script that initiates the object.

The scripts should keep a valid object to use removeFromComm() or changeChoicesComm.

Everything else is performed within the EQ-script.


Functions

addToComm()

addToComm = function( obj )
Profiler
Native 0.000158s
Extension 0.000068s
JS 0.000124s

Adds incoming object to the list.

If the player selects a action, the script will pass the index of the action in the set. Therefor it is necessary to provide some infos when adding a entry.

Properties:

display
String. Used for onscreen display.
who
Entity/String. The entity or worldScript.
ent
Boolean. Must be true for entities, blank for worldScripts.
pID
Number/String. Must be entityPersonality for entities and this.name for worldScripts.
callback
String. The function that handles the actions.
noDist
Boolean. Optional. If true keep entity entry if out of scanner range.
react
Array. Holds the names of the actions.

Example for a ship:

this.myComm = {
display:"My channel",
who:this.ship,
ent:true,
pID:this.ship.entityPersonality,
callback:"commCall",
react:[{display:"Hail"},{display:"Back"}]

};
worldScripts.Cabal_Common_Comms.addToComm(this.myComm);

Examle for a worldScript:

this.myComm = {
display:"Snoopers",
who:this.name,
pID:"Snoopers",
callback:"commCall",
react:[{display:"Snoopers status"},{display:"Back"}]

};
worldScripts.Cabal_Common_Comms.addToComm(this.myComm);


removeFromComm()

removeFromComm = function( obj )
Profiler
Native 0.000038s
Extension 0.000010s
JS 0.000114s

Removes object from the list.

worldScripts.Cabal_Common_Comms.removeFromComm(this.myComm);


changeChoicesComm()

changeChoicesComm = function( pID, newSet)
Profiler
Native 0.000154s
Extension 0.000068s
JS 0.000124s

Changes the stored actions for a specific entry.

Example for a ship:

var newSet = [{display:"Hail"},{display:"Back"}];

worldScripts.Cabal_Common_Comms.changeChoicesComm(this.ship.entityPersonality,newSet);
this.myComm.react = newSet;