Code: Select all
(
"escort-formations.js"
["Escort Formations Randomiser"].$setupEscortFormation(SolarWing-escort, planebox);
)
Moderators: winston, another_commander
Code: Select all
(
"escort-formations.js"
["Escort Formations Randomiser"].$setupEscortFormation(SolarWing-escort, planebox);
)
script.js
and put it in the config folder.script.js
then you use the plist to list which scripts should be run, and those scripts are put in the Scripts folder of the OXP.Code: Select all
/*
Aquatics OXP v2.00
*/
(
"aquatics_populator.js",
"aquatics_equipment.js"
)
["Escort Formations Randomiser"].$setupEscortFormation(SolarWing-escort, planebox);
is a function call to be used within one world script to call the function within the world script built into Escort Formations. script.js
in the Config folder, or under its own name in the Scripts folder and pointed to via World-scripts.plist) which should contain the ["Escort Formations Randomiser"].$setupEscortFormation(SolarWing-escort, planebox);
line within a suitable function. That world script would presumably be the one that spawns the ship group in the first place.Code: Select all
(
["Escort Formations Randomiser"].$setupEscortFormation(SolarWing-escort, planebox);
)
Code: Select all
(
"myFunkyWorldscript.js"
)
Code: Select all
(
"myFunkyWorldscript.js",
"myOtherFunkyWorldscript.js"
)
Code: Select all
(
"escort-formations.js"
["Escort Formations Randomiser"].$setupEscortFormation(SolarWing-escort, planebox);
)
The ships that you hire as a player are just simulated escorts. They use code to follow you around and check if you are being attacked. I used this same approach with Jaguar Company, they use a script to keep formation and pass messages between themselves.mandoman wrote:Okay, I think I see what you mean, but why is it possible to hire escorts, but not possible to have them in your ship oxp with the player version? I'm not trying to be difficult, I just want to understand.
No. In the ship script for the escort you would need to place this in this.shipSpawned...mandoman wrote:So, if I'm following you, I would have a script.js (serving as a World-script.plist) in the Config folder, and that script.js would have the entry,
??? Should I also include the Scripts folder from the Escort-Formations Randomizer.oxp in my own ship's oxp, giving credit to the author in the ReadMe.txt?Code: Select all
( ["Escort Formations Randomiser"].$setupEscortFormation(SolarWing-escort, planebox); )
Oh, and also, should I list that java script in the shipdata under the mother ship as "Scripts =", or under the escort ship listing in the same shipdata.plist file?
Code: Select all
this.shipSpawned = function () {
worldScripts["Escort Formations Randomiser"].$setupEscortFormation(this.ship, "planebox");
};
Code: Select all
script = "yourshipname-escort.js";
Thank you Commander McLane. That was EXACTLY what I was looking for. With your explanation, and Commander Tricky's suggestions, I might be able to pull something off. Very much appreciated, guys.Commander McLane wrote:world-scripts.plist is a list of (file) names of world scripts. Period. Nothing more. It's just a list of world scripts. It is therefore by definition not a world script (or any kind of script) itself. It's a list. With a file name in each line.
Code: Select all
this.name = "Solarwing-escort_formation";
this.author = "mandoman";
this.copyright = "© 2012 MandoTech Industries, Inc.";
this.license = "CC BY-NC-SA 3.0";
this.description = "Ship script for SolarWing-escort formation.";
this.version = "1.0";
this.ship = "SolarWing-escort";
this.shipSpawned = function () {
worldScripts["Escort Formations Randomiser"].$setupEscortFormation(this.ship, "planebox");
};
Code: Select all
this.ship = "SolarWing-escort";
Code: Select all
worldScripts["Escort Formations Randomiser"].$setupEscortFormation(this.ship, "planebox");
this.ship
in this line to be the escorted ship this.ship.group.leader
.I was afraid of that. You see, that is the reason I shouldn't mess with other people's work. Thanks Tricky.Tricky wrote:Take out the line...otherwise, should work as a ship script. (Don't add to the world-script.plist file)Code: Select all
this.ship = "SolarWing-escort";
That oxp is yours, isn't it cim? I was wondering if you would chime in. So the line should readcim wrote:One minor point about this line: the escort formation is decided in Oolite by the ship being escorted, not the ship doing the escorting.Code: Select all
worldScripts["Escort Formations Randomiser"].$setupEscortFormation(this.ship, "planebox");
I think from what you've said the Solar Wings are supposed to be the escorts, not the escorted. If so, you need to changethis.ship
in this line to be the escorted shipthis.ship.group.leader
.
Code: Select all
worldScripts["Escort Formations Randomiser"].$setupEscortFormation(this.ship.group.leader, "planebox");
Code: Select all
if (worldScripts["Escort Formations Randomiser"]) {
worldScripts["Escort Formations Randomiser"].$setupEscortFormation(this.ship.group.leader, "planebox");
}
Oh, okay, I'll change it to what you have above, though I do have the Escort Formations oxp installed. It's a darn good idea, once one gets on to using it. Thanks cim.cim wrote:Yes, that's correct. Even better, thinking about it, would be:This checks that the Escort Formations worldscript is installed, and then only if it is installed, asks it to set up the escort formation.Code: Select all
if (worldScripts["Escort Formations Randomiser"]) { worldScripts["Escort Formations Randomiser"].$setupEscortFormation(this.ship.group.leader, "planebox"); }
Without that check, you'll get a bunch of errors in Latest.log if the ship is installed but Escort Formations isn't. With it, it'll use Escort Formations if it's available, and not break if it isn't.
Yeah, I hadn't thought of that. I was more trying to form up an escort of SolarWiings for a large trader ship I'm working on, and thus hoping to make it so the player version could have those escorts, but I'm told it can't be done. I'll look into putting it into the escort version in the SolarWing oxp, though. Thanks again, Tricky.Tricky wrote:If the Solar Wing OXP is going to use the Escort Formations Randomiser OXP then it may be an idea to include that OXP in the package plus include something in the readme about it.
Code: Select all
12:52:01.123 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (Solarwing-escort_formation 1.0): TypeError: this.ship is undefined
Code: Select all
12:43:58.140 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (solarwing-escort_formation 1.0): TypeError: this.ship.group is undefined
Code: Select all
this.name = "Solarwing-escort_formation";
this.author = "mandoman";
this.copyright = "© 2012 MandoTech Industries, Inc.";
this.license = "CC BY-NC-SA 3.0";
this.description = "Ship script for SolarWing-escort formation.";
this.version = "1.0";
this.ship.group.leader = (SunBird);
this.shipSpawned = function () {
if (worldScripts["Escort Formations Randomiser"]) {
worldScripts["Escort Formations Randomiser"].$setupEscortFormation(this.ship.group.leader, "planebox");
};
}