Difference between revisions of "Lib PAD"
(First draft) |
(Updating BB links) |
||
(29 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | P.A.D. (Personal Assistance Device) | ||
[[Image:IconLib.png|100px|right]] | [[Image:IconLib.png|100px|right]] | ||
+ | [[File:P.A.D..png|thumb|400px|right|P.A.D. '''GalCop''' - showing last GNN news bulletin & other recent changes]] | ||
==Overview== | ==Overview== | ||
− | Lib_PAD (part of [[Library]]) is a logbook, mission-log, diary and interface. AddOns can implement data to get important organisations, events, systems or persons exposed to the player in an unified way. It also ships search functionality, a way to customize players data (species, gender, etc) and players can also add own notes. | + | The P.A.D. on the F4 ship-station interface screen. Lib_PAD (part of [[Library OXP|Library]]) is a logbook, mission-log, diary and interface. AddOns can implement data to get important organisations, events, systems or persons exposed to the player in an unified way. It also ships search functionality, a way to customize players data (species, gender, ''etc'') and players can also add own notes. |
+ | The P.A.D. currently interfaces with the [[Vanilla game]] missions, [[Galactic Navy OXP]] & [[GNN]]. | ||
+ | |||
+ | There was an earlier version ("PAD" without the full stops!) in [[Vector OXP]]. | ||
==Categories== | ==Categories== | ||
− | The categories in Lib_PAD are the first component of all dotted | + | [[File:Lib_pad_layout.jpg|right|thumb|400px|Textures layout]] |
+ | [[File:Sv pad08.jpg|right|thumb|400px|'''Player Data''' - Personal Information - choosing a portrait]] | ||
+ | [[File:Sv pad03.jpg|right|thumb|400px|'''GALCOP''' - displaying player history from Galactic Navy OXP]] | ||
+ | [[File:Lib PAD01.png|right|thumb|400px|'''Persons''' - Information sheet on NPC]] | ||
+ | |||
+ | The categories in Lib_PAD are the first component of all dotted paths. Pages in a category do share a template which defines the layout of the page. All pages, except LOGS, do have 6 slots for textures (t0 - t5). | ||
:;GALCOP:Category for GalCop, Police, Navy and other official organisations related to GalCop. | :;GALCOP:Category for GalCop, Police, Navy and other official organisations related to GalCop. | ||
+ | :::Contains entries: name, entry, enlisted, kills, missions, awards, info. | ||
+ | ::::name is set by Lib_PAD. | ||
:;GUILDS:Category for other organisations which do have a membership. | :;GUILDS:Category for other organisations which do have a membership. | ||
+ | :::Contains entries: name, entry, enlisted, kills, missions, awards, info. | ||
+ | ::::name is set by Lib_PAD. | ||
:;INFOS:Category for special events, news, specific stations, etc. | :;INFOS:Category for special events, news, specific stations, etc. | ||
+ | :::Contains entries: name, location, beacon, purpose, special, notes. | ||
:;LOGS:Category for standard events like rescued escape pods, bailed out, fined, etc. | :;LOGS:Category for standard events like rescued escape pods, bailed out, fined, etc. | ||
+ | :::Contains entries: list. | ||
:;PERSONS:Category for characters you have met or you got infos about. | :;PERSONS:Category for characters you have met or you got infos about. | ||
+ | :::Contains entries: name, origin, species, gender, age, rank, ship, info, notes. | ||
+ | ::::Players name, origin, species, gender, age, rank and ship are set by Lib_PAD. | ||
:;SYSTEMS:Category for special systems like Leesti, Tianve, Tionisla, etc. | :;SYSTEMS:Category for special systems like Leesti, Tianve, Tionisla, etc. | ||
+ | :::Contains entries: name, info, notes. | ||
+ | |||
+ | ===Types=== | ||
+ | :;Number: age, kills. | ||
+ | :;String: beacon, enlisted, entry, gender, location, name, origin, purpose, rank, ship, species. | ||
+ | :;Array: awards, info, list, missions, notes, special. | ||
+ | |||
+ | ===Textures=== | ||
+ | Specified textures can be any filename, but Lib_PAD also ships own textures for organisations, characters, insignia and medals. If set to a Number it will lookup the corresponding filename or if zero it won't show it. | ||
+ | :t0 - Usually an organisation on GALCOP, GUILDS and PERSONS pages. Lib_PAD uses greyscale textures. | ||
+ | :t1 - Usually a character on GALCOP, GUILDS and PERSONS pages. | ||
+ | :t2 - Usually an insignia / rank on GALCOP, GUILDS and PERSONS pages. | ||
+ | :t3 - Usually a medal on GALCOP, GUILDS and PERSONS pages. | ||
+ | :t4 - Unused yet. | ||
+ | :t5 - Unused yet. | ||
+ | |||
+ | ''The 250-odd textures (almost all are icons) tucked away inside Library.oxp include the following:'' | ||
+ | <gallery> | ||
+ | Image:Lib pad medal14.png | Medal Icon #14 | ||
+ | Image:Lib pad rank8.png | Rank Icon #14 | ||
+ | Image:Lib_pad_org9.png | Society Icon #9 | ||
+ | Image:Lib ovc89.png | NPC (ovc) #89 | ||
+ | Image:Lib ovi01.png | ovi #1 (of 10) | ||
+ | Image:Lib starmap 6.png | Starmap #6 | ||
+ | </gallery> | ||
==Methods== | ==Methods== | ||
+ | The following entry points for AddOns can be used on [[Oolite_JavaScript_Reference:_World_script_event_handlers#startUpComplete|.startUpComplete]] or later. | ||
===_addPageInCategory=== | ===_addPageInCategory=== | ||
− | {{CodeEx|codeex= _addPageInCategory: function( path, content )}} | + | {{CodeEx|codeex= _addPageInCategory: function( path, content, parent, sil )}} |
− | Register a new page entry in the specified dotted path | + | Register a new page entry in the specified dotted path. The inserted Object is cloned and merged with the corresponding template. |
'''Parameters:''' | '''Parameters:''' | ||
− | :;path:String. | + | :;path:String. Dotted path: [[#Categories|Category]] and page identifier. E.g. "GALCOP.NAVY". |
:;content:Object. | :;content:Object. | ||
+ | :;parent:Array. Pathes to relate to one or more other pages. | ||
+ | :;sil:Bool. Add the page silently. | ||
'''Returns:''' | '''Returns:''' | ||
Line 28: | Line 74: | ||
===_setPageEntry=== | ===_setPageEntry=== | ||
− | {{CodeEx|codeex= _setPageEntry: function( path, value )}} | + | {{CodeEx|codeex= _setPageEntry: function( path, value, sil )}} |
− | Set value in the specified dotted path | + | Set value in the specified dotted path. |
'''Parameters:''' | '''Parameters:''' | ||
− | :;path:String. | + | :;path:String. Dotted path: [[#Categories|Category]], page identifier and [[#Types|page entry]]. E.g. "GALCOP.NAVY.enlisted". |
− | :;value:Primitive. | + | :;value:Primitive (String or Number). If the path points to an Array the value will be pushed. For kills '''++''' can be used to increase the value by one. |
+ | :;sil:Bool. Add the value silently. | ||
'''Returns:''' | '''Returns:''' | ||
Line 41: | Line 88: | ||
===_getData=== | ===_getData=== | ||
{{CodeEx|codeex= _getData: function( path )}} | {{CodeEx|codeex= _getData: function( path )}} | ||
− | + | Returns the cloned data-object in the specified dotted path. | |
'''Parameters:''' | '''Parameters:''' | ||
− | :;path:String. | + | :;path:String. Dotted path: [[#Categories|Category]] and page identifier. E.g. "GALCOP.NAVY". |
'''Returns:''' | '''Returns:''' | ||
− | :Object (on success) or ''' | + | :Object (on success) or '''null''' (if the path does not exist). |
+ | |||
+ | [[File:Library-medals.png|right|thumb|400px|Medals]] | ||
+ | [[File:Library-ranks.png|right|thumb|400px|Ranks]] | ||
+ | [[File:Library-orgs.png|right|thumb|400px|Organisation Symbols]] | ||
+ | ==Handling== | ||
+ | Lib_PAD leaves the handling for loading and storing of inserted data to the inserting AddOns to avoid external resources like textures not being available and thus generating errors. It loads and stores it's own entries (pathes GALCOP.GENERIC, GALCOP.NAVY, GUILDS.GENERIC, INFOS.GENERIC, LOGS.GENERIC, PERSONS.GENERIC and SYSTEMS.GENERIC) | ||
+ | |||
+ | Loading and storing of data can be achieved easily, as shown in the following example. | ||
+ | <pre> | ||
+ | this.$data = { | ||
+ | GCI: {entry:clock.clockString,enlisted:"Sergeant",awards:["GCI Silver Cross"],t0:27,t1:1} | ||
+ | }; | ||
+ | this.startUpComplete = function(){ | ||
+ | if(missionVariables.MYMISSIONVARIABLE) this.$data = JSON.parse(missionVariables.MYMISSIONVARIABLE); | ||
+ | worldScripts.Lib_PAD._addPageInCategory("GALCOP.GCI",this.$data.GCI,0,1); | ||
+ | }; | ||
+ | this.playerWillSaveGame = function(){ | ||
+ | this.$data.GCI = worldScripts.Lib_PAD._getData("GALCOP.GCI"); | ||
+ | missionVariables.MYMISSIONVARIABLE = JSON.stringify(this.$data); | ||
+ | }; | ||
+ | </pre> | ||
+ | |||
+ | ==Example== | ||
+ | The following script works as a "script.js" in a specially created "Config" folder inside your "AddOns" folder: | ||
+ | this.startUpComplete = function() { | ||
+ | worldScripts.Lib_PAD._addPageInCategory("SYSTEMS.Digebiti G1", {name:"Digebiti G1", info:[ | ||
+ | "The sculpture and duelling pistols are famed exports", | ||
+ | "Home to English aristocrats, Hats are de rigeur", | ||
+ | "The feudal paradise of Digebiti is just south of GalCenter G1", | ||
+ | "My home planet"] | ||
+ | }) | ||
+ | worldScripts.Lib_PAD._addPageInCategory("PERSONS.Prince-Elector Rupert XIX", {name: "Prince-Elector Rupert XIX", origin:"Digebiti G1",species:"Human colonial",gender:"Male",age:41,ship:"Royal Barque: HSHS Falkland",rank:"Prince",info:["He is worried about the commie agents of Inonri & Vetitice","This led to Rupert's eschewal of Tennis for Extreme Dominoes","He succeeded after his brother Desmond died playing Real Tennis","The Supreme Ruler of Digebiti (in Lesser Walsingham)"],t0:9,t1:"lib_ovc02.png",t2:0,t3:14})}) | ||
+ | } | ||
+ | The following limits apply: | ||
+ | :no more than 64 characters in a line (the 65th does not fit on the line!) | ||
+ | :lines do not wrap and therefore must be individually specified | ||
+ | :no more than 4 lines in an array such as that for "info" - and they must be [bracketed] together - and, confusingly, these are displayed in ''reverse'' order! | ||
+ | :more than 4 lines will prevent the P.A.D. page loading | ||
+ | |||
+ | The "t0/t1/t2/t3" properties allow you to specify some additional images for the entry. For t0, t2 and t3, you can enter a number (see ranges below for each type) or an image name. | ||
+ | :'''t0''' displays the organisation logo (1-31) (see the textures folder inside Library.oxp for files named "lib_pad_org*.png") | ||
+ | :'''t1''' displays a mug shot (ditto - there are almost a hundred of these, excluding the player possibilities. Files named "lib_ovc*.png") | ||
+ | :'''t2''' displays a rank logo (1-17) (ditto, files named "lib_pad_rank*.png") | ||
+ | :'''t3''' displays a medal image (1-17) (ditto, files named "lib_pad_medal*.png") | ||
+ | |||
+ | == Musings == | ||
+ | This was only ever implemented for the Vanilla game missions - and for Galactic Navy. Other mission oxp's (''eg'' [[RRS Group]], [[Thargoid Wars]], [[The Assassins Guild OXP]], [[Resistance Commander]], ''etc''.) feature awards and ranks. These should be integrated with Lib PAD. | ||
+ | |||
+ | == Links == | ||
+ | *[[Library OXP]] | ||
+ | *[[Cabal Common Library OXP]] - forerunner of Library OXP | ||
+ | *Author: [[User:Svengali|Svengali]] | ||
+ | |||
+ | *[https://bb.oolite.space/viewtopic.php?f=4&t=21449 Library OXP logos and images] (2023) | ||
+ | *[https://bb.oolite.space/viewtopic.php?f=6&t=13866 Medals and awards?] (2013) | ||
+ | *[https://bb.oolite.space/viewtopic.php?p=205515#p205515 Player Logs in Elite: Dangerous] (Elite: Dangerous - Design Decision Forum: 2013) | ||
− | [[Category: | + | [[Category:OXP API's]] |
Latest revision as of 04:39, 18 March 2024
P.A.D. (Personal Assistance Device)
Contents
Overview
The P.A.D. on the F4 ship-station interface screen. Lib_PAD (part of Library) is a logbook, mission-log, diary and interface. AddOns can implement data to get important organisations, events, systems or persons exposed to the player in an unified way. It also ships search functionality, a way to customize players data (species, gender, etc) and players can also add own notes.
The P.A.D. currently interfaces with the Vanilla game missions, Galactic Navy OXP & GNN.
There was an earlier version ("PAD" without the full stops!) in Vector OXP.
Categories
The categories in Lib_PAD are the first component of all dotted paths. Pages in a category do share a template which defines the layout of the page. All pages, except LOGS, do have 6 slots for textures (t0 - t5).
- GALCOP
- Category for GalCop, Police, Navy and other official organisations related to GalCop.
- Contains entries: name, entry, enlisted, kills, missions, awards, info.
- name is set by Lib_PAD.
- Contains entries: name, entry, enlisted, kills, missions, awards, info.
- GUILDS
- Category for other organisations which do have a membership.
- Contains entries: name, entry, enlisted, kills, missions, awards, info.
- name is set by Lib_PAD.
- Contains entries: name, entry, enlisted, kills, missions, awards, info.
- INFOS
- Category for special events, news, specific stations, etc.
- Contains entries: name, location, beacon, purpose, special, notes.
- LOGS
- Category for standard events like rescued escape pods, bailed out, fined, etc.
- Contains entries: list.
- PERSONS
- Category for characters you have met or you got infos about.
- Contains entries: name, origin, species, gender, age, rank, ship, info, notes.
- Players name, origin, species, gender, age, rank and ship are set by Lib_PAD.
- Contains entries: name, origin, species, gender, age, rank, ship, info, notes.
- SYSTEMS
- Category for special systems like Leesti, Tianve, Tionisla, etc.
- Contains entries: name, info, notes.
Types
- Number
- age, kills.
- String
- beacon, enlisted, entry, gender, location, name, origin, purpose, rank, ship, species.
- Array
- awards, info, list, missions, notes, special.
Textures
Specified textures can be any filename, but Lib_PAD also ships own textures for organisations, characters, insignia and medals. If set to a Number it will lookup the corresponding filename or if zero it won't show it.
- t0 - Usually an organisation on GALCOP, GUILDS and PERSONS pages. Lib_PAD uses greyscale textures.
- t1 - Usually a character on GALCOP, GUILDS and PERSONS pages.
- t2 - Usually an insignia / rank on GALCOP, GUILDS and PERSONS pages.
- t3 - Usually a medal on GALCOP, GUILDS and PERSONS pages.
- t4 - Unused yet.
- t5 - Unused yet.
The 250-odd textures (almost all are icons) tucked away inside Library.oxp include the following:
Methods
The following entry points for AddOns can be used on .startUpComplete or later.
_addPageInCategory
_addPageInCategory: function( path, content, parent, sil ) |
Register a new page entry in the specified dotted path. The inserted Object is cloned and merged with the corresponding template.
Parameters:
- path
- String. Dotted path: Category and page identifier. E.g. "GALCOP.NAVY".
- content
- Object.
- parent
- Array. Pathes to relate to one or more other pages.
- sil
- Bool. Add the page silently.
Returns:
- true (on success) or false (if the page already exists).
_setPageEntry
_setPageEntry: function( path, value, sil ) |
Set value in the specified dotted path.
Parameters:
- path
- String. Dotted path: Category, page identifier and page entry. E.g. "GALCOP.NAVY.enlisted".
- value
- Primitive (String or Number). If the path points to an Array the value will be pushed. For kills ++ can be used to increase the value by one.
- sil
- Bool. Add the value silently.
Returns:
- true (on success) or false (if the path does not exist).
_getData
_getData: function( path ) |
Returns the cloned data-object in the specified dotted path.
Parameters:
- path
- String. Dotted path: Category and page identifier. E.g. "GALCOP.NAVY".
Returns:
- Object (on success) or null (if the path does not exist).
Handling
Lib_PAD leaves the handling for loading and storing of inserted data to the inserting AddOns to avoid external resources like textures not being available and thus generating errors. It loads and stores it's own entries (pathes GALCOP.GENERIC, GALCOP.NAVY, GUILDS.GENERIC, INFOS.GENERIC, LOGS.GENERIC, PERSONS.GENERIC and SYSTEMS.GENERIC)
Loading and storing of data can be achieved easily, as shown in the following example.
this.$data = { GCI: {entry:clock.clockString,enlisted:"Sergeant",awards:["GCI Silver Cross"],t0:27,t1:1} }; this.startUpComplete = function(){ if(missionVariables.MYMISSIONVARIABLE) this.$data = JSON.parse(missionVariables.MYMISSIONVARIABLE); worldScripts.Lib_PAD._addPageInCategory("GALCOP.GCI",this.$data.GCI,0,1); }; this.playerWillSaveGame = function(){ this.$data.GCI = worldScripts.Lib_PAD._getData("GALCOP.GCI"); missionVariables.MYMISSIONVARIABLE = JSON.stringify(this.$data); };
Example
The following script works as a "script.js" in a specially created "Config" folder inside your "AddOns" folder:
this.startUpComplete = function() { worldScripts.Lib_PAD._addPageInCategory("SYSTEMS.Digebiti G1", {name:"Digebiti G1", info:[ "The sculpture and duelling pistols are famed exports", "Home to English aristocrats, Hats are de rigeur", "The feudal paradise of Digebiti is just south of GalCenter G1", "My home planet"] }) worldScripts.Lib_PAD._addPageInCategory("PERSONS.Prince-Elector Rupert XIX", {name: "Prince-Elector Rupert XIX", origin:"Digebiti G1",species:"Human colonial",gender:"Male",age:41,ship:"Royal Barque: HSHS Falkland",rank:"Prince",info:["He is worried about the commie agents of Inonri & Vetitice","This led to Rupert's eschewal of Tennis for Extreme Dominoes","He succeeded after his brother Desmond died playing Real Tennis","The Supreme Ruler of Digebiti (in Lesser Walsingham)"],t0:9,t1:"lib_ovc02.png",t2:0,t3:14})}) }
The following limits apply:
- no more than 64 characters in a line (the 65th does not fit on the line!)
- lines do not wrap and therefore must be individually specified
- no more than 4 lines in an array such as that for "info" - and they must be [bracketed] together - and, confusingly, these are displayed in reverse order!
- more than 4 lines will prevent the P.A.D. page loading
The "t0/t1/t2/t3" properties allow you to specify some additional images for the entry. For t0, t2 and t3, you can enter a number (see ranges below for each type) or an image name.
- t0 displays the organisation logo (1-31) (see the textures folder inside Library.oxp for files named "lib_pad_org*.png")
- t1 displays a mug shot (ditto - there are almost a hundred of these, excluding the player possibilities. Files named "lib_ovc*.png")
- t2 displays a rank logo (1-17) (ditto, files named "lib_pad_rank*.png")
- t3 displays a medal image (1-17) (ditto, files named "lib_pad_medal*.png")
Musings
This was only ever implemented for the Vanilla game missions - and for Galactic Navy. Other mission oxp's (eg RRS Group, Thargoid Wars, The Assassins Guild OXP, Resistance Commander, etc.) feature awards and ranks. These should be integrated with Lib PAD.
Links
- Library OXP
- Cabal Common Library OXP - forerunner of Library OXP
- Author: Svengali
- Library OXP logos and images (2023)
- Medals and awards? (2013)
- Player Logs in Elite: Dangerous (Elite: Dangerous - Design Decision Forum: 2013)