Library

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Cholmondely
Archivist
Archivist
Posts: 6015
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Library

Post by Cholmondely »

phkb wrote: Thu Apr 10, 2025 3:51 am
I've just pushed a small update to Library to live. It now includes reference checks for 1.91 keywords, and I've tweaked the way text is displayed in Library Config, making better use of the full screen width, and not cutting off "Info" text after 240 characters. Basically, you can get more text on the config pages.
Noble Sir!

This!!
Krager wrote: Tue May 06, 2025 10:49 am
...
Подскажите куда написать? Библиотека Svengali_Library_1.7.1 не показывает фото профиля в игре. Вышла её новая версия Svengali_Library_1.7.2. То же самое. Image
Translation: Tell me where to write? The Svengali_Library_1.7.1 library does not show the profile picture in the game. Its new version Svengali_Library_1.7.2 has been released. The same.


Krager wrote: Tue May 06, 2025 10:19 pm
Библиотека Svengali_Library, раздел P.A.D. Там не отображаются картинки, фото командира. Вышла новая версия библиотеки, но и в новой версии вместо картинок пустота. как сообщить автору об этом? Нет контактов для связи.
Translation: Library Svengali_Library, section P.A.D. Pictures and photos of the commander are not displayed there. A new version of the library has been released, but in the new version there is emptiness instead of pictures. How to inform the author about this? There are no contacts to contact.




Cholly's response: Svengali who wrote the original died some years ago. Phkb issued the Library.oxp update. He is found here. I'll repost this on the Library.oxp thread.

On my 5-year-old AppleMac, it seems to work just fine. I'm using Library_1.7.2 with Oolite v.1.90 and get this screen which functions for me. But then I've never tried using other (non-stock) portraits on my computer.
Image
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5099
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Library

Post by phkb »

Cholmondely wrote: Wed May 07, 2025 6:36 am
This!!
Interesting. I, too, don't have any issues in either 1.90 or 1.91.

Can you pass a question back? Can Krager start Oolite, start a new game, then go straight to the P.A.D., and then into "Player data". Then, end the game, and send the log file over in whatever way works best. I suspect there might be some errors in the log file that will prove to be helpful.
Krager
Competent
Competent
Posts: 38
Joined: Wed Dec 11, 2024 9:44 pm
Location: Russian

Re: Library

Post by Krager »

Версия OOlite 1.9
Запустил игру, вошёл в P.A.D.
Вышел через меню окончания игры.
Какой лог нужен не знаю, скинул всю папку.
Logs.zip
(36.53 KiB) Downloaded 8 times
Картинки стандартные, картинки стандартные. Вместо них пустые квадраты.
В версии 1.91 и чистой (без перевода) библиотекой то же самое.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5099
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Library

Post by phkb »

I can see an error from Library in the log:

Code: Select all

00:12:13.710 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (RUS_Lib_Cubecode 1): TypeError: worldScripts.Lib_Cubecode.$head is undefined
But that's not the name of the original code file -- that appears to be from (and I'm guessing here):

Code: Select all

    ../AddOns/LIBRARIES.OXP/RUS_Svengali_Library_Translation v1.oxz
There is a second error that appears to be related to Library:

Code: Select all

00:12:23.161 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (Lib_Music 1.7.2): TypeError: this.$radios is undefined
But again, that's not something I see happening on a plain install.

Can you post a copy of your "RUS_Svengali_Library_Translation v1.oxz" mod? Perhaps send it to me via a PM, and I can have a look at what might be going on.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5099
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Library

Post by phkb »

I've create a new version of Library with all text moved into missiontext.plist. I haven't put this into the manager though, as I feel it would be better to have a couple of people try it at least and report if there are any issues.
[edit: remove old link. see below]
With any luck, this version will be much easier to localise, but let me know.

And let me know if I missed any text items. I did kind of power through it so I might have missed a couple.
User avatar
Cholmondely
Archivist
Archivist
Posts: 6015
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Library

Post by Cholmondely »

Will try it out and report back. Sir Admiral, Sir!

While I think about it, one of the most useful things about Library.oxp for me is the memory of the previous GNN news flash (part of P.A.D.)

But.

Library only remembers the most recent news flash. It would be much more useful if it recalled many more (as communications log does!). I do understand that this will make our save-files resemble even more closely the US National Debt in size, but I feel the bloat would be for a worthy cause!
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5099
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Library

Post by phkb »

