I am trying to place a new keywork that has been introduced in 8.0 into the wares.xml file.
In particular the line:
<ware id="modpart_enginefuelinjector_t1" name="{20201,30301}" description="{20201,30302}" transport="inventory" volume="1" tags="crafting equipmentmodpart inventory primarymodpart">
I want to add the following:
group="generalitem"
It goes after the:
<ware id="modpart_enginefuelinjector_t1" name="{20201,30301}" description="{20201,30302}"
and before:
transport="inventory" volume="1" tags="crafting equipmentmodpart inventory primarymodpart">
I have:
<add sel="//ware[@id='modpart_enginefuelinjector_t1' name='{20201,30301}' description='{20201,30302}']" pos="after"> group="generalitem"
but that, obviously, doesn't work.
Can someone point me in the right direction and tell me what I am doing wrong?
Help with scripting
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 6655
- Joined: Mon, 5. May 08, 00:05
Re: Help with scripting
I'm no "modder", so these are only basic XML pointers:
Cleaned up version:
Note: I only checked for basic XML errors, not the content itself.
---
edit: since you want to add an attribute to a tag the formal way of doing so is this:
https://datatracker.ietf.org/doc/html/r ... tion-4.3.2
note: again, this is pure XML stuff. Wether or not that new attribute is processed by X4 I do not know.
This is no valid XML. It contains quotation errors and the group attribute is outside of the add tag. There is also an invalid / incomplete sequence in the description attribute (']). The sel attribute is incomplete as well.<add sel="//ware[@id='modpart_enginefuelinjector_t1' name='{20201,30301}' description='{20201,30302}']" pos="after"> group="generalitem"
Cleaned up version:
Code: Select all
<add
sel="//ware[@id='modpart_enginefuelinjector_t1']"
name="{20201,30301}"
description="{20201,30302}"
pos="after"
group="generalitem"
/>
---
edit: since you want to add an attribute to a tag the formal way of doing so is this:
https://datatracker.ietf.org/doc/html/r ... tion-4.3.2
note: again, this is pure XML stuff. Wether or not that new attribute is processed by X4 I do not know.

Spoiler
Show
BurnIt: Boron and leaks don't go well together...
Königinnenreich von Boron: Sprich mit deinem Flossenführer
Nila Ti: Folgt mir, ihr Kavalkade von neugierigen Kreaturen!
Tammancktall: Es ist eine Ehre für sie mich kennenzulernen...
CBJ: Thanks for the savegame. We will add it to our "crazy saves" collection [..]
Feature request: paint jobs on custom starts
Königinnenreich von Boron: Sprich mit deinem Flossenführer
Nila Ti: Folgt mir, ihr Kavalkade von neugierigen Kreaturen!
Tammancktall: Es ist eine Ehre für sie mich kennenzulernen...
CBJ: Thanks for the savegame. We will add it to our "crazy saves" collection [..]

-
- Posts: 53
- Joined: Sun, 29. Aug 10, 22:30
Re: Help with scripting
The tag is the new tag introduced in 8.0 for the crafting work bench. It is how it decides which tab the item will appear under.
I try your code and run in debug, see if it adds the tag in between the description tag and transport tag
I try your code and run in debug, see if it adds the tag in between the description tag and transport tag
-
- Posts: 436
- Joined: Mon, 12. Feb 07, 21:58
Re: Help with scripting
There is a guide how to write a diff files [TUTORIAL] XML Patch Guide
And in case of adding the attribute diff should look like:
For may be faster answer welcome to Egosoft Discord, and choose then x4_modding channel 
And in case of adding the attribute diff should look like:
Code: Select all
<add sel="//ware[@id='modpart_enginefuelinjector_t1']" type="@group">generalitem</add>

Last edited by ChemODun on Thu, 31. Jul 25, 16:52, edited 1 time in total.
Multiply entropy by absolute zero
Freedom in space
Freedom in space
-
- Posts: 53
- Joined: Sun, 29. Aug 10, 22:30
Re: Help with scripting
No, that didn't add the tag either, it complains that the syntax is wrong. Any other ideas? I've reading the documentation link you posted, but seems to say what you posted is correct, but it isn't (or at least it error's out in the debug log).
-
- Posts: 53
- Joined: Sun, 29. Aug 10, 22:30
Re: Help with scripting
No, that still did not add the tag, still gives a syntax error in the debug log (it didn't like the 'type=') and the statement does not end correctly.ChemODun wrote: ↑Thu, 31. Jul 25, 14:45 There is a guide how to write a diff files [TUTORIAL] XML Patch Guide
And in case of adding the attribute diff should look like:For may be faster answer welcome to Egosoft Discord, and choose then x4_modding channelCode: Select all
<add sel="//ware[@id='modpart_enginefuelinjector_t1']" type="@group">generalitem</>
![]()
-
- Posts: 436
- Joined: Mon, 12. Feb 07, 21:58
Re: Help with scripting
Let's study the guide and do it by own hands.
Only one thing - structure for adding the attribute is right, I simple made error in xml closing tag.
And this is loaded for me without errors ....
Only one thing - structure for adding the attribute is right, I simple made error in xml closing tag.
And this is loaded for me without errors ....
Code: Select all
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<diff>
<add sel="/wares/ware[@id='modpart_enginefuelinjector_t1']" type="@group">generalitem</add>
</diff>
Multiply entropy by absolute zero
Freedom in space
Freedom in space
-
- Posts: 436
- Joined: Mon, 12. Feb 07, 21:58
Re: Help with scripting
Do you have any progress?
Multiply entropy by absolute zero
Freedom in space
Freedom in space