Is there a way to retrieve the current player position at regular intervals?

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

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

delegatevoid
Posts: 6
Joined: Sat, 23. Nov 13, 15:33

Is there a way to retrieve the current player position at regular intervals?

Post by delegatevoid »

Does the scripting support in X Rebirth offer something that would allow
me to retrieve the current player position at regular intervals (as opposed to reading it from the save file game as that's not realtime).

I would like to retrieve and then export the current position while playing
so I can effectively build something that would act as a 'second screen'/'map' on a tablet or whatever. (which is easy to do once I can store the position somewhere)
DarthCCC
Posts: 4
Joined: Mon, 28. Nov 11, 22:24
x3tc

Post by DarthCCC »

I'm not a scripting expert but you might want to try to read the memory address directly. It shoudn't be very difficult to do you if know how to program. You might also want to take a look at the ReadProcessMemory function for c++/c#. To find the memory address/the pointers that point to it CheatEngine should work great.

I hope I was able to help :)
Tyrant597
Posts: 299
Joined: Wed, 9. Apr 08, 05:52
x4

Post by Tyrant597 »

Code: Select all

<set_value name="$LCurrentPos" exact="player.primaryship.position"/>
where position is [$x, $y, $z]
You don't talks about X:Rebirth...
X4 Mods: Collect Inventory Wares Stations Supply Build Storage Mass Move Marines
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

you could use the debug log to get your data (combined with an ai script that you only somehow limit to 1 loop (1 ship using the ai). You could use


<debug_text text="player.primaryship.position" filter="error" />

and launch your game with -debug all -logfile debug.log. Then the file in your "Documents/Egosoft/X Rebirth/<steamIDnumber>/debug.log will contain your data (with all other sort of errors / warning complaints from scripts all around the place)

It also sometime stop working for some reasons, but generally not without a HUGE load of error beforehand.
delegatevoid
Posts: 6
Joined: Sat, 23. Nov 13, 15:33

Post by delegatevoid »

Tyrant597 wrote:

Code: Select all

<set_value name="$LCurrentPos" exact="player.primaryship.position"/>
where position is [$x, $y, $z]
Could you give a little more information on this solution?
I'm not sure how to use this.
delegatevoid
Posts: 6
Joined: Sat, 23. Nov 13, 15:33

Post by delegatevoid »

After reading it again I think I understand, will look into it
although I have a feeling that writing the log file and analyzing it as it comes in will reduce game performance even more :p
thokitti
Posts: 12
Joined: Sat, 16. Nov 13, 13:46

Post by thokitti »

Anyone got any new ideas how to do this?

I've tested the readprocessmemory approach throu c++, but it aint looking good. The memory pointers are going nuts, and the few i've located would need updates with every version of the game and possible with every combination of mods.

Is there any livestream or export of data functionality in the scripting, except for -debug?

Return to “X Rebirth - Scripts and Modding”