Difference between revisions of "Cabal Common Library Doc Comms"
m |
Cholmondely (talk | contribs) (Added more) |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| + | [[File:Lib ovi01.png|right]] | ||
| + | CCL Doc Comms offers ship-to-player and worldScripts-to-player communications (and maybe more stuff too) | ||
== Overview == | == Overview == | ||
This is the main class for the secure comms channels with its members and part of the [[Cabal_Common_Library]]. | This is the main class for the secure comms channels with its members and part of the [[Cabal_Common_Library]]. | ||
| Line 13: | Line 15: | ||
Everything else is performed within the EQ-script. | Everything else is performed within the EQ-script. | ||
| + | |||
| + | === Relevant BB Chatter === | ||
| + | Svengali » Tue Jun 19, 2012 11:32 am | ||
| + | :Capt. Murphy wrote: | ||
| + | :As a potential control method for "ships to ship comms" how about 'nested' N-key activated equipment? | ||
| + | This is exactly what CCL_Comms does. And it does it for multiple ships and worldScripts as every inserting entity/script has its own entry. Methods to add, remove and change entries are giving the possibilities for nested structures and when the mode switch key comes (its in trunk already and CCL will switch when its in a released version) it will be even easier. It doesn't need multiple EQs. | ||
| + | |||
| + | A very simple example for a ship2player comm can be found in [wiki]Cabal_Common_MaterialsFinder[/wiki] (see ccl_matfinder.js). | ||
| + | |||
| + | :Pleb wrote: | ||
| + | :It could be like the Resistance Commander OXP that player to ship communications can be used to talk to escorts and give them orders. | ||
| + | |||
| + | The way in Resistance Commander is nice, but eats Pylons and has other weak points as it doesn't work for playerships with lower numbers of available slots. Another approach via overlays would only work on systems with shader support. [https://bb.oolite.space/viewtopic.php?p=174707#p174707 Svengali (2012)] | ||
== Functions == | == Functions == | ||
=== addToComm() === | === addToComm() === | ||
| − | {{CodeEx|codeex=addToComm | + | {{CodeEx|codeex=addToComm: function( obj )}} |
{{CodeExTime|native=0.000158|extension=0.000068|js=0.000124}} | {{CodeExTime|native=0.000158|extension=0.000068|js=0.000124}} | ||
Adds incoming object to the list. Make sure that the object is extensible and not sealed or frozen. | Adds incoming object to the list. Make sure that the object is extensible and not sealed or frozen. | ||
| Line 38: | Line 53: | ||
Example for a ship: | 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); | + | worldScripts.Cabal_Common_Comms.addToComm(this.myComm); |
Examle for a worldScript: | 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); | + | worldScripts.Cabal_Common_Comms.addToComm(this.myComm); |
=== removeFromComm() === | === removeFromComm() === | ||
| − | {{CodeEx|codeex=removeFromComm | + | {{CodeEx|codeex=removeFromComm: function( obj )}} |
{{CodeExTime|native=0.000038|extension=0.000010|js=0.000114}} | {{CodeExTime|native=0.000038|extension=0.000010|js=0.000114}} | ||
Removes object from the list. | Removes object from the list. | ||
| Line 70: | Line 85: | ||
:;bool: Boolean. True on success. | :;bool: Boolean. True on success. | ||
| − | + | worldScripts.Cabal_Common_Comms.removeFromComm(this.myComm); | |
=== changeChoicesComm() === | === changeChoicesComm() === | ||
| − | {{CodeEx|codeex=changeChoicesComm | + | {{CodeEx|codeex=changeChoicesComm: function( pID, newSet )}} |
{{CodeExTime|native=0.000154|extension=0.000068|js=0.000124}} | {{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. | ||
| Line 86: | Line 101: | ||
Example for a ship: | Example for a ship: | ||
| − | + | var newSet = [{display:"Hail"},{display:"Back"}]; | |
| − | worldScripts.Cabal_Common_Comms.changeChoicesComm(this.ship.entityPersonality,newSet); | + | worldScripts.Cabal_Common_Comms.changeChoicesComm(this.ship.entityPersonality,newSet); |
| − | this.myComm.react = newSet; | + | this.myComm.react = newSet; |
| − | |||
| − | [[Category: | + | == Links == |
| + | *[https://bb.oolite.space/viewtopic.php?p=173966#p173966 CCL offers comms channels, but as far as I know only the Vector uses it (and the MaterialsFinder).] (Svengali, 2012 - and see next few posts). | ||
| + | [[Category:OXP API's]] | ||
Latest revision as of 14:38, 1 July 2025
CCL Doc Comms offers ship-to-player and worldScripts-to-player communications (and maybe more stuff too)
Contents
Overview
This is the main class for the secure comms channels with its members and part of the Cabal_Common_Library.
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. Entries are valid until the player leaves the system or in case of entities is out of scanner range based on a timer with 25 sec intervals. The range check can by bypassed.
The script checks the following shipdata.plist script_info key when the player receives a comms message from that entity.
script_info:
- ccl_secureChannel
- String. Property in the ship-script that holds the comm object.
- ccl_secureChannelPrep
- String. Function in the ship-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.
Relevant BB Chatter
Svengali » Tue Jun 19, 2012 11:32 am
- Capt. Murphy wrote:
- As a potential control method for "ships to ship comms" how about 'nested' N-key activated equipment?
This is exactly what CCL_Comms does. And it does it for multiple ships and worldScripts as every inserting entity/script has its own entry. Methods to add, remove and change entries are giving the possibilities for nested structures and when the mode switch key comes (its in trunk already and CCL will switch when its in a released version) it will be even easier. It doesn't need multiple EQs.
A very simple example for a ship2player comm can be found in [wiki]Cabal_Common_MaterialsFinder[/wiki] (see ccl_matfinder.js).
- Pleb wrote:
- It could be like the Resistance Commander OXP that player to ship communications can be used to talk to escorts and give them orders.
The way in Resistance Commander is nice, but eats Pylons and has other weak points as it doesn't work for playerships with lower numbers of available slots. Another approach via overlays would only work on systems with shader support. Svengali (2012)
Functions
addToComm()
| addToComm: function( obj ) |
| Profiler | |
|---|---|
| Native | 0.000158s |
| Extension | 0.000068s |
| JS | 0.000124s |
Adds incoming object to the list. Make sure that the object is extensible and not sealed or frozen.
Parameters:
- obj
- Object.
Returns:
- bool
- Boolean. True on success.
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.
Parameters:
- obj
- Object. To be removed.
Returns:
- bool
- Boolean. True on success.
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.
Parameters:
- pID
- Number/String. Must be entityPersonality for entities and this.name for worldScripts.
- newSet
- Array. Set of new actions.
Returns:
- bool
- Boolean. True on success.
Example for a ship:
var newSet = [{display:"Hail"},{display:"Back"}];
worldScripts.Cabal_Common_Comms.changeChoicesComm(this.ship.entityPersonality,newSet);
this.myComm.react = newSet;
Links
- CCL offers comms channels, but as far as I know only the Vector uses it (and the MaterialsFinder). (Svengali, 2012 - and see next few posts).