Cholmondely wrote: Sun May 18, 2025 12:39 am
Library only remembers the most recent news flash. It would be much more useful if it recalled many more (as communications log does!). I do understand that this will make our save-files resemble even more closely the US National Debt in size, but I feel the bloat would be for a worthy cause!
Should it additionally store when you viewed the item, or when the item was issued (given it can be a number of days/weeks/months before you get around to viewing it)?
User avatar
Cholmondely
Archivist
Archivist
Posts: 6015
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Library

Post by Cholmondely »

phkb wrote: Sun May 18, 2025 1:18 am
Should it additionally store when you viewed the item, or when the item was issued (given it can be a number of days/weeks/months before you get around to viewing it)?
I'm not sure that the date I last viewed it has any significance. But the date of the newsflash could be very significant.

Not having done very many missions, there could conceiveably be something about the date of viewing about which I'm unaware.



By the way, Phkb, I saw on Roolite a review of Vector.oxp implying that it works just fine with post v.1.77.1 Oolite! Reading more closely, the ship - yes! The mission, uncertain.
Vector

Missions (Миссии)
OXP/OXZ
Ships (Корабли)

In-game OXZ

Не смотря на то, что на странице пакета есть пометка, что данный OXP/OXZ не совместим с текущей версией игры, все в порядке. Пакет ставится из внутриигрового менеджера и добавляет прекрасный корабль «Вектор». Прекрасный в визуальном плане. Для игрока он не очень удобен. Это что-то вроде спорт-кара. И к этому всему дается какая-то «необычная» миссия, подробности которой неясны.

Edited to add: just had another stab at your Oolite.1.90.a.try - Library.oxp seemed just fine.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5099
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Library

Post by phkb »

phkb wrote: Thu May 15, 2025 11:58 am
I can see an error from Library in the log:

Code: Select all

00:12:13.710 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (RUS_Lib_Cubecode 1): TypeError: worldScripts.Lib_Cubecode.$head is undefined
But that's not the name of the original code file -- that appears to be from (and I'm guessing here):

Code: Select all

    ../AddOns/LIBRARIES.OXP/RUS_Svengali_Library_Translation v1.oxz
There is a second error that appears to be related to Library:

Code: Select all

00:12:23.161 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (Lib_Music 1.7.2): TypeError: this.$radios is undefined
But again, that's not something I see happening on a plain install.

Can you post a copy of your "RUS_Svengali_Library_Translation v1.oxz" mod? Perhaps send it to me via a PM, and I can have a look at what might be going on.
I've had a look at the code in RUS_Library.oxz, and the errors I see are to do with timing and sequencing. Code in RUS_Library is making changes to Library in the startUp event. However, depending on what scripts get loaded first, errors will occur (which is what I'm seeing with those two errors I noted). If RUS_Library tries to change code in Library before Library has been able to establish itself, you get those errors. The easiest fix would be to change RUS_Library to use "startUpComplete", rather than "startUp". That way, Library should be finished setting itself up and RUS_Library can come in can update text as required.

I'd be interested in hearing whether the changes I made in 1.8 make the process easier and whether any of the extra code segments are required at all.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5099
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Library

Post by phkb »

Did some more work on Library, trying to make sure all text can be easily changed for localisation. And while I have deep respect for everything Svengali achieved with Library and Oolite in general, he did make things kind of hard to work with.

The particular issue I'm trying to work around is the double function of a key as (obviously) a key, but also as display text. What do I mean?

Take this example. Library stores information in various buckets. There's the GALCOP bucket, the GUILDS bucket, the SYSTEMS bucket and so on. Other OXP's can add to those buckets with their own information.

But the GALCOP bucket has a couple of sub buckets: GENERIC (which all the buckets have), and "NAVY".

The trouble is, "NAVY" is both the key to access that sub-bucket, as well as the text that is displayed when you go into the PAD in Oolite. That's tricky, because in order to localise it, it's better if the key and text are separate.

Not sure if I can solve this one today. Might have to sleep on that one. But I did work out how to get the PAD to store and redisplay all the news items you receive. So a little win for the day.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5099
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Library

Post by phkb »

OK, here's what I've got:
Revamped GNN: GNN_1.3.oxz
Revamped Library: Library_1.8.2.oxz
(Edit to update to 1.8.2)

If you use GNN, you'll need both files.

In this update, news items from GNN will be saved in Library PAD. When you open the PAD, it will have a new item, "News History", and you can scroll through all the news items you've actually viewed - but not the news items you've received but haven't viewed yet. The time stamp of when you viewed them is saved with the item.

