Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Scripters cove

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

Moderators: winston, another_commander

User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: Scripters cove

Post by szaumix »

another_commander wrote: Fri Apr 29, 2022 2:41 pm
If you must make modifications no matter what, the proper way to do it is to list installed oxps in the Expansion Manager, select the one you want and press "x" to extract it to the AddOns folder. It will be extracted with the ".off" extension. Change that to ".oxp" and you are good to go
Fabulous advice, thank you.

[SOLVED] (I'm retarded)
[EDIT: deleted]

So the only thing that helped was landing at a Cori? I am still figuring out when and where the game caches and computes from files. Anyway thanks for the answers.
Last edited by szaumix on Thu Dec 14, 2023 3:53 am, edited 1 time in total.
User avatar
Cmdr Wyvern
---- E L I T E ----
---- E L I T E ----
Posts: 1649
Joined: Tue Apr 11, 2006 1:47 am
Location: Somewhere in the great starry void

Re: Scripters cove

Post by Cmdr Wyvern »

"D*CKS*"...

Isn't that the height of maturity!

*facepalm heard around the chart*
Running Oolite buttery smooth & rock stable w/ tons of eyecandy oxps on:
ASUS Prime X370-A
Ryzen 5 1500X
16GB DDR4 3200MHZ
128GB NVMe M.2 SSD (Boot drive)
1TB Hybrid HDD (For software and games)
EVGA GTX-1070 SC
1080P Samsung large screen monitor
User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: Scripters cove

Post by szaumix »

Haha. Ever change a line of code and then forget what and where you changed it? Maddening. I've been using that same memory-word since GWBasic. It's immature but at least I never miss it. I highly recommend!
User avatar
Cmdr Wyvern
---- E L I T E ----
---- E L I T E ----
Posts: 1649
Joined: Tue Apr 11, 2006 1:47 am
Location: Somewhere in the great starry void

Re: Scripters cove

Post by Cmdr Wyvern »

szaum-ix wrote: Fri Apr 29, 2022 3:16 pm
Haha. Ever change a line of code and then forget what and where you changed it? Maddening. I've been using that same memory-word since GWBasic. It's immature but at least I never miss it. I highly recommend!
Well as long as we're going back to high school, a cargo contract for ya.

"Butts 100TC Time 24 hours"
Seriously gotta haul ass to make that dosh! :twisted: :lol:
Running Oolite buttery smooth & rock stable w/ tons of eyecandy oxps on:
ASUS Prime X370-A
Ryzen 5 1500X
16GB DDR4 3200MHZ
128GB NVMe M.2 SSD (Boot drive)
1TB Hybrid HDD (For software and games)
EVGA GTX-1070 SC
1080P Samsung large screen monitor
User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 526
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Scripters cove

Post by Nite Owl »

szaum-ix

Glad you got it working but there is a slight bit that may still not be right. You typed that you were placing the descriptions.plist in your AddOns folder. Are you placing it directly into that folder? While that may work it should ideally be in a sub-folder of AddOns named Config (...\Oolite\AddOns\Config). This AddOns\Config folder would hold all of the altered files that you might produce from the core files in the game's original Config folder structure (...\Oolite\oolite.app\Resources\Config).

If you do plan on doing a lot of TWEAKING then the advice from another_commander about editing your .GNUstepDefaults file to add the "always-flush-cache" = yes; option is invaluable. Your game loading time will increase but not having to remember to hold down a shift key after every major or minor code change is well worth it.

Marking up code that you have changed is important. Do what works best for you taking the following as only a suggestion.

Code: Select all

[YOUR NEW CODE] \\ TWEAK was - [ORIGINAL CODE]
\\ marks anything that follows on that line as a comment that will not be read as valid code in both .plist files and JavaScript files. The word TWEAK makes each change easily searchable.
Humor is the second most subjective thing on the planet

Brevity is the soul of wit and vulgarity is wit's downfall

Good Night and Good Luck - Read You Soon
User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: Scripters cove

Post by szaumix »

[deleted]

I am pleased to hear that filepath synchronization matters so thanks for that, and roger that re: cache flushing.
Last edited by szaumix on Thu Dec 14, 2023 3:55 am, edited 1 time in total.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16073
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Scripters cove

Post by Cody »

Nite Owl wrote: Fri Apr 29, 2022 6:45 pm
While that may work it should ideally be in a sub-folder of AddOns named Config (...\Oolite\AddOns\Config).
Very useful, that Config folder!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4726
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

szaum-ix wrote: Fri Apr 29, 2022 2:46 pm
So the only thing that helped was landing at a Cori? I am still figuring out when and where the game caches and computes from files.
All contracts are prebuild when you enter a new system. If you changed the descriptions.plist and then loaded a game and looked at the available contracts, none of them would have changed. Flying to a new system makes then refresh.
User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: Scripters cove

Post by szaumix »

QUESTION:
Would it be theoretically possible to make commodities in a given market for sale only? Always selling to you but never buying from you?
Basically a reverse Hoopy's?
EDIT: I realize it's probably possible. I was hoping for a plist hack advise rather than having to crunch the js. How complicated would this be?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4726
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

szaumix wrote: Sun May 08, 2022 7:15 am
Would it be theoretically possible to make commodities in a given market for sale only?
Possible, yes.
szaumix wrote: Sun May 08, 2022 7:15 am
was hoping for a plist hack advise rather than having to crunch the js. How complicated would this be?
It's a JS solution though. No easy way to disable player selling commodities via plists. I think the simplest way would be to use playerSoldCargo worldscript event and essentially reverse whatever cargo sales are made (ie returning cargo to the player, removing credits).
User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: Scripters cove

Post by szaumix »

Question to those more knowledgeable than myself:

I am toying with accuracy values with some success. I've checked the wiki on shipdata.plist and can't tell if there is a way to make values equal or greater than, equal or worse than. Is this a property list function?
User avatar
montana05
---- E L I T E ----
---- E L I T E ----
Posts: 1166
Joined: Mon May 30, 2016 3:54 am
Location: lurking in The Devils Triangle (G1)

Re: Scripters cove

Post by montana05 »

szaumix wrote: Fri Jun 03, 2022 6:04 am
Question to those more knowledgeable than myself:

I am toying with accuracy values with some success. I've checked the wiki on shipdata.plist and can't tell if there is a way to make values equal or greater than, equal or worse than. Is this a property list function?
You can use accuracy in js: https://wiki.alioth.net/index.php/Oolit ... p#accuracy

If you use a random number with a minimum and a maximum function like:

Code: Select all

this.$getRndInteger = function(min, max)
{
	return (Math.floor(Math.random() * (max - min + 1) ) + min);
};
you should get a result pretty close to what you desire.
Scars remind us where we've been. They don't have to dictate where we're going.
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 639
Joined: Sat Dec 04, 2021 11:01 pm

Re: Scripters cove

Post by Old Murgh »

I also have a question for those more knowledgeable than myself:

In trying to update the Missionaries.oxp, I've come to the suspicion that the legacy script script.plist is rendered nonfunctional in the current version of the game. I've been testing and using conditions set in a planetinfo.plist which works great for the system I'm doing the spawn tests in. But I was relying on the original oxp's ability to spawn the role missionary across all systems, and I can't see any sign on the logs that it's working. I suspect the only reason these ships appeared was because of their dual role as trader.. There is always the chance that some little error somewhere is the actual problem, but I would love to solve it with a javascript populator.

One example I have at hand is the hOopy populator, which it would be nice to simply modify to my needs.

Code: Select all

"
//add casino to system
this.systemWillPopulate = function (){
	// add in high tech level systems, but not in comunist systems. But, always in systems famous for their casinos.
	if (system.techLevel >= 10 && system.scrambledPseudoRandomNumber() > 0.55 && system.government != 4 || system.info.description.indexOf('hoopy casinos') > -1) {
		//no main station, no casinos.
		if (system.mainStation) {
			var coords = system.mainStation.position.subtract(system.mainStation.position.direction().multiply(50000));
			system.setPopulator("hoopy_casino", {
				callback: function(pos) {			
					system.addShips('casinoship', 1, pos);
				}.bind(this),
				location: "COORDINATES",
				coordinates: coords
			})
		}
	}
}
My needs are much simpler, just to establish a 90% chance that one or two ship with role missionary are spawned somewhere in the main lane. How much surgery would that require?
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4726
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Old Murgh wrote: Sat Jun 04, 2022 12:48 am
I also have a question for those more knowledgeable than myself:
Taking your sample code:

Code: Select all

this.systemWillPopulate = function (){
	// you would need to define what rules govern which systems your ships will spawn in.
	if (system.techLevel >= 10 && system.scrambledPseudoRandomNumber() > 0.55 && system.government != 4) {
		system.setPopulator("missionaries_ships", {
			callback: function(pos) {			
				system.addShips('role of desired ship', 1, pos); // use the missionaries ship role here
			}.bind(this),
			location: "LANE_WP",
			locationSeed: 0 // 0 = completely random position on the lane, otherwise use a specific seed number to have them in the same position each time
		});
	}
}
The only things you'd need to define is the rules which cover what systems to put your missionaries in (if there are any), and what the role will be of the ships.
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 639
Joined: Sat Dec 04, 2021 11:01 pm

Re: Scripters cove

Post by Old Murgh »

Thank you :D
phkb wrote: Sat Jun 04, 2022 3:45 am
The only things you'd need to define is the rules which cover what systems to put your missionaries in (if there are any), and what the role will be of the ships.
Well, for starters I wanted to have the role as common as trader or pirate, galaxy-wide (without "stealing" from the trader quota). They might not last long in an anarchy but they are crazy enough to try their luck anywhere. –I don't suppose there is any common seed word that justifies an increase of spiritual activity. For now, if the system description contains the word "is", then I'd like there to be a 90% chance of spawning a* missionary.

*Does asking the engine to randomly choose between 0, 1 or 2 spawns factor into this?
I was young, I was naïve. [EliteWiki] Jonny Cuba made me do it!
Post Reply