Scripters cove

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

Moderators: another_commander, winston

User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 779
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: Scripters cove

Post by Lone_Wolf »

Cholmondely wrote: Mon Nov 17, 2025 12:05 am
Aegidian distinguished between the player ship's shields and the NPCs' lack of them because the NPCs lacked damageable equipment and he was trying to level the playing field.
I wish he had tried to implement adding/removing/damaging equipment and proper shields to npcs .It would probably have been an enormous task though.



[quote=phkb wrote: Sun Nov 16, 2025 9:57 pm
Do you need to access these properties? It depends. NPC's don't have shields per-se - they have a boosted max energy amount to simulate shields. For an NPC implementation of your emergency shields mod, you could just add to the energy property of the ship. That way, you don't need to worry about what N-Shields is doing.
I use those properties to determine 2 things :
- Is this the right time to use the emergency shield
- how much is half of its max shield strength

Those require me to figure out what the gamecode adds to npcs for the 3 types of shields and their current strength. Should be doable by delving into the code and existing documentation .

Apart from that I need to determine which npcs get it and which don't . If I take the easy route and just give it to all npcs the game will become much harder - not my intention.

Using a weighted random approach where shield strength / recharge rate / speed determine the weight might work.
(For adding additional emergency shields cargo space would be used)

Handling only ships that are attacking player feels wrong, I'd probably have to interfere at the npc spawning level.
OS : Arch Linux 64-bit - rolling release

From: The Netherlands, Europe

OXPs : My user page (needs updating)

Retired, occasionally active
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 779
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Re: Scripters cove

Post by Lone_Wolf »

In KicheEmergencyShields I need to use equipmentStatus in the multiple format in 2 internal functions.

I now use a var to create the needed object in those functions like this :

Code: Select all

var _eqinfo =
		{ 
			amount_ok :0 ,
			amount_damaged:0
		}
One of those functions however is ShipTakingDamage which fires rather often.
Would using a this. object in the body of the script instead of a var in a function have measurable performance benefits ?
OS : Arch Linux 64-bit - rolling release

From: The Netherlands, Europe

OXPs : My user page (needs updating)

Retired, occasionally active
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5587
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Lone_Wolf wrote: Mon Nov 24, 2025 2:54 pm
Would using a this. object in the body of the script instead of a var in a function have measurable performance benefits ?
Yes, referencing "this.{some object}" in a script is much slower than using a local variable. cag does an excellent job of explaining a lot of performance techniques in the "OXP Performance tips" thread.
User avatar
Cholmondely
Archivist
Archivist
Posts: 6545
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Scripters cove

Post by Cholmondely »

Image

I'm still musing about adding in [EliteWiki] Hints about other OXPs.


Eg. tips about profitable deals in the SLAPU/CZGF markets in Commies, or winning duels in Feudal States, or finding bases in Jaguar Company et cetera.



I'd originally thought of checking to see if the other OXPs were loaded, and then add in the extra hints from within Hints.oxp as relevant. But on reflection, this might be rather clunky. It also divorces the OXP-based hints from the relevant OXP - this seems to me to make the updating of these new hints less likely if something relevant changed within that OXP itself. Or might there be an even better way of adding in OXP-relevant hints?


Is there any way of including these in some sort of text file in those other OXPs which could then be "added in" with those in the Vanilla-game-based Hints OXP, giving a larger collection of Hints to be drawn from?



I'd need the code which would do this inside the Hints.oxp - and the code for the inside of the other OXPs if necessary.

I should mention that my attempts to work out the code for adding GNN newsflashes went nowhere as I failed to understand the instructions about how to do it.







Oh! And what about OXPs which clobber vanilla game hints - such as Hard Way making sunskimming irrelevant?

Might a solution be replacing the vanilla game hints inside Hints OXP with a curated selection inside Hard Way OXP instead? Would this be doable? And what about two vanilla-game-conflicting OXPs?
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: 5587
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Cholmondely wrote: Wed Jan 21, 2026 12:11 pm
I'd need the code which would do this inside the Hints.oxp - and the code for the inside of the other OXPs if necessary.
You could easily make Hints as customisable as you want. At the moment, the hint displayed is a random one from an array in descriptions.plist. The downside of using this method is that you can't easily edit the items in the array, either adding or removing them.

However, if you move the array into the JavaScript file, then items can easily be added into the array, or removed.

The code changes aren't that significant, either. In "Hints_Station_Bar.js", add this immediately after the "use strict"; line

Code: Select all

"use strict"; // this is the existing line in the code

this.hints_bar_gossip = [
    //Trade	
    "Bulbous batrachian in flight-suit: 'So what did you do after you graduated from Lave?'\n\n{color:redColor}Orange avian with spectacles and cap: 'Well I found a really good milk-run, Isinor to Qutiri. Both full of water - Isinor is liquid, Qutiri is solid. I made so much money I was able to buy up military lasers for both front and rear.'",
    "'Ensoreus to Ararus is a top notch milk run!'\n\n{color:redColor}'No, no, Xexedi to Laenin is better - Laenin is much safer then Ararus.",

    "Burly black feline speaking to a young tailed humanoid: 'Flying a cobra? Well, the Cargo Bay Expansion will help you almost double your profits! Just make sure you save up enough money both to buy it - and to fill it once you have bought it!' ",
    
    "You can get some really good deals at Rock Hermits if you can find them. The real mining hermits sell radioactives, minerals, gold, platinum and gems at super discounts. They don't buy much - just food and drink and occasional bits of machinery, but if you can load up on cheap platinum, you can then offload it later in much better markets.",
    "Buying fuel and equipment at Rock Hermits is jolly expensive - d'ye know they charge three times the going rate?",
    
    "There is just one problem with using docking computers. They can add up to twenty minutes to docking. Usually it doesn't matter, but if you are running a contract, it might just sink you.",
    "I've never really found that those passenger contracts pay all that much. They give you a nice excuse to travel, but cargo contracts usually end up paying much better",
    "Short woman bedecked in sparkling jewellery speaking to a large yellow rodent: 'I got rich doing parcel couriers and adding in the fur-computer swap between rich industrial and poor ag's on the way. One tip though, make sure you have fuel injectors added on, and also use the shortest route mode on the chart to help you plan your route. The reason for that being, ideally, you want at least a third a tank of fuel whenever you jump to a new system in case of an over-the-top ambush. If you do multiple contracts at once you will soon see what I mean.' ",

    "'Have you heard? That Cody chap got paid well over seventy thousand credits for delivering a parcel contract over in Galaxy Seven?'\n\n{color:redColor}'Yes, but a third of that was a bonus for early fulfillment'\n\n{color:yellowColor}'It's still a lot of moolah for a small parcel'\n\n{color:redColor}'But he will have spent years developing the reputation to get those sorts of contracts'",
    "So I took one of those contracted deliveries. Lots of dosh for a long way to go. Blow me if the maintenance bills didn't take almost every penny I'd made... And if I had the maintenance done en-route - which would have been cheaper - I'd have fluffed the contract",
    "If you're flying contracts, time is of the essence. You do know that lots of short hops take less time than the long hops, don't you? Just make sure that your maintenance is up-to-date before you do too many hops though!",

    //Equipment
    "The very first thing I did when I got my new Cobra was shift the laser. I moved it from the front to the back. I'm useless at combat, and at least that way I can take pot shots at the pirates while I'm fleeing them.",
    "Large blue insect at a table of other insects: 'Fuel. That stuff's so cheap that even when they're charging triple it's a bargain. Most folks know that it powers their injectors and limits their trade routes but it's also your ticket to get the hell out of trouble. Always a good idea to prep an escape route. Short jumps if you can. It's what you've got left in the tank, not left in the bank that will save you when you're out there.' ",
    "Did you know you can hitch a ride through someone else's wormhole? Gives you much more options when you arrive... Of course, given that you might not know where the hell that is until you get there you might want to use one of them pretty quick too.",
    "If you are going to get maintenance done, go to the highest TL system in the area - the maintenance will last much longer - and does not cost a penny more!",
    "Old Johnny never made it to Zaonce. He left at Lave sure enough but at Zaonce witchpoint beacon, no sign of him... Some say it's the (lowers voice) 'Thargoids', say they can pull you right out of witchspace, or into witchspace depending on your point of view... Johnny never was one for keeping his ship maintenance up to date though, or for staying focused once he started a jump sequence...",
    "So when I found my milk-run and started earning serious money, I started spending on my ship. What did I buy? Well, the first most crucial pieces of equipment are either fuel injectors - for avoiding trouble - or an enlarged cargo hold for earning more dosh. Your choice as to which makes more sense.",
    "Bearded chap with a red spear logo on his jump suit: 'Oh sure, injectors are cool and all, a good investment for sure but they wouldn't be my first choice... See, when you've only got one piece of fancy-pantsy equipment on your boat then there's only one thing that's gonna get damaged, right? Repairing it is a good deal cheaper than buying a new one but you might end up wishing you'd invested in something a little more reliable... especially as it's useless when you're out of gas. My choice? A beam laser. Very reliable, a huge upgrade from the pulse and tough as old space boots. I've yet to hear of one breaking down... Just watch your fire kid, that thing shoots so fast you can overheat it before you've landed a single hit. But aim first, get a good bead and it'll soon be paying for itself in bounties.'",
    "The best way to use a military laser is as a one-shot gun. Wait until the hoodlums are in your sights and fire one shot. then do it again... that way you don't overheat the darned thing.",
    "I found that the Extra Energy Unit made a massive difference when I got nobbled by the pirates. The improved recharge of my shields meant I was able to survive and get away with my cargo intact.",
    "Shields are complicated bits of kit. There are two things you can do to improve them - either increase the rate of recharge, or increase their overall strength. Those Extra Energy Unit does one, the Shield Boosters do the other. And the Military Shield Enhancer does both!",
    "Those naval energy units are really good which is why they are worth a fortune. If you're not in cahoots with the navy, the only way to get one usually is to buy a second-hand ship which already has one... and, boy, do they bump the price up!",
    "Red feline speaking to a larger blue one: 'The Multi-Targeting System only makes sense if you set up your targets in advance, before you get into combat. Otherwise it's just a waste of time and money. All it does is allow you set up different targets for your different missiles. How many people are really going to need something like that?'",
    "It's also a really good idea to get good at combat against multiple targets at once.  Get the shield boosters and extra energy unit. An ECM unit is mandatory. Once you can afford it, you'll want the military shield boosters as well. When you are targeted and you either don't want to or can't run away, get close to them quickly so they furball around you.  As long as you don't fly straight they have a very hard time hitting you.  Only ever fly straight while you are firing your laser, and only fire when you are 100%% on target.",

    //Pirate Tactics
    "So you got scragged by the pirates again? You never learn, do you? When you arrive at the Witchpoint beacon turn ninety degrees or one-eighty degrees and scarper like billy-oh! Get out of there, and head away from the planet. You might meet the odd pirate or bounty hunter in the nastier systems, but there will be more empty space around and you should be able to flee - you do remember how to use your injectors, no? When you're ten seconds or so away, then turn and head towards the station, but not directly. That way you should easily avoid the pug-uglies. No mass-locks. No pirates. And don't cross the space-lane, whatever you do!",
    "I just arrived at the witchpoint and found myself surrounded by some half-dozen pirates. I always carry some spare TC's of food. I whizzed away from them, dropped a half-dozen and then turned 90 degrees and scrammed again. I got away - and had my the rest of my load of furs which I then off-loaded at the orbital for a good profit.",

    //Thargoid Tactics
    "'So what's best? Clobber the Thargoids first - or go after the robot thargons?'\n\n{color:redColor}'Well, it depends... If you are good enough to polish off the 'goids quickly, then the robots deactivate and you can just scoop them up for a profit. If not, they will be reactivated the moment another 'goid gets close. Oh! ...you usually get more dosh for the thargons in agricultural economies'",
    "If you're gonna ram something, probably not a good idea to ram at injector speeds! Whenever my cargo is full and I come across a 'goid warship and end up with a bunch of unpowered fighters, I've found it's fastest to just ram them at full (non-injector) speed to kill them and pick up the 50 credit bounty. Costs like a few units of shield, which are regenerated within moments. If you ram one while at full injector speed you lose your whole shield, and that's with both the shield boosters and the military shield enhancement!",

    //Combat Tactics
    "It's all done with corkscrews. Move towards them in a corkscrew! Especially if you vary your speed, you'll find that they can't draw a bead on you and you can get in real close and then marmalise them.  And if you need to scram, and have the speed, corkscrew!",
    "So there I was, surrounded by pirates. I hit the fuel injectors and whizzed over towards the sun. Only a couple of them were fast enough to follow, and the sun blinded them, so I was able to pick them off with my rear laser - I could see them, but they couldn't see me",
    "Members of hit squads also tend to inject away when they get low on energy. Get good at sniping so you can kill them while they are running away. They'll be back in a minute after they've regenerated otherwise. They're cowards who refuse to meet their end with dignity, and it's entertaining to watch them beg for their lives.",
    "Missiles are a waste of time unless you are only facing one or two opponents. The moment you are in a fight with half a dozen pirates, one of them is bound to have an ECM, and your missiles end up being as useful as confetti.",
    "If you fire a missile when you are right up in front of a pirate, he'll never have a chance to ECM it - just make sure he doesn't do the same to you!",
    "As far as missiles, it's up to preference. I've found that either the regular or ECM types realistically have a chance of a kill only against pirates. Against the hit squads, you can expect them to have injectors to outrun your missiles as well as an ECM. The only thing missiles are good for against them is to get them off your back for a while.",
    "You could also start with quirium cascade mines, just make sure you don't launch them with vipers in range or you'll end up a fugitive potentially instantly. All your kills are recorded, remember?",
    "For Giles's sake, whatever you do, don't use a Q-bomb unless you have fuel injectors and enough fuel left to scram! Far too many people get caught by their own Quirium bombs!",
    "Those Quirium cascade bombs are most effective when detonated in an asteroid field. They zap the asteroids which then contribute to the effect. If you explode one in a dense enough asteroid field, then the whole shebang will exceed your scanner range and can last over a minute. Just make sure that you don't get caught in it yourself!",
    "'Get lasers on your port and starboard sides. They come in very handy against ships that show you a generous amount of profile while flying next to you like the fer-de-lance, asp, and both types of cobra.'\n\n{color:redColor}'But how do I use the wretched things?'\n\n{color:yellow}'Just remember that you will be steering up and down with roll instead of pitch while looking to either side of your ship.'",
    "The best way to use a military laser is as a one-shot gun. Wait until the hoodlums are in your sights and fire one shot. then do it again... that way you don't overheat the darned thing.",
    "So there I was, surrounded by pirates on all sides. I took out my Wheel of Destiny, invoked Saint Giles, kissed my Knucklebones of Negation and threw my throttle into full speed. With a slight corkscrew on my trajectory, I escaped. I've always tithed to the Church ever since.",
    "He was an idiot! An idiot, I tell you! He arrived at the witchpoint and was mobbed by pirates. But then, instead of fleeing, instead of handing over some canisters of cargo, the idiot fought! One against four, with just a pathetic pulse laser. He lasted thirty seconds. They shouldn't let those idiots leave kindergarten!",
    "So she arrived at Riedquat, and met the usual piratical welcome. She turned to escape and one of them - a mamba - was blocking her. She rammed it - mowed it down. Wouldn't have worked on a bigger ship - or if she had been flying an adder. But she totally squashed that mamba… and then made a fortune in the markets at Riedquat.",
    "ECMs do work against hard heads, you know! It's just not very likely. I was out at Ensoreus a year ago and saw a Viper fire one at a pirate. The pirate turned and ran, but the hardhead was gaining... he hit his ECM so many times he turned himself into a fuzz-ball - but! On the fourth try he got it!\nI was speaking with one of the mechanics - apparently the ECMs work by ion-saturation theory which has something to do with expanding nuclear flux-chains. Whatever. The point is that each time you hit the button, they emit three pulses of 'counter-measures' - each has a chance of clobbering the missile.",

    //Other advice
    "... anyway, as the jump countdown hit one, some nutter in a Ferdie ran right across my bow. I pulled up hard on the 'stick to avoid the bastard... next thing I know, the bloody klaxon's wailing, and I'm in ghastly glowing green interstellar space surrounded by 'goids!",
    "Young frog to older couple: 'So, Uncle Ferdie, tell me about Rock Hermits! Jerry told me that there two things to remember - that they are usually off the beaten path, but that they are usually massive and can be seen from a distance'\n{color:greenColor}Older frog with gold monocle: 'Well, almost every system has at least one if not several. And they differ. Some sit on one of the space lanes, others not. Some are dangerous to approach - surrounded or guarded by pirates, others are just harmless miners.'\n{color:yellowColor}Young frog: 'My chum Switeck told me that you find them by looking for the movement of a distant point-of-light while whizzing around on torus and then you can initially spot them or other large stations'\n{color:greenColor}Older frog with monocle: 'If you see a ship heading away from the spacelane, it's probably en route to a rock hermit.'\n{color:redColor}Older frog with yellow cap: 'Some folk say they have a secret network, and control the black markets.'\n{color:yellowColor}Young frog: 'Those must be the pirate-infested ones then'\n{color:redColor}Older frog with yellow cap: 'I never heard that, but it seems a good guess...'",
    "No! Really? He didn't bother to put his weapons on safe before docking?\n\nNo wonder the cops attacked him - he must have fired his lasers at something while docking! All he needed to do was to press the _ underscore key on his astrogation board. What an utter chump!",

    //Flavour text
    "Success in combat needs a lot of preparation. Personally, I meditate every morning and then take a bubblebath. I find that that makes all the difference.",
    "Have you heard that guy's story about parallel universes connected via a nexus? I mean, which intelligent being would believe there is more than eight galaxies. Eight! What a smeghead!",
    "'Looking for advice? Well, folks are gonna tell you all kinds of stuff but most of it's only half-true.'\n\n{color:redColor}'I mean half-true is something, right?...'\n\n{color:yellowColor} 'What I'm trying to say is when you hear that, 'the best thing for so and so is X', or that, 'you really oughta be doing Y', you might just want to remember what I tell 'em...'\n\n{color:redColor}'Yeah, well, you know, that's just, like, your opinion, frog'.",
    "Small green avian: 'Oh Dad, I'm so confused!'\n\n{color:greenColor}Large green avian: 'You just have to decide what kind of a creature you want to grow up to be, Gork; because whoever that creature is, a trader, a bounty hunter, a cargo contractor, a damn pirate or even a hermit... Just follow your path. This is the way things are. You can't change nature.'\n\n{color:yellowColor}'But change is nature, Dad. The part that we can influence. And it starts when we decide!'\n\n{color:greenColor}Scratches head: 'Now you're confusing me, son'",
    "Chap in yellow jump suit with tattoos at table of women: 'Ever been to Digebiti? They are utter nuts over there! Into this wacky sport called extreme dominoes - which are bigger than you are. They sit on balconies telling their staff down below to throw these things at each other... You have to see it to believe it!'",
    "Ceesxe is the leading centre for rejuve. I met a frog who was almost five hundred years old... he'd had five doses and looked as good as you or I. They say that it costs a pretty packet, though.",
    "...they say there is some sort of secret naval base around Xeer. Doing research, new ships and weapons, that sort of thing. I bet you some of their kit has to be pretty good...",
    "My daughter picked me up one of those Tionislan masks. I don't see how they can wear them all the time... they are so uncomfortable",
    "Went to the opera last night. All about a black cat who lived in Qutiri yonks ago. Apparently she had to flee for the hills as all the others were turning themselves yellow! But stuck out like a sore thumb as she was black and the ice and snow were not. The tenor was top-notch...",
    "When I visited Zarece, I was pottering around in one of the markets in a cloud city looking at some pots and minding my own business, when all of a sudden there was a riot! A bunch of lobsters hurtled past with an entire horde of rather fierce felines chasing after them. A lot of screeching, shouting and yelling. Most unseemly!",
    "A decent cup of tea. That's all you need to really succeed at docking. Either a really good Fragrant Broken Orange Pekoe - or a decent tarry Lapsang Souchong.",
    "This beer is utter bilge. I could do with a decent glass of wine. A Rexebian Richebourg or a Gequrian Cannubi.",
    "Smallish green bespectacled rodent at a table of frogs: 'So, I've been reading Saint Phibo Nacci's book on Theological Arithmetics. Have you ever looked at it? It is quite something. There is an entire section analysing the colours of the loincloths of the demons who clobbered Ebortsa! Somehow it ties in with the underlying structure of the galaxy. But don't ask me how!' ",
    "The 'music' is so loud that you can't even hear yourself think, nevermind hear what anybody else has to say!",
    "You are evicted from the bar for not wearing a cravat",
];
Essentially, I just took the "hints_bar_gossip" item from descriptions.plist, added "this." to the front of it, and changed the "(" and ")" to "[" and "]".

Then, find the "showBar" function, and change this:

Code: Select all

var text = expandDescription("[hints_bar_gossip]");
to this:

Code: Select all

var text = hints_bar_gossip[Math.floor(Math.random() * hints_bar_gossip.length)];
And that's it. You're now ready to start adding/removing hints based on OXP's.

To add a hint related to an OXP, in your "startUpComplete" function, add something like this:

Code: Select all

    if (worldScripts.ShipConfiguration_Core) {
        this.hints_bar_gossip.push("You've got to be careful how much equipment you install. The extra weight will slow your ship down so it handles like a lumbering Anaconda.");
    }
To add another hint for the same OXP, you can do this:

Code: Select all

    if (worldScripts.ShipConfiguration_Core) {
        this.hints_bar_gossip.push("You've got to be careful how much equipment you install. The extra weight will slow your ship down so it handles like a lumbering Anaconda.");
        this.hints_bar_gossip.push("Only part of your hold can be converted into equipment space, so you've got to be careful what you install.");
        this.hints_bar_gossip.push("If you're sunskimming, don't try using your injectors! You'll heat up super fast.");
    }
I'll reply separately about the GNN new items.

Edit: Sorry, I forgot to add the method to remove an item. The important thing to work out is the index of the element in the array we want to delete. Basically, count the number of entries from the top of the array. If you want to delete the 10th item, you'd put this into startUpComplete:

Code: Select all

this.hints_bar_gossip.splice(9, 1);
The 10th item would have an index of 9, because array elements start at 0.
To put this into practice, removing an entry based on the presence of an OXP, you'd do this in startUpComplete:

Code: Select all

    if (worldScripts.AstroLibrary) this.hints_bar_gossip.splice(9, 1);
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5587
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Cholmondely wrote: Wed Jan 21, 2026 12:11 pm
I should mention that my attempts to work out the code for adding GNN newsflashes went nowhere as I failed to understand the instructions about how to do it.
Here's the code to get your GNN new items displayed in game.
First, in your "world-scripts.plist" file, change it to this:

Code: Select all

(
	"Hints_Station_Bar.js",
	"Hints_GNN.js"
)
Then in the "Hints_GNN.js" file, change all the code to this (a straight copy/paste):

Code: Select all

"use strict";

this.name = "Hints_GNN.js";
this.author = "Cholmondely";
this.copyright = "(C) 2022 Cholmondely";
this.licence = "CC-NC-by-SA 4.0";
this.description = "Adds news items to GNN";
this.version = "0.1.0";

this.Hints_GNN_News = [
	// first element is how many jumps to wait before displaying the new item.
	// second element is which news service to use (1 - 4)
	// third element is the news item itself
	[5, 1, "Usge Ceanal has just attained Elite status according to a press release from the Elite Federation. In an interview, Ceanal said that he was an advocate of the Barkanion Bounce (named after the renowned Lave Academician) - swirling in loops towards his opposition whilst varying his speed. This tactic enables a trouble-free approach to one's targets, and accounted for many hundreds of his kills."],
	[10, 1, "A pirate-infested Rock Hermit has just been destroyed by a police viper-squad in the rodent-ridden anarchy of Riedquat. A centre for the local slave and narcotics trade, it has finally been shut down, allowing much safer travel in the Old Worlds sector! “The pirate plague has finally been eliminated” claimed the courageous Commander Reed Spar of GalCop, \"the Old Worlds are now as safe as a parentally-patrolled paddling pool!\"."],
	[10, 1, "Reports are just coming in about Orit Ceedthse, an Ensorean trader was murdered at Ararus yesterday by marauding pirates. It turns out that the feline was phenomenally rich, due to trading in furs and computers between Ensoreus and Ararus. Was she killed for his cargo, her money or for more murky misdemeanours? Truth is, we don't know!"],
	[10, 1, "A quirium cascade bomb has been detonated at Qubeen. It caught some 27 ships and a rock hermit as well as the launcher of the bomb, a rodent from nearby Maesin. Inquiries are ongoing into the exact cause of the incident. GalCop is offering handsome rewards for relevant information."],
	[10, 1, "Murgh the Munificent, the Metropolitan of Maduro, in the Middle Oceans of Aronar, has been promoted to be the Sectoral Sacerdote for the Church of Giles the Creator. A devotee of fine wines, he is rumoured to have crepuscular connections in the ship-building industry as well as having links to the \"Cuban Cohort\", a mysterious group of musical mayhem-makers. He has for some time been threatening to lead a crusade against the Witchspace Lobster Worshippers. Watch this space!"],
	[15, 1, "Arquebus the Audacious, the master trader, has finally come a cropper! After years of amassing a fortune trading in furs and computers, he took a time-sensitive contract to deliver wodgets to Ceesxe. Forgetting that fewer long jumps take much more time than many more smaller jumps, he arrived several days too late - and lost well over thirty thousand credits as a result! He is rumoured to have sold his ship in disgust and retired to a life of farming trumbles!"],
	[12, 1, "Archimandrite Di Joner of Digebiti has just published a new commentary on the treatise on Theological Arithmetics by Saint Phibo Nacci. Combined with an earlier analysis of the mystical fourth codicil of the Codex of Giles the Creator, Di Joner claims to prove that the ooniverse was designed through random purposefulness, and show the numerical underpinnings of all that exists. Copies of his masterpiece have been selling like hotcakes! But does anybody actually understand it? Truth is, we don't know - and neither does anyone else!"],
	[10, 1, "Police vipers at Diso have fought off another incursion of some several dozen pirates from the local anarchies, Uszaa and Reidquat. The President of Diso has appealed to GalCop for more help in stabilising the local region."],
	[12, 1, "The number of pirates armed with Electronic Counter Measures is increasing. Arch-Chandler RedSpear of GalCop's weapons research laboratory at Ceesxe has confirmed that more and more pirates are now using ECM in combat: \"Do not fire missiles at pirates grouped in clusters of four or more, or you will waste them. At least one of them will be able to destroy your missiles\" he told our reporters this morning."],
];

this.startUpComplete = function () {
	if (!missionVariables.Hints_GNN_Counter) {
		missionVariables.Hints_GNN_Counter = 0; // this is the jump counter
		missionVariables.Hints_GNN_Item = 0; // this is the item pointer (ie what new item is going to be displayed.)
	}
	// make sure we'll be dealing with numbers, not a text string
	missionVariables.Hints_GNN_Counter = parseInt(missionVariables.Hints_GNN_Counter);
	missionVariables.Hints_GNN_Item = parseInt(missionVariables.Hints_GNN_Item);

	// if we've reached the end of the array, delete the shipExitedWitchspace to prevent overflows
	if (missionVariables.Hints_GNN_Item >= this.Hints_GNN_News.length) {
		delete this.shipExitedWitchspace;
	}
}

this.shipExitedWitchspace = function () {
	missionVariables.Hints_GNN_Counter++;
	var cur = this.Hints_GNN_News[missionVariables.Hints_GNN_Item];
	if (cur[0] <= missionVariables.Hints_GNN_Counter) {
		var news = new Object;
		news.ID = this.name;
		news.Message = cur[2];
		news.Agency = cur[1];
		news.Priority = 3;
		this.passScreen(news, 1);
	}
}

this.passScreen = function (news) {
	var a = worldScripts.GNN._insertNews(news);
	if (!a) {
		missionVariables.Hints_GNN_Item++;  // If GNN conforms success, advance the News Counting variable to the next Broadcast.
		missionVariables.Hints_GNN_Counter = 0; // reset the jump counter
		// if we've reached the end of the array, delete the shipExitedWitchspace to prevent overflows
		if (missionVariables.Hints_GNN_Item >= this.Hints_GNN_News.length) {
			delete this.shipExitedWitchspace;
		}
	} else {
		if (a < 0) { 
			// If the buffer was full then the mission variable counting the News Broadcasts wasn't advanced. 
			// send the counter back by 3, so it will try again in 3 more jumps
			missionVariables.Hints_GNN_Counter -= 3;
		}
	}
}
I know you'll probably have questions, so ask away!
User avatar
Zed
Above Average
Above Average
Posts: 29
Joined: Mon Feb 01, 2016 7:03 am
Location: Sagittarius Arm

Re: Scripters cove

Post by Zed »

Hey. First post in a long, long time. I've recently gotten back in to Oolite and have been experimenting with different expansions and decided to give some of Stranger's a try. I like them. I like the size of the systems added by Sun Gear and related expansions but am not quite so attached to HardWay. This creates a problem though. Sun Gear makes it very difficult to scoop without HardWay so I decided try and make something that would imitate the experience of vanilla fuel scooping but with Sun Gear suns.

After looking at both Fuel Collector and the Solar Wind Collector in HardWay, I ended up with the following code.

Code: Select all

"use strict";

/*	$fuelScooping
	Immitates standard fuel scooping when the Sun Gear addon is installed
	Scoops fuel when (sun.radius / distanceTo(system.sun)) is 0.735
	Adds 0.2 ly every second, depending on timer settings
*/
this.$fuelScooping = function()
{
	//final "and" simulates fuel scoop shutdown when tank is full
	if (system.sun.radius / player.ship.position.distanceTo(system.sun) >= 0.735 && player.ship.equipmentStatus("EQ_FUEL_SCOOPS") == "EQUIPMENT_OK" && player.ship.fuel < 7)
	{
		if (player.ship.scoopOverride == false)
		{
			player.ship.scoopOverride = true;		//Immitate being close enough for the scoop effect if it's off
			player.consoleMessage("Fuel scoop activated");
		}
		player.ship.fuel += 0.2;
	}
	else
	{
		if (player.ship.scoopOverride == true)
		{
			player.ship.scoopOverride = false;		//Immitate the fuel scoop turning off if it's on
			player.consoleMessage("Fuel scoop deactivated");
		}
	}
}

//Start a timer on launch to do fuel scoop checks or turn it on if one already exists
this.shipWillLaunchFromStation = function()
{
	if (this.$fuelScoopTimer)
	{
		this.$fuelScoopTimer.start();
	}
	else
	{
		this.$fuelScoopTimer = new Timer(this,this.$fuelScooping,0,1);
	}
}

//Stop the timer on dock or death because these ships can't scoop
//Do I need this?
this.shipWillDockWithStation = this.shipDied = function()
{
	if (this.$fuelScoopTimer && this.$fuelScoopTimer.isRunning)			//Does the time exist and is it running?
	{
		this.$fuelScoopTimer.stop();
	}
}
After doing some play testing with Sun Gear installed, this script does what I hoped it would do. There are probably easier ways of doing this and I'm very likely doing some wheel-reinventing with this. However, I have very, very, very, very little experience with scripting so I'd appreciate it some of the more experience scripters could take a look at this and point out some ways of doing it better or how it could break.

I haven't tested with vanilla suns though. And please ignore my in-code comments, they help remind me of what does what because I'm still rather new at this.
Oo: Rebooting
Pio: Let's Pumpkinseed!
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 5587
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Zed wrote: Fri Feb 06, 2026 7:53 am
After looking at both Fuel Collector and the Solar Wind Collector in HardWay, I ended up with the following code.
Your code looks pretty good. The only suggestion I would make is to include a check that your ship is actually moving before allowing fuel to be scooped. Otherwise, you could just get in range, come to a complete stop, and fill up your tank.

If this is a separate script file, I'd suggest putting a

Code: Select all

this.name = "some_name";
At the top, so your script has a distinct name.

I can't see any other glaring issues.
User avatar
Zed
Above Average
Above Average
Posts: 29
Joined: Mon Feb 01, 2016 7:03 am
Location: Sagittarius Arm

Re: Scripters cove

Post by Zed »

phkb wrote: Fri Feb 06, 2026 9:53 am
Your code looks pretty good. The only suggestion I would make is to include a check that your ship is actually moving before allowing fuel to be scooped. Otherwise, you could just get in range, come to a complete stop, and fill up your tank.
That's a good idea. I was just thinking about a "vanilla-fication" of Sun Gear for this at first but a speed check could also be used to adjust the amount of fuel scooped too. That could be fun.
phkb wrote: Fri Feb 06, 2026 9:53 am
If this is a separate script file, I'd suggest putting a

Code: Select all

this.name = "some_name";
At the top, so your script has a distinct name.

I can't see any other glaring issues.
I actually have a basic

Code: Select all

this.name
this.author
this.copyright
this.description
this.version
in the script file, I just didn't paste it in with the rest of the code because I wasn't sure if it was needed here. I'm glad there aren't any terrible issues too. Huzzah!
Oo: Rebooting
Pio: Let's Pumpkinseed!
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 694
Joined: Sat Dec 04, 2021 11:01 pm

The hard truth

Post by Old Murgh »

I have been trying to make a mission, where several of the components seem to be working ok, like they are supposed to.

I initially made a "proof of concept" version which demonstrates the end product to see if that works, and then began my attempt at a version that is the "mission", -right now simply a cargopod dumped for the player to pick up, and when it is in the player hold, the equipment is supposed to do its job (like it did in the proof version by simply loading the OXP). Since I couldn't make it take effect instantly at the pod's pickup, I tried to make it something you needed a station garage to install for you.. This seems like it may work partially, but my question is this:

The "proof of concept" combines 2 methods to make it seem like this machine has an effect on the f7 page. Using javascript the planet descriptions are easily altered.
But the 'above the line' info such as inhabitants, government, economy.. I can only manage to alter using the planetinfo.plist, and this goes global the moment the OXP is loaded. It will not support the illusion that turning on this machine causes this change..

So, if one you wizards could tell me,
is there a way to make planetinfo 'switchable'?
OR is there a way to make the planetinfo data manipulated by javascript?
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: 5587
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: Sun Feb 08, 2026 9:43 pm
is there a way to make planetinfo 'switchable'?
OR is there a way to make the planetinfo data manipulated by javascript?
I'm pretty sure most of the info in planetinfo can be tweaked just by changing the value. For instance, to change the techLevel of a system

Code: Select all

var sys = System.infoForSystem(0, 7);
sys.techlevel = 15; // make lave super-hi-tech
Is that what you had in mind? What properties did you want to change?
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2926
Joined: Tue Apr 04, 2006 7:02 pm
Location: Up to no good in Galaxy 7. Ship: Wolf Mark II: Hidden Dragon Rated: Deadly.

Re: Scripters cove

Post by LittleBear »

You can set all the properties of a system with script. EG:

Code: Select all

// Set Up Orramaor.
System.infoForSystem(6,73).description = "Orramaor is noted for the resort world of Apollodorus, where many of the residents of the nearby Sunset Retirement Home spend their days. It is reasonably well known as the corporate headquarters of Soin Classic Shipyards Ltd. In recent years, Soin Classic Shipyards have specialised in the development of improved versions of Serpent Class ships.";
System.infoForSystem(6,73).techlevel = 14;
System.infoForSystem(6,73).government = 6;
System.infoForSystem(6,73).economy = 0;
System.infoForSystem(6,73).inhabitants = "Small Rodent Scientists";
System.infoForSystem(6,73).inhabitant = "Rodent Scientist";
System.infoForSystem(6,73).productivity = 53489;
System.infoForSystem(6,73).population = 97;
System.infoForSystem(6,73).station = "assassins_rebooted_standard_dodecahedron_station";
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Old Murgh
Wiki Wizard
Wiki Wizard
Posts: 694
Joined: Sat Dec 04, 2021 11:01 pm

Re: Scripters cove

Post by Old Murgh »

phkb wrote: Sun Feb 08, 2026 11:11 pm
I'm pretty sure most of the info in planetinfo can be tweaked just by changing the value. For instance, to change the techLevel of a system

Code: Select all

var sys = System.infoForSystem(0, 7);
sys.techlevel = 15; // make lave super-hi-tech
Is that what you had in mind? What properties did you want to change?
That's in a script isn't it?
My working planetinfo.plist alter inhabitants for every system

Code: Select all

{
    "0 0" = { inhabitants = "Standardized Bipedal Consumers"; };
    "0 1" = { inhabitants = "Standardized Bipedal Consumers"; };
    "0 2" = { inhabitants = "Standardized Bipedal Consumers"; };
    "0 3" = { inhabitants = "Standardized Bipedal Consumers"; };
    ...
(it changes eventually)
But then it is set at startup, can't be 'switched' on or off.
Do you think this could be scripted with conditions?
LittleBear wrote: Sun Feb 08, 2026 11:26 pm
You can set all the properties of a system with script. EG:

Code: Select all

// Set Up Orramaor.
System.infoForSystem(6,73).description = "Orramaor is noted for the resort world of Apollodorus, where many of the residents of the nearby Sunset Retirement Home spend their days. It is reasonably well known as the corporate headquarters of Soin Classic Shipyards Ltd. In recent years, Soin Classic Shipyards have specialised in the development of improved versions of Serpent Class ships.";
System.infoForSystem(6,73).techlevel = 14;
System.infoForSystem(6,73).government = 6;
System.infoForSystem(6,73).economy = 0;
System.infoForSystem(6,73).inhabitants = "Small Rodent Scientists";
System.infoForSystem(6,73).inhabitant = "Rodent Scientist";
System.infoForSystem(6,73).productivity = 53489;
System.infoForSystem(6,73).population = 97;
System.infoForSystem(6,73).station = "assassins_rebooted_standard_dodecahedron_station";
Missed this one.
So, great! You're both saying this is feasible. Thank you.

My AI scripting tutor is being negative, but this will show him!
Last edited by Old Murgh on Sun Feb 08, 2026 11:34 pm, edited 1 time in total.
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: 5587
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: Sun Feb 08, 2026 11:29 pm
That's in a script isn't it?
Yes.
Old Murgh wrote: Sun Feb 08, 2026 11:29 pm
But then it is set at startup, can't be 'switched' on or off.
You can't switch a "planetinfo.plist" on or off with a script. What you can do is set your value via script, and when you want to switch it back to the default, set the value to null.
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2926
Joined: Tue Apr 04, 2006 7:02 pm
Location: Up to no good in Galaxy 7. Ship: Wolf Mark II: Hidden Dragon Rated: Deadly.

Re: Scripters cove

Post by LittleBear »

The change can be made anywhere in script (for example when you scoop the pod), it doesn't have to be under start.up. It will over-ride planetinfo at least until you re-load the game. If you want it to be permanent then you'd need another command under start.up making the change if a mission variable has been flipped. EG (under start.up):

Code: Select all

// Changes from default states depending on where the player is in the story.
// Orramaor changes after the Guild destroys the Soin Clan family burrow.
if (missionVariables.assassins_rebooted_stage > 8 || missionVariables.assassins_rebooted_stage === "Complete") {
System.infoForSystem(6,73).description = "Orramaor is noted for the resort world of Apollodorus, where many of the residents of the nearby Sunset Retirement Home spend their days.  Formerly the corporate headquarters of Soin Classic Shipyards Ltd, the Planet Orramaor is now famous for a large crater on the southern continent.";
System.infoForSystem(6,73).productivity = 38535;
}
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
Post Reply