Any easy way to find player position "address"?

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

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

Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Any easy way to find player position "address"?

Post by Rubini »

Hi mates,

Any easy way to find player address names? Something like:
"Radiant Belt, Glaring Truth, Devries" ? If so, is it also possible to get short names (Devries = DV, Albion=AL, etc)?

I'm awared about ".knowname" (for zone/sector/cluster), but I could not found any direct&complete address or a short name function. Any idea? :?:
Thanks in any advice!
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

'%1, %2, %3'.[player.cluster.name,player.sector.name,player.zone.name]

basically it is the method for text substitution/completion - an expression in the form $string.$list replaces the %1, %2 etc. in $string with the respective Elements of the $list

although the last or even last two have to be omitted when inside a green/blue tube because these dont have meaningful Names
for the short variants no idea (ok, i have one but its too complicated for this purpose.. and only applies to Vanilla, not necesarily to Mods)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)
Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini »

UniTrader wrote:'%1, %2, %3'.[player.cluster.name,player.sector.name,player.zone.name]

basically it is the method for text substitution/completion - an expression in the form $string.$list replaces the %1, %2 etc. in $string with the respective Elements of the $list

although the last or even last two have to be omitted when inside a green/blue tube because these dont have meaningful Names
for the short variants no idea (ok, i have one but its too complicated for this purpose.. and only applies to Vanilla, not necesarily to Mods)
Thanks UniTrader by the input.
I already know about these. My question is if we have a function that automatically shows the player address without the need of the three above functions (zone/sector/cluster). And perhaps a short name function, because the names are too long (example: "Fields of Opportunity", a best result should be "FO"). The long names don´t fit in a line on the PDA.
Thanks anyway! :wink:
User avatar
YorrickVander
Posts: 2774
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

As the only place I've seen those short names in game is the map, I took a look at the code for it. This appears to be what you need, or at least the start point : (menu_map.lua line 661)

Code: Select all

shortname = ffi.string(C.GetMapShortName(C.GetContextByClass(menu.component, "cluster", false))) .. "." .. ffi.string(C.GetMapShortName(menu.component))
At this point the code is grabbing the sectors in the cluster for the map list like

>AL.FO<.1 : The Big Empty
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.
User avatar
wysiwyg
Posts: 585
Joined: Thu, 26. Feb 04, 00:08
x4

Post by wysiwyg »

The only place where I can find that the shortened names are accessible is inside the UI.

Code: Select all

 some_variable = GetComponentData( componentID, "mapshortname" ) 
will yield the familiar DV.GT.GS style name as a string that can be manipulated inside the UI.

In MD/AI script you could parse the long name and link it to some look-up table that you would have to code by hand.

It may also be possible to write dummy call to some UI code that doesn't actually display anything but returns with a table of values mapping long names to short ones - I'd do this once at gameload rather than every time the data is needed to prevent un-necessary access to the UI.

EDIT: Great minds think alike :D
Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini »

Thanks mates by the inputs!

I will try to learn how to call a Ui routine or will just work with strings directly on Md xml files, perhaps this is a more easy way. :wink:
User avatar
YorrickVander
Posts: 2774
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

well untill the new raise_ui_event function goes in you are limited to using lua code only from sectionhandlers, as i described with that thing for station scanning (and example code therein). The easy way is to make a library cue (see MD guide from ES) to do the string conversion on demand in xml scripting only :)
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.

Return to “X Rebirth - Scripts and Modding”