Help on finding variables :) Thanks

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Ginger470
Posts: 158
Joined: Sun, 20. Jun 04, 03:24
x2

Help on finding variables :) Thanks

Post by Ginger470 » Fri, 22. Nov 13, 19:52

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!!!

Mad_Joker
Posts: 274
Joined: Sun, 14. May 06, 11:21
x3

Re: Help on finding variables :) Thanks

Post by Mad_Joker » Fri, 22. Nov 13, 20:03

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.

Ginger470
Posts: 158
Joined: Sun, 20. Jun 04, 03:24
x2

Post by Ginger470 » Fri, 22. Nov 13, 20:27

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 :)

User avatar
MegaJohnny
Posts: 2195
Joined: Wed, 4. Jun 08, 22:30
x4

Post by MegaJohnny » Fri, 22. Nov 13, 21:51

I believe it would be this?

Code: Select all

<set_value name="$vel" exact="player.primaryship.velocity"/>

Realspace
Posts: 1342
Joined: Wed, 15. Nov 06, 10:21
x4

Post by Realspace » Fri, 22. Nov 13, 22:22

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. :wink:
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?

Ginger470
Posts: 158
Joined: Sun, 20. Jun 04, 03:24
x2

Post by Ginger470 » Sat, 23. Nov 13, 00:42

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 :)

Post Reply

Return to “X Rebirth - Scripts and Modding”