Page 1 of 1
Help on finding variables :) Thanks
Posted: Fri, 22. Nov 13, 19:52
by Ginger470
Hey Guys,
I've been trying to chase down some variables/functions in the codebase and coming up empty.
- playership speed
playership x y z
playership yaw (rot x,z) , pitch (rot y,z)
The goal is to create (optional) ATC guidance to add some depth to the sim part of the game.
That said, I would also need to query the zone to
find all available docks and, once one is selected,
find it's x,y,z yaw and pitch. Which obviously I can't find either.
Gotta say, I've been coding advanced server side stuff for years: this xml language seems really long winded.
I've written scripts back in the day for x2, but not for the mission director. This is all new, so be gentle
Thanks!!!
Re: Help on finding variables :) Thanks
Posted: Fri, 22. Nov 13, 20:03
by Mad_Joker
Ginger470 wrote:Hey Guys,
I've been trying to chase down some variables/functions in the codebase and coming up empty.
- playership speed
playership x y z
playership yaw (rot x,z) , pitch (rot y,z)
The goal is to create (optional) ATC guidance to add some depth to the sim part of the game.
That said, I would also need to query the zone to
find all available docks and, once one is selected,
find it's x,y,z yaw and pitch. Which obviously I can't find either.
Gotta say, I've been coding advanced server side stuff for years: this xml language seems really long winded.
I've written scripts back in the day for x2, but not for the mission director. This is all new, so be gentle
Thanks!!!
Hi,
this is what you are looking for:
Code: Select all
position position Position relative to parent
rotation rotation Rotation relative to parent
velocity vector Linear velocity relative to the cluster, but relative to the component's rotation (in m/s)
speed length Speed relative to the cluster (in m/s)
However, you don't have to go through the source. Look in the libraries directory for a file called scriptproperties.xml and open it with a browser. You will see a formatted list of all classes and properties. Look for component in there and you'll find the variables I mentioned above.
About docks: you can have a look at my code from NESA (link in signature). There you will see how I find stations, docks etc. They are components, just like ships, so will have the same properties.
Posted: Fri, 22. Nov 13, 20:27
by Ginger470
Thanks
So how do I apply this to the playership (or any other object)?
Code: Select all
<property name="velocity" result="Linear velocity relative to the cluster, but relative to the component's rotation (in m/s)" type="vector" />
I'm looking for something like $vel = playership.velocity (which would presumably return an array of speed and direction)
Sorry for newb qs, but we all gotta start somewhere
Posted: Fri, 22. Nov 13, 21:51
by MegaJohnny
I believe it would be this?
Code: Select all
<set_value name="$vel" exact="player.primaryship.velocity"/>
Posted: Fri, 22. Nov 13, 22:22
by Realspace
Hey let me know about any modification possible. I implemented a physics mod for player's ship acting on the variable of the engines but to be able to change the physics in general would be much usefull.
http://forum.egosoft.com/viewtopic.php?t=353399
Indeed it would be good if we could change that kind of invisible friction (kind of liquid) of the X universe or add REAL lateral/vertical thrusters
what about these file: controlschemes_default.xml etc., are they only for flight inside the highways?
Posted: Sat, 23. Nov 13, 00:42
by Ginger470
ok... Thanks for the pointers
For anyone looking for the same:
Code: Select all
<set_value name="$speed" exact="player.primaryship.speed" />
<set_value name="$yaw" exact="player.primaryship.rotation.yaw" />
<set_value name="$pitch" exact="player.primaryship.rotation.pitch" />
<set_value name="$x" exact="player.primaryship.position.x" />
<set_value name="$x" exact="player.primaryship.position.y" />
<set_value name="$x" exact="player.primaryship.position.z" />
and .velocity returns x,y,z speeds whereas speed just returns 'engin' speed for playership.
Now, next question
How do I round numbers?
Specifically to a number of decial places: eg 1.2345678, =1.23 (or 1.24 - not that important for this)
TY