Difference between revisions of "Snoopers Doc"
From Elite Wiki
m |
m |
||
Line 43: | Line 43: | ||
:;Message:String/Key. Required. Message can be a string or keynames (descriptions.plist or missiontext.plist), mixtures allowed, max 700 chars, min 10 chars. | :;Message:String/Key. Required. Message can be a string or keynames (descriptions.plist or missiontext.plist), mixtures allowed, max 700 chars, min 10 chars. | ||
− | :;Agency:Number. Defines GNN, Rooters, Snoopers. If used Snoopers disables custom pics and models. | + | :;Agency:Number. Defines 1-GNN, 2-Rooters, 3-Snoopers. If used Snoopers disables custom pics and models. |
:;Priority:Number. 1 highest (and bypasses CRC check and storing), used to sort the inserted news on next docking. Default 3. | :;Priority:Number. 1 highest (and bypasses CRC check and storing), used to sort the inserted news on next docking. Default 3. | ||
:;Pic:String. Overlay image, use tranparent areas if model should be used. Fileextension is required. If Agency and Pic not declared default setting choosen. | :;Pic:String. Overlay image, use tranparent areas if model should be used. Fileextension is required. If Agency and Pic not declared default setting choosen. | ||
:;Music:String. Music for Newsflash. Fileextension is required. If not declared, default setting choosen. | :;Music:String. Music for Newsflash. Fileextension is required. If not declared, default setting choosen. | ||
− | :;Model:String. Model | + | :;Model:String. Role for Model, if used Pos must be passed to, else disabled. shipdata.plist must use the same name and roles must contain snoopers_model(0). |
:;Pos:Array. 3 valid numbers, ignored if Model not declared. | :;Pos:Array. 3 valid numbers, ignored if Model not declared. | ||
:;Ori:Number. Defines the orientation of Model. 1-[1,0,0,0], 2-[1,0,0,1], 4-[0,0,1,0], 8-[1,1,0,0]. Default 8. (New in 2.1.1). | :;Ori:Number. Defines the orientation of Model. 1-[1,0,0,0], 2-[1,0,0,1], 4-[0,0,1,0], 8-[1,1,0,0]. Default 8. (New in 2.1.1). | ||
− | '''Errorcodes:''' | + | |
− | :;negative:Snoopers buffers are full, | + | '''Errorcodes:'''<br> |
+ | Snoopers will check all incoming requests and returns a value to the calling function (always) and logs errors (if necessary or logging enabled)... Usually (with this.logging = false) it will only log real errors, by enabling this switch all returned values are logged. | ||
+ | :;negative:Snoopers buffers are full, OXP already placed a newsflash or CRC is still stored. | ||
:;zero:Success. | :;zero:Success. | ||
:;positive:Error occured, details logged to Latest.log. | :;positive:Error occured, details logged to Latest.log. |
Revision as of 15:25, 24 March 2011
Contents
Overview
snoopers.js is the script for the galactic news network. OXPs (worldScripts) can insert own messages by passing a object to Snoopers.
worldScripts.snoopers.insertNews(obj); |
After displaying this message Snoopers tries to callback and passes the first 20 chars of the message.
- Callback
worldScripts[obj.ID].newsDisplayed(obj.Message.substr(0,20)); |
Properties
logging
- Boolean. Switches extended logging on/off and can be configured via OXPConfig2. Default is false.
audio
- Boolean. Switches audio for internal news on/off and can be configured via OXPConfig2. Default is true.
extraA
- Boolean. Switches full mode for internal news on/off and can be configured via OXPConfig2. Default is true.
sliderA
- Integer. Chance for newsflashes and can be configured via OXPConfig2. Default is 0x3 (#3).
sliderB
- Integer. Max days between newsflashes and can be configured via OXPConfig2. Default is 0x19 (#25).
sliderC
- Integer. Brightness for displayed model and can be configured via OXPConfig2. Default is 0x4 (#4). This will only affect shadered models which support it. Uses the fuel property.
Functions
insertNews()
this.insertNews = function(obj) |
Handles incoming message from other OXPs and stores it if all checks are passed. Snoopers stores up to 10 messages and 20 CRCs.
Parameters
- obj
- Object.
Returns
- n
- Number. Errorcode.
The passed object can hold a couple of properties:
- ID
- String. Required. Name of the calling worldScript. Snoopers stores a checksum (CRC) to scatter the messages on every start and inbetween.
- Message
- String/Key. Required. Message can be a string or keynames (descriptions.plist or missiontext.plist), mixtures allowed, max 700 chars, min 10 chars.
- Agency
- Number. Defines 1-GNN, 2-Rooters, 3-Snoopers. If used Snoopers disables custom pics and models.
- Priority
- Number. 1 highest (and bypasses CRC check and storing), used to sort the inserted news on next docking. Default 3.
- Pic
- String. Overlay image, use tranparent areas if model should be used. Fileextension is required. If Agency and Pic not declared default setting choosen.
- Music
- String. Music for Newsflash. Fileextension is required. If not declared, default setting choosen.
- Model
- String. Role for Model, if used Pos must be passed to, else disabled. shipdata.plist must use the same name and roles must contain snoopers_model(0).
- Pos
- Array. 3 valid numbers, ignored if Model not declared.
- Ori
- Number. Defines the orientation of Model. 1-[1,0,0,0], 2-[1,0,0,1], 4-[0,0,1,0], 8-[1,1,0,0]. Default 8. (New in 2.1.1).
Errorcodes:
Snoopers will check all incoming requests and returns a value to the calling function (always) and logs errors (if necessary or logging enabled)... Usually (with this.logging = false) it will only log real errors, by enabling this switch all returned values are logged.
- negative
- Snoopers buffers are full, OXP already placed a newsflash or CRC is still stored.
- zero
- Success.
- positive
- Error occured, details logged to Latest.log.
A simple example
worldScripts.snoopers.insertNews({ ID: this.name , Message: "Hello world!" }); |