Scripters cove

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

Moderators: winston, another_commander

User avatar
Nite Owl
---- E L I T E ----
---- E L I T E ----
Posts: 556
Joined: Sat Jan 20, 2018 4:08 pm
Location: In The Dark

Re: Scripters cove

Post by Nite Owl »

Got it to work by using the following code.

Code: Select all

this.shipWillDockWithStation = function (station)
{
	if (system.techLevel == 0 && (station.hasRole ("coriolis") || station.hasRole ("dodecahedron") || station.hasRole ("icosahedron") || station.hasRole ("sfep_station"))) player.addMessageToArrivalReport(expandDescription("[dockmessage_0]"));
	
	else
	
	if (system.techLevel == 1 && (station.hasRole ("coriolis") || station.hasRole ("dodecahedron") || station.hasRole ("icosahedron") || station.hasRole ("sfep_station"))) player.addMessageToArrivalReport(expandDescription("[dockmessage_1]"));
	
// continues through all tech levels and then moves on to individual stations

	if (station.hasRole ("rockhermit") || station.hasRole ("rockhermit-chaotic") || station.hasRole ("rockhermit-pirate")) player.addMessageToArrivalReport(expandDescription("[dockmessage_rock]"));
			
	else
	
	if (station.hasRole ("constore")) player.addMessageToArrivalReport(expandDescription("[dockmessage_store]"));

//the individual stations also continue

}
There was some worry about the use of this.shipWillDockWithStation versus this.shipDockedWithStation but there is method to my madness. It stated somewhere in the Wiki (that can no longer be found) that the first one will put my additional Arrival Messages BEFORE Oolite's usual Arrival Messages which is the desired behavior.

The code posted by phkb was very close to one of my previous attempts but mine lacked a few brackets which he kindly provided. It always seems to come down to the brackets, or the lack thereof. The testing and revamping phase can now begin. Thanks Again to phkb for pointing me in the right direction.
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
Cholmondely
Archivist
Archivist
Posts: 5365
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 »

Nite Owl wrote: Sun Dec 24, 2023 12:05 pm
There was some worry about the use of this.shipWillDockWithStation versus this.shipDockedWithStation but there is method to my madness. It stated somewhere in the Wiki (that can no longer be found) that the first one will put my additional Arrival Messages BEFORE Oolite's usual Arrival Messages which is the desired behavior.
You can always get back to earlier versions of any wiki page by just clicking the history tab at the top - and then clicking the date of the version you are after.

That of course presumes that you know which page it was!
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
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2687
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Scripters cove

Post by Redspear »

I'm trying to convert pylons into more general equipment slots.
Pylons seem to expect either missile or mine designations however and so suit expendable (can be fired) items.

The provides option from equipment.plist would let me assign whatever other equipment I wished to the a theoretical 'missile' but I wouldn't wish it to otherwuise behave as a missile.

In the absence of shipWillLaunchMissile or similar, does anyone know a way I could fill the pylon slot without having the possibility of it being launched/expended?
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: Scripters cove

Post by Wildeblood »

Redspear wrote: Sun Feb 11, 2024 11:38 am
I'm trying to convert pylons into more general equipment slots.
Pylons seem to expect either missile or mine designations however and so suit expendable (can be fired) items.

The provides option from equipment.plist would let me assign whatever other equipment I wished to the a theoretical 'missile' but I wouldn't wish it to otherwuise behave as a missile.

In the absence of shipWillLaunchMissile or similar, does anyone know a way I could fill the pylon slot without having the possibility of it being launched/expended?
shipFiredMissile()
awardEquipmentToCurrentPylon()

These are what one uses for an infinite missiles cheat, apparently. If you also added the original missile deleting its own existence as soon as awardEquipmentToCurrentPylon succeeded, firing the missile would appear to have no effect, I guess. Is that what you're trying to achieve, or have I misread you?
In your heart, you know it's flat.
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2687
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Scripters cove

Post by Redspear »

Wildeblood wrote: Sun Feb 11, 2024 6:59 pm
s that what you're trying to achieve, or have I misread you?
Imagine if I wanted fuel scoops, for example, to take up a pylon slot when installed.

