Well, now that the option is back, you'll be able to see what I do with it in... (looks to see what version's next) HoloNumHUDv1.2, out PDQ.Smivs wrote:Hehe, who knows what a bunch of nutters like us will do when given a newtoyfeature!
Scripters cove
Moderators: winston, another_commander
- Rese249er
- ---- E L I T E ----
- Posts: 647
- Joined: Thu Jun 07, 2012 2:19 pm
- Location: Well, I WAS in G3...
Re: Scripters cove
Got all turned around, lost my nav connection... Where am I now?
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Associating a buoy with its mother ship
When I target a buoy with the compass the only piece of useful information I can retrieve is the beacon code, and with many older OXPs even that is fairly cryptic. How do I get from the buoy to the station it's floating in front of, since that is the object I'm really interested in.
- Cmd. Cheyd
- ---- E L I T E ----
- Posts: 934
- Joined: Tue Dec 16, 2008 2:52 pm
- Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...
Re: Scripters cove
Can a world script call a function, check a variable, etc located inside an equipment script? If so, how? Obviously, worldScripts["foo"] is incorrect...
Find my OXP's at:
Deep Horizon Industries - Your Planet Our Design
Deep Horizon Industries - Your Planet Our Design
Re: Associating a buoy with its mother ship
I'd perform a search for all ships with suitable parameters (in this case ones that have the role of station or something along those lines) within a suitable radius of the position of the buoy.Wildeblood wrote:When I target a buoy with the compass the only piece of useful information I can retrieve is the beacon code, and with many older OXPs even that is fairly cryptic. How do I get from the buoy to the station it's floating in front of, since that is the object I'm really interested in.
Something like
system.entitiesWithScanclass
or system.shipsWith(Primary)Role
or one of the similar scanning functions available through the system class.Then check the array and pick the closest/most suitable candidate to be the relevant station (the array would presumably be one entity long anyway in most cases).
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
Re: Scripters cove
No. If the equipment script needs to interact with a world script, then any functions/variables that they both need access to need to be placed in the world script.Cmd. Cheyd wrote:Can a world script call a function, check a variable, etc located inside an equipment script? If so, how? Obviously, worldScripts["foo"] is incorrect...
Re: Scripters cove
I've been meaning to ask this for quite some time.
1. Is it possible to reset the message_gui settings to their default values?
I have tried setting player.ship.hud = 'null' and using message_gui = {} in a resetting hud file. Neither seems to do the trick.
2. Is it possible to override just the message_gui settings from a hud file? Idea is that the other hud elements stay intact.
3. If it's not possible to reset the message_gui, what are the default values of it? I want to write a resetting hud.
1. Is it possible to reset the message_gui settings to their default values?
I have tried setting player.ship.hud = 'null' and using message_gui = {} in a resetting hud file. Neither seems to do the trick.
2. Is it possible to override just the message_gui settings from a hud file? Idea is that the other hud elements stay intact.
3. If it's not possible to reset the message_gui, what are the default values of it? I want to write a resetting hud.
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Scripters cove
Have you tried again recently? It should be working as Kaks described in 1.77. That is, message_gui = {} should reset it.spara wrote:I've been meaning to ask this for quite some time.
1. Is it possible to reset the message_gui settings to their default values?
I have tried setting player.ship.hud = 'null' and using message_gui = {} in a resetting hud file. Neither seems to do the trick.
Have another look in Trading Assistant. Only the first HUD file switched to has the message_gui and comm_log_gui defined. The others inherit it. So yes, make a HUD file with just those, switch to it for a moment, then switch back. (No you can't eliminate the momentary flicker.)spara wrote:2. Is it possible to override just the message_gui settings from a hud file? Idea is that the other hud elements stay intact.
Re: Scripters cove
Well so it does. This is good news.Wildeblood wrote:Have you tried again recently? It should be working as Kaks described in 1.77. That is, message_gui = {} should reset it.spara wrote:I've been meaning to ask this for quite some time.
1. Is it possible to reset the message_gui settings to their default values?
I have tried setting player.ship.hud = 'null' and using message_gui = {} in a resetting hud file. Neither seems to do the trick.
spara wrote:2. Is it possible to override just the message_gui settings from a hud file? Idea is that the other hud elements stay intact.
Yes, that's the way to do it with the default hud, but if I would like to do it with some other hud, it's not possible. As the other hud usually defines the message_gui. Basically I would like to only change the message_gui of a hud, it would feel a bit more consistent that way. Not a big thing anyway.Wildeblood wrote:Have another look in Trading Assistant. Only the first HUD file switched to has the message_gui and comm_log_gui defined. The others inherit it. So yes, make a HUD file with just those, switch to it for a moment, then switch back. (No you can't eliminate the momentary flicker.)
- Rorschachhamster
- ---- E L I T E ----
- Posts: 274
- Joined: Sun Aug 05, 2012 11:46 pm
- Contact:
Re: Scripters cove
Ok, I'm working on something, ... with my limited scripting abilities...
It is supposed to be a freighttrain, with multiple "waggons", that follow a tractionengine... It works, but as I based my script on the mobile ad boards from Thargoid, it looks a little stiff - with all trains following in a straight line, more or less (wich has the amusing side effect of the last trailer being quite fast in its rotation). How do I get a delay into the reaction from the trailers, so if the traction engine turns the trains follow but slightly delayed? Is this do-able? I plan do add a random number of engines, but to get the physics right, I started with three... here is the code:
Any hints would be welcome, and I'm still a bloody noob in js, so be gentle... and yes, I know, this is the barebones of the mobile ab board, but I looked into the timer at the wiki and couldn't get it right...
EDIT: As soon as I laid in bed, I had an idea ... the trick should be to distance the trailer from the traction engine without the vector forward and let it turn always into the direction of it, with the same "pitch"... quaternions? Oh, boy...
It is supposed to be a freighttrain, with multiple "waggons", that follow a tractionengine... It works, but as I based my script on the mobile ad boards from Thargoid, it looks a little stiff - with all trains following in a straight line, more or less (wich has the amusing side effect of the last trailer being quite fast in its rotation). How do I get a delay into the reaction from the trailers, so if the traction engine turns the trains follow but slightly delayed? Is this do-able? I plan do add a random number of engines, but to get the physics right, I started with three... here is the code:
Code: Select all
this.shipSpawned = function()
{
this.trailer = this.ship.spawnOne("trailer");
this.trailer2 = this.ship.spawnOne("trailer");
this.trailer3 = this.ship.spawnOne("trailer");
this.freighttrainGroup = new ShipGroup("trailer", this.ship);
this.ship.group = this.freighttrainGroup;
this.freighttrainGroup.leader = this.ship;
this.trailer.group = this.freighttrainGroup;
this.trailer2.group = this.freighttrainGroup;
this.trailer3.group = this.freighttrainGroup;
this.callbackID = addFrameCallback(this.positionTrailer.bind(this));
}
this.positionTrailer = function()
this.trailer.position = this.ship.position.subtract(this.ship.orientation.vectorForward().multiply(this.trailer.collisionRadius + this.ship.collisionRadius));
this.trailer.orientation = this.ship.orientation;
this.trailer2.position = this.trailer.position.subtract(this.trailer.orientation.vectorForward().multiply(this.trailer.collisionRadius + this.trailer2.collisionRadius));
this.trailer2.orientation = this.trailer.orientation;
this.trailer3.position = this.trailer2.position.subtract(this.trailer2.orientation.vectorForward().multiply(this.trailer2.collisionRadius + this.trailer3.collisionRadius));
this.trailer3.orientation = this.trailer2.orientation;
}
EDIT: As soon as I laid in bed, I had an idea ... the trick should be to distance the trailer from the traction engine without the vector forward and let it turn always into the direction of it, with the same "pitch"... quaternions? Oh, boy...
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: Scripters cove
Now you use for the position:
The used distance is fixed to (this.trailer.collisionRadius + this.ship.collisionRadius). When you want it more flexible, you must add variation to this distance. e.g. by adding a sinus of the time. And maybe a sinus of time*1.2 for the next one, so they don't use the same frequency.
And you can replace "orientation.vectorForward()" by just "vectorForward". In the first case you have to calculate a vectorForward from the quaternion on every frame. (Calculating a vectorForward is time consuming). But, the system already had calculated a vectorForward for each ship on each frame, so it is cheaper to directly use that one.
Code: Select all
this.trailer.position = this.ship.position.subtract(this.ship.orientation.vectorForward().multiply(this.trailer.collisionRadius + this.ship.collisionRadius));
And you can replace "orientation.vectorForward()" by just "vectorForward". In the first case you have to calculate a vectorForward from the quaternion on every frame. (Calculating a vectorForward is time consuming). But, the system already had calculated a vectorForward for each ship on each frame, so it is cheaper to directly use that one.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- CommRLock78
- ---- E L I T E ----
- Posts: 1138
- Joined: Sat Apr 07, 2012 7:35 pm
- Location: US
- Contact:
Re: Scripters cove
I've been working on a wee project tweaking a particular system slightly to my desire adding some planets from Deep Horizons Systems. Cmd_Cheyd has been more than gracious in giving me a hand, however, I feel like I've already asked enough of him at this point. If I'm not mistaken the only thing my script needs is a test to see whether the bodies have been already placed, and I was thinking a simple sum of the planets and moons in the if statement would be the way to go but I have no idea how to do that (I could very well be wrong about this as I am a complete and utter noob ).
Code: Select all
this.name = "Ededleen System Script"
this.licence = "CC-NC-SA 3.0"
this.description = "Populates Ededleen System with additional astronomical bodies via Cmd_Cheyd's Deep Horizon Systems";
this.version = "0.1 alpha"
this.shipWillLaunchFromStation = function(station)
{
log (this.name, "Entering shipWillLaunchFromStation function. Current Galaxy is: " + system.info.galaxyID + ". Current System is: " + system.ID + ".");
if (system.info.galaxyID === 0 && system.ID === 138)
{
system.addPlanet("DeepHorizon_planet3");
system.addPlanet("DeepHorizon_planet7");
system.addPlanet("DeepHorizon_planet20");
system.addMoon("DeepHorizon_moon11");
}
}
this.shipWillExitWitchspace = function()
{
log (this.name, "Entering shipWillLaunchFromStation function. Current Galaxy is: " + system.info.galaxyID + ". Current System is: " + system.ID + ".");
if (system.info.galaxyID === 0 && system.ID === 138)
{
system.addPlanet("DeepHorizon_planet3");
system.addPlanet("DeepHorizon_planet7");
system.addPlanet("DeepHorizon_planet20");
system.addMoon("DeepHorizon_moon11");
}
}
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
Re: Scripters cove
system.planets.length will give you the total number of planets and moons in the current system. But check for interstellar space first as it will be undefined there.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- CommRLock78
- ---- E L I T E ----
- Posts: 1138
- Joined: Sat Apr 07, 2012 7:35 pm
- Location: US
- Contact:
Re: Scripters cove
Thanks Thargoid .Thargoid wrote:system.planets.length will give you the total number of planets and moons in the current system. But check for interstellar space first as it will be undefined there.
system.ID = -1 for interstellar, right?
Edit: As doubly textured planets don't readily reveal themselves, here's what I have now. I'm not quite sure of the syntax however :
Code: Select all
this.name = "Ededleen System Script"
this.licence = "CC-NC-SA 3.0"
this.description = "Populates Ededleen System with additional astronomical bodies via Cmd_Cheyd's Deep Horizon Systems";
this.version = "0.1 alpha"
this.shipWillLaunchFromStation = function(station)
{
log (this.name, "Entering shipWillLaunchFromStation function. Current Galaxy is: " + system.info.galaxyID + ". Current System is: " + system.ID + ".");
if (system.ID !== -1 && system.info.galaxyID === 0 && system.ID === 138 && system.planets.length !== 5)
{
system.addPlanet("DeepHorizon_planet3");
system.addPlanet("DeepHorizon_planet7");
system.addPlanet("DeepHorizon_planet20");
system.addMoon("DeepHorizon_moon11");
}
}
this.shipWillExitWitchspace = function()
{
log (this.name, "Entering shipWillLaunchFromStation function. Current Galaxy is: " + system.info.galaxyID + ". Current System is: " + system.ID + ".");
if (system.ID !== -1 && system.info.galaxyID === 0 && system.ID === 138 && system.planets.length !== 5)
{
system.addPlanet("DeepHorizon_planet3");
system.addPlanet("DeepHorizon_planet7");
system.addPlanet("DeepHorizon_planet20");
system.addMoon("DeepHorizon_moon11");
}
}
Last edited by CommRLock78 on Sat Jan 19, 2013 11:37 pm, edited 1 time in total.
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
Re: Scripters cove
Yes, thoughCommRLock78 wrote:system.ID = -1 for interstellar, right?
system.isInterstellarSpace
is perhaps a better test.- CommRLock78
- ---- E L I T E ----
- Posts: 1138
- Joined: Sat Apr 07, 2012 7:35 pm
- Location: US
- Contact:
Re: Scripters cove
What I have seems to work (so far ) - I'm not sure how to implement system.isInterstellarSpace as it is Boolencim wrote:Yes, thoughCommRLock78 wrote:system.ID = -1 for interstellar, right?system.isInterstellarSpace
is perhaps a better test.
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'