Help MD editing: how to add to an existing "list"?

The place to discuss scripting and game modifications for X4: Foundations.

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

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

Help MD editing: how to add to an existing "list"?

Post by Realspace » Thu, 1. Feb 24, 20:16

This is an easy question for scripters, I hope.
Basically I need to add the sectors added by my mod to the lists that the MD uses for various plots and scenes.

The game simply uses this kind of grouping to differentiate between BASE GAME sectors and DLC sectors.

Code: Select all

 <find_sector name="$SplitSectors" extension="'ego_dlc_split'" multiple="true"/>
        <find_sector name="$BaseSectors" extension="''" multiple="true"/>
Using the extension tag it can quickly list the sectors accordingly.

So this is the code that states what BASE SECTORS are, basically it calls all sectors (but not those added by my mod) except DLC's

Code: Select all

<find_sector name="$BaseSectors"  multiple="true" extension="''"/>
I want my mod's sectors to be seen as base sector so I tried to add my mod as second name called, i.e.:

Code: Select all

 <find_sector name="$BaseSectors"  multiple="true" extension="''"/>
 <find_sector name="$BaseSectors"  multiple="true" extension="'xrsge'"/>
But if doing so, the first is discarded. So the game 'correctly' uses only my mod's sectors as base sector. So any XRSGE sector leading to SPLIT sector activates the scenes/plot. But base sectors do not anymore.
Basically I only need to create a sum of the two lists, I tried add_to_group and add_to_list but no success, only errors

How do I merge the two above? How can I add my sectors to the existing $BaseSectors? Which is then used to list groups of gates, pathways etc.

P.S. in the previous version of my mod I simply replaced the entire <find_sector with a list of macros, i.e. all the sectors called one by one.

It was <find_sector name="$BaseSectors" space="player.galaxy" extension="'xrsge'" multiple="true" macro="[macro.cluster_01_sector001_macro, macro.cluster_01_sector002_macro, macro.cluster_02_sector001_macro, macro.cluster_03_sector001_macro, ETC ETC

It worked only bc I had moved all the base sectors in XRSGE but now no more, so even if using <find_sector name="$BaseSectors" space="player.galaxy" extension="''" it gives me error in the MD, basically the engine does not find base sectors anymore

User avatar
Dj_FRedy
Posts: 237
Joined: Mon, 27. Jun 11, 05:58
x4

Re: Help MD editing: how to add to an existing "list"?

Post by Dj_FRedy » Thu, 1. Feb 24, 21:12

Try 'append_list_elements': Append elements from another list at the end of a list

Code: Select all

 <find_sector name="$BaseSectors"  multiple="true" extension="''"/>
 <find_sector name="$BaseSectors_xrsge"  multiple="true" extension="'xrsge'"/>
 <append_list_elements name="$BaseSectors" other="$BaseSectors_xrsge"/>
"All my contributions to the Technical Support and Public Beta Feedback sections will be concise and to the point, no diatribes, that's what the other sections are for".
Thank you for your efforts.

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

Re: Help MD editing: how to add to an existing "list"?

Post by Realspace » Thu, 1. Feb 24, 21:26

Dj_FRedy wrote:
Thu, 1. Feb 24, 21:12
Try 'append_list_elements': Append elements from another list at the end of a list

Code: Select all

 <find_sector name="$BaseSectors"  multiple="true" extension="''"/>
 <find_sector name="$BaseSectors_xrsge"  multiple="true" extension="'xrsge'"/>
 <append_list_elements name="$BaseSectors" other="$BaseSectors_xrsge"/>
Yes thank you! I had just tried this same solution, after reading this old post viewtopic.php?t=419896

So basically did the same code as yours, adding also the append="true" as told in the topic, but don't know whether it makes a difference or not

Code: Select all

 <replace sel="/mdscript/cues/cue[@name='DLC_Split_Prelude']/actions/find_sector[@name='$BaseSectors']">
 <find_sector name="$BaseSectors"  multiple="true" append="true" extension="''"/>
 <find_sector name="$BaseSectorsXRSGE"  multiple="true" append="true" extension="'xrsge'"/>
   <append_list_elements name="$BaseSectors" other="$BaseSectorsXRSGE"/>
 </replace>
Anyway, I hope this thread can help others too, a very useful function so one can patch the md plots without doing damages :mrgreen:

-----------------------
EDIT: I still get this error in the log:

Code: Select all

[=ERROR=] 0.00 Error in MD cue md.Setup_DLC_Split.DLC_Split_Prelude: Property lookup failed: $g.exit.sector
* $g.exit == null
* Expression: $SplitSectors.indexof.{$g.sector} and $BaseSectors.indexof.{$g.exit.sector}
* Action: <do_if>, line 241
Seems like the engine can not generate the gate's list from BaseSectors, if I read correctly. But the script works fine, it recognizes both gates from base game AND my mod's when going into Split space, so don't know why this error persists

Return to “X4: Foundations - Scripts and Modding”