You can set how much history you want to keep in the GNN settings in Library Config. In the "Show Values" section, there is a new value, "News History Retain". By default this is set to -1, which means all news items will be kept. Setting this to 0 would mean storing no news items. Setting it to 5 would keep the last 5 news items, 10 would keep the last 10, and so on.

For developers, I've also added a new key to the data you send to Library PAD. The "content" object you send to the PAD via _addPageInCategory has an additional key: "keyDisplay". This is an optional key, and if you don't make any changes, nothing will be changed.

To make use of this, here is an example. Say, for instance, you wanted to add a new entity to the "INFOS" category. You might have previously set it up like this:

Code: Select all

worldScripts.Lib_PAD._addPageInCategory("INFOS.GSE",
	{ 
		name: "Galactic Stock Exchange", 
		location: "Ustiza (G8)", 
		beacon: "None", 
		purpose: "", 
		special: [], 
		notes: [], 
		t0: 0, t1: 0, t2: 0, t3: 0, t4: 0, t5: 0
	},
	0, true);
This this instance, the key entered in the path (ie "GSE") will be used in any display.
Image

But by changing it to this:

Code: Select all

worldScripts.Lib_PAD._addPageInCategory("INFOS.GSE", 
	{ 
		keyDisplay: "G.S.E.", 
		name: "Galactic Stock Exchange", 
		location: "Ustiza (G8)", 
		beacon: "None", 
		purpose: "", 
		special: [], 
		notes: [], 
		t0: 0, t1: 0, t2: 0, t3: 0, t4: 0, t5: 0 
	}, 
	0, true);
Now, "G.S.E." will be displayed in the title bar when viewing the item:
Image

Hopefully that should make everything in Library much easier to localise.
Simba
Above Average
Above Average
Posts: 27
Joined: Fri Aug 30, 2024 7:58 pm

Re: Library

Post by Simba »

phkb wrote: Mon May 19, 2025 2:50 am
Hopefully that should make everything in Library much easier to localise.
Yeah, that's it!
There are some missing spots:
1) in Lib_Config.js:
- in the $defCHC property
- in the shipDockedWithStation and _showStart methods
2) in Lib_PAD.js:
- In the _addInterface method (the string “P.A.D.”)
- in the _pSearch method (the string “Back”)
3) in Lib_Starmap.js in the _start method
4) in Lib_PAD_Events.js in the playerCompletedContract method, it was previously assumed that the text would depend on the result variable. I would try to keep this behavior by creating separate strings for each option:

Code: Select all

var prefix;

switch(result) {
	case "success":
		prefix = expandMissionText("LIB_EVENT_CONTRACT_ARRIVE");
		break;
	case "failed":
		prefix = expandMissionText("LIB_EVENT_CONTRACT_FAILED");
		break;
	case "short":
		prefix = expandMissionText("LIB_EVENT_CONTRACT_SHORT");
		break;
	default:
		prefix = expandMissionText("LIB_EVENT_CONTRACT_LATE");
}

f = formatCredits(fee / 10, 1);

switch (type) {
	case "passenger":
		txt = expandMissionText("LIB_EVENT_CONTRACT_PSNGR_FEE", { prefix: prefix, name: contract.name, fee: f });
		break;
	case "parcel":
		txt = expandMissionText("LIB_EVENT_CONTRACT_FEE", { prefix: prefix, fee: f, name: contract.name });
		break;
	case "cargo":
		txt = expandMissionText("LIB_EVENT_CONTRACT_FEE", { prefix: prefix, fee: f, name: contract.cargo_description });
		break;
}
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5099
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Library

Post by phkb »

Simba wrote: Wed May 21, 2025 6:59 pm
I would try to keep this behavior by creating separate strings for each option:
That code only applies where a fee has been paid out to the player. For that to happen, the result can never be "failed". So I've left that result check out.

Otherwise, good catches! New version on the way.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5099
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Library

Post by phkb »

There are still instances where Lib PAD *really* wants to show you keys. In the related info, specifically.

Here's an example:
Image

So my solution to only add a display for the second part of each of those keys was not as effective as I'd hoped. I still need a way to hide all those keys and show something from missiontext instead.

Hmm. Will need to think some more about this one.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5099
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Library

Post by phkb »

I think I've nutted it out. Some more tests over the next few days, and we might have an official release.
Post Reply