I can use requires_empty_pylon but the game seems to expect an equipment item ending in either _missile or _mine (rejecting it if it doesn't).

Now I could create a pseudo 'missile' or 'mine' that incorporates provides = ("EQ_FUEL_SCOOPS"); but I really don't want that item to be fired, even if I could replace it as you illustrate above, the act of firing it would spoil the illusion somewhat. So if it must be a missile/mine then I dont want it to behave as one

I essentially want to create a 'jammed missile', blocking its occupied pylon but also providing the desired equipment. Why pylon slots? Because they're predetermined for all existing ships. Apologies for any confusion.
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2687
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Scripters cove

Post by Redspear »

Is there a version of (or can I repurpose)... shipEnteredPlanetaryVicinity... to trigger when the player is near to the sun (and only the sun) instead of a planet?

...Worked it out:

this.shipEnteredPlanetaryVicinity = function(entity) {
if (entity.isSun)... etc.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5365
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 »

Station Allegiance. Ship Allegiance.

How would one create a station or a ship allied with the local government as distinct from GalCop?


Are there any examples of this?


I see nothing relevant in Station: allegiance or elsewhere (but would not know where to look).
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: 4830
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: Mon Apr 15, 2024 11:50 am
Station Allegiance. Ship Allegiance.

How would one create a station or a ship allied with the local government as distinct from GalCop?
First off, allegiance only applies to stations, not ships.

I can't think of any examples, but you can put anything you like as the "allegiance", and the game will work. The AI, however, would treat it as "private", and thus probably ignore the station completely.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

mission.setInstructions("Why?", this.name);

Post by Wildeblood »

Why, when using mission.setInstructions, do I habitually use a second parameter, always set to this.name?

mission.setInstructions("Why do I do this?", this.name);

This second parameter appears to be non-functional. Is this correct, or is it a mistake I've copied from someone else 15 years ago, and never realized I'd always got it wrong? Should I be doing it like this:

mission.setInstructions("Why don't I do this?");

:?:
In your heart, you know it's flat.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Wildeblood wrote: Fri Jul 19, 2024 10:49 am
Why, when using mission.setInstructions, do I habitually use a second parameter, always set to this.name?
The second parameter is optional *if* you always call setInstructions from the same worldscript. If you had, say, a ship script that needed to update the instructions you added via your worldscript, you would need the extra parameter so Oolite can know which instructions you are updating. Otherwise, you'd end up with two instructions on the manifest page.
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: Scripters cove

Post by Wildeblood »

phkb wrote: Mon Jul 22, 2024 12:57 am
Wildeblood wrote: Fri Jul 19, 2024 10:49 am
Why, when using mission.setInstructions, do I habitually use a second parameter, always set to this.name?
The second parameter is optional *if* you always call setInstructions from the same worldscript. If you had, say, a ship script that needed to update the instructions you added via your worldscript, you would need the extra parameter so Oolite can know which instructions you are updating. Otherwise, you'd end up with two instructions on the manifest page.
That has previously been my understanding, but can anyone provide a working example? (Of world-script B altering an instruction left by world-script A.)

I have a vague memory of trying to do this, back in February or March, when I was messing with GalDrive Programmers, and it failing miserably. Thereupon I decided the Dokumentation might possibly be interpreted as aspirational. :roll:
In your heart, you know it's flat.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

Wildeblood wrote: Mon Jul 22, 2024 4:13 am
That has previously been my understanding, but can anyone provide a working example? (Of world-script B altering an instruction left by world-script A.)
[EliteWiki] Contracts on Bulletin Board has to use other keys to update instructions for the "Escort Contracts" and "Random Hits" OXPs.

The Coyote's Run OXP updates the main instructions in a number of it's ship scripts, as does the [EliteWiki] Deposed OXP, [EliteWiki] Lovecats OXP and [EliteWiki] Random Hits OXP.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Scripters cove

Post by phkb »

More examples: Taranis, TCAT, Tionisla Reporter, Trident Down, UPS, Feudal States
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: Scripters cove

Post by Wildeblood »

phkb wrote: Mon Jul 22, 2024 4:32 am
More examples: Taranis, TCAT, Tionisla Reporter, Trident Down, UPS, Feudal States
Righto, calm down. So obviously, I was doin' somethin' wrong(ly). No need to hammer the point.

:shock: :roll: :x :oops: :roll: :lol:

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

Re: Scripters cove

Post by phkb »

And Cataclysm.

:D
Post Reply