Re: Scripters cove
Posted: Sun Dec 24, 2023 12:05 pm
Got it to work by using the following code.
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.
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
}
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.