Tamina wrote:Hmmm I see, thank you very very much for your great help.
I added your nickname ()as well as w.evans in the workshop (need to contact the uploader first) and in the mod description under "author".Hope you don't mind.
Well I tried the md-script variant and used/copied the one from mission computer but I get neither an error nor does the Dubstep Mine
(http://forum.egosoft.com/viewtopic.php?t=374998)
show up at the black market dealer.
Especially because it is so complicated. He has one new md script and additionally overrides an existing one and in both he does exactly the same. I have no idea why his script is so redundant.
Well I am ignoring that for now.
---------------------------------------------------------
Now there is one LAST thing:
How to add additional macros? Right now I am overwriting an existing one but that makes the existing object useless.
So I just:
- copy&pasted the existing macro file completely (changed wanted parameters)
- renamed it to a unique file name
- registered it in the index file macros.xml
- connected the macro file name with the "ware" in wares.xml
Again, no error -.- (I hate it when there are no errors but it doesn't work nonetheless) but when I throw out the mine, it is just a container and not the mine anymore as when I just use the existing macro file.
So I guess my macro file is not valid or "existing" in the game for some reason.
Anyone experiemented with macro files before?
[HELP] Add macro script
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Moderator (Deutsch)
- Posts: 4630
- Joined: Sun, 26. Jan 14, 09:56
[HELP] Add macro script
Hi,
Last edited by Tamina on Mon, 15. Dec 14, 22:09, edited 5 times in total.
Code: Select all
Und wenn ein Forenbösewicht, was Ungezogenes spricht, dann hol' ich meinen Kaktus und der sticht sticht sticht.
/l、
゙(゚、 。 7
l、゙ ~ヽ /
じしf_, )ノ
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
-
- Moderator (Deutsch)
- Posts: 4630
- Joined: Sun, 26. Jan 14, 09:56
Okay thank you very much I found it there!w.evans wrote:I'm afraid I have no idea what you're talking about, but it's probably in \assets somewhere. Was it in space? \assets\props\ or \assets\units\ maybe?

Does someone know how to add a new ware to a trader?
> I created a new ware in ware.xml.
It works, when I put it in the inventory of the skunk it shows up.
> Then I opened the Setup.xml and added my ware by simple adding it to the specific traders ware list
Code: Select all
[ware.newware, 1, 10, 100]
I tried altering a value from an existing ware and the changes are definitly ingame. So why is my new ware not showing up?
Is there another file I need to modify?
I looked into other mods adding (soft)wares but didn't found anything useful there.
Code: Select all
Und wenn ein Forenbösewicht, was Ungezogenes spricht, dann hol' ich meinen Kaktus und der sticht sticht sticht.
/l、
゙(゚、 。 7
l、゙ ~ヽ /
じしf_, )ノ
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
i would bet you tried directly editing the file, but with existing xml files we still work with diff files 
and another hint: dont edit the Array directly, but rather add your new ware with an <append_to_list /> - this way it stays compatible even if someone adds another Ware in the same Category
since i am not sure in which category you want to add your Ware i will use *** as the name - just put in the Category you want there
this method may only work in a new Game though, if you want to make it work in an existing game and new Game you have to write a new MDScript wich is definietly executed AFTER the Setup.xml finished, and in there you just need to put the <action><append_to_list name="md.***.{1}.{1}" exact="[ware.newware, 1, 10, 100]" /></action> - but i am not familiar enough with the MD yet to explain how to do this - maybe someone else can help here? 
EDIT: NOTE: i just noticed there are also only single-nested lists in that file - in this case you just need one .{1}
double nested example: ( .{1}.{1} )
single nested example: ( .{1} )

and another hint: dont edit the Array directly, but rather add your new ware with an <append_to_list /> - this way it stays compatible even if someone adds another Ware in the same Category

since i am not sure in which category you want to add your Ware i will use *** as the name - just put in the Category you want there

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<diff>
<add sel='//set_value[@name="md.***"]' pos="after">
<!-- the .{1}.{1} is to account for the nested lists in which the Wares are defined -->
<append_to_list name="md.***.{1}.{1}" exact="[ware.newware, 1, 10, 100]" />
</add>
</diff>

EDIT: NOTE: i just noticed there are also only single-nested lists in that file - in this case you just need one .{1}

double nested example: ( .{1}.{1} )
Code: Select all
<set_value name="md.$SoftwareUpgradetraderLists" exact="
[
[
[ware.upg_pla_software_tc_mk1, 1, 1, 100]
]
]
"/>
Code: Select all
<set_value name="md.$ArchitectDroneList2" exact="
[
[ware.drp_construction]
]
"/>
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
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

-
- Moderator (Deutsch)
- Posts: 4630
- Joined: Sun, 26. Jan 14, 09:56
Great that worked!
I can change values in this array but I can't add values except when I am adding them like you have written.
I don't understand it but it works
Now I am doing this also for the other files, as I changed some values in a macro file but the game seems to ignore them :/
I can change values in this array but I can't add values except when I am adding them like you have written.
I don't understand it but it works

Now I am doing this also for the other files, as I changed some values in a macro file but the game seems to ignore them :/
Code: Select all
Und wenn ein Forenbösewicht, was Ungezogenes spricht, dann hol' ich meinen Kaktus und der sticht sticht sticht.
/l、
゙(゚、 。 7
l、゙ ~ヽ /
じしf_, )ノ
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
best enable the debuglog ( startup parameter -logfile debuglog.txt ), start the Game and when you are in the main menu look into this Logfile (you'll find it right next to your saves folder
) - it usually tells you what the game doesnt like with your Mod 
also note that your XPath needs to be unique - if it matches 2 or more nodes/attributes it will also not work (gives the same error in the debuglog as when no match could be found)


also note that your XPath needs to be unique - if it matches 2 or more nodes/attributes it will also not work (gives the same error in the debuglog as when no match could be found)
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
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

-
- Moderator (Deutsch)
- Posts: 4630
- Joined: Sun, 26. Jan 14, 09:56
Thanks for your help
Hmmm it just says
However it shows up in the wares so I guess I can ignore that.
Well now figuring out why changing the values of a macro file still gets ignored.
Hmmm it just says
Code: Select all
[=ERROR=] Error loading MD file extensions\cat\md\Setup.xml: Ignoring root node 'diff' in XML file 'extensions\cat\md\Setup.xml'.
Well now figuring out why changing the values of a macro file still gets ignored.
Code: Select all
Und wenn ein Forenbösewicht, was Ungezogenes spricht, dann hol' ich meinen Kaktus und der sticht sticht sticht.
/l、
゙(゚、 。 7
l、゙ ~ヽ /
じしf_, )ノ
-
- Posts: 2963
- Joined: Tue, 18. Nov 14, 16:23
I haven't gotten my head around MD scripting yet either, but lots of information on the subject here:
http://www.egosoft.com/download/x_rebir ... rGuide.pdf
Might also help to take a look at cyberfuzzie's Mission Computer mod here:
http://forum.egosoft.com/viewtopic.php?t=371250
since he also modifies Setup.xml
http://www.egosoft.com/download/x_rebir ... rGuide.pdf
Might also help to take a look at cyberfuzzie's Mission Computer mod here:
http://forum.egosoft.com/viewtopic.php?t=371250
since he also modifies Setup.xml
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
yep, that one can be safely ignored - the Game is trying to interpret a diff file as new/additional MDScript, which naturally fails, but it also will use it as diff file in a secont attempt to interpret itTamina wrote:Thanks for your help
Hmmm it just saysHowever it shows up in the wares so I guess I can ignore that.Code: Select all
[=ERROR=] Error loading MD file extensions\cat\md\Setup.xml: Ignoring root node 'diff' in XML file 'extensions\cat\md\Setup.xml'.
Well now figuring out why changing the values of a macro file still gets ignored.

regarding the Macro: if you use a Savegame the Values you want to change may be stored with the existing Object in the Save, so for testing a new Game is better suited


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

-
- Moderator (Deutsch)
- Posts: 4630
- Joined: Sun, 26. Jan 14, 09:56
@w.evans
I already do
Thanks 
@UniTrader
Well neither the macro file nor the Setup.xml file seem to get updated when loading an existing save.
What do you mean with "<update_macro/>"? I searched it and found nothing on the forum? What to do with it?
Again thanks, thanks, thanks, and double thanks
I already do


@UniTrader
Well neither the macro file nor the Setup.xml file seem to get updated when loading an existing save.
What do you mean with "<update_macro/>"? I searched it and found nothing on the forum? What to do with it?

Again thanks, thanks, thanks, and double thanks

Code: Select all
Und wenn ein Forenbösewicht, was Ungezogenes spricht, dann hol' ich meinen Kaktus und der sticht sticht sticht.
/l、
゙(゚、 。 7
l、゙ ~ヽ /
じしf_, )ノ
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
for the macro: as i said many values are stored in the Save for existing Objects and are not automatically udated from Game Data when a save is loadedTamina wrote:@UniTrader
Well neither the macro file nor the Setup.xml file seem to get updated when loading an existing save.
for the Setup.xml: in fact this File IS updated/changed, but this Script is only executed once at Gamestart - so if you change it in a save it wont have any effect since this part has been executed before the change and the variables are all already set. As mentoined earlier you can change them afterwards with a new MDScript, but i cannt tell how to write this exactly
Its a new Script Command which came with 3.0 Beta 3 - basically it updates macros which were changed (so Values usually stored in the save are updated by using actual Game Data instead)Tamina wrote:What do you mean with "<update_macro/>"? I searched it and found nothing on the forum? What to do with it?
and sorry, remembered the name wrong. for multiple objects you need to execute a
<patch_macros macro="macro.yourchangedmacro" />
and if its just a single Object (or not many of them) a
<patch_macro object="player.primaryship" />
is sufficient - saves a perhaps demanding search for all related Objects

not sure how to use it optimally yet (only abused it for another purpose so far), but i think an MDScript which is bound to the save loaded event is most apporiate for that.. (also new in 3.0)
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
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

-
- Moderator (Deutsch)
- Posts: 4630
- Joined: Sun, 26. Jan 14, 09:56
Hmmm I see, thank you very very much for your great help. 
I added your nickname (as well as w.evans) in the workshop (need to contact the uploader first) and in the mod description under "author".
Hope you don't mind.
Well I tried the md-script variant and used/copied the one from mission computer but I get neither an error nor does the Dubstep Mine
(http://forum.egosoft.com/viewtopic.php?t=374998)
show up at the black market dealer.
Especially because it is so complicated. He has one new md script and additionally overrides an existing one and in both he does exactly the same. I have no idea why his script is so redundant.
Well I am ignoring that for now.
---------------------------------------------------------
Now there is one LAST thing:
How to add additional macros? Right now I am overwriting an existing one but that makes the existing object useless.
So I just:
- copy&pasted the existing macro file completely (changed wanted parameters)
- renamed it to a unique file name
- registered it in the index file macros.xml
- connected the macro file name with the "ware" in wares.xml
Again, no error -.- (I hate it when there are no errors but it doesn't work nonetheless) but when I throw out the mine, it is just a container and not the mine anymore as when I just use the existing macro file.
So I guess my macro file is not valid or "existing" in the game for some reason.
Anyone experiemented with macro files before?

I added your nickname (as well as w.evans) in the workshop (need to contact the uploader first) and in the mod description under "author".

Well I tried the md-script variant and used/copied the one from mission computer but I get neither an error nor does the Dubstep Mine
(http://forum.egosoft.com/viewtopic.php?t=374998)
show up at the black market dealer.
Especially because it is so complicated. He has one new md script and additionally overrides an existing one and in both he does exactly the same. I have no idea why his script is so redundant.
Well I am ignoring that for now.
---------------------------------------------------------
Now there is one LAST thing:
How to add additional macros? Right now I am overwriting an existing one but that makes the existing object useless.
So I just:
- copy&pasted the existing macro file completely (changed wanted parameters)
- renamed it to a unique file name
- registered it in the index file macros.xml
- connected the macro file name with the "ware" in wares.xml
Again, no error -.- (I hate it when there are no errors but it doesn't work nonetheless) but when I throw out the mine, it is just a container and not the mine anymore as when I just use the existing macro file.
So I guess my macro file is not valid or "existing" in the game for some reason.
Anyone experiemented with macro files before?
Code: Select all
Und wenn ein Forenbösewicht, was Ungezogenes spricht, dann hol' ich meinen Kaktus und der sticht sticht sticht.
/l、
゙(゚、 。 7
l、゙ ~ヽ /
じしf_, )ノ
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
did you change the name in the file itself? thats more important than the file name 
in this line here:
<macro name="units_size_xl_xenon_01_macro" class="ship_xl">
also have you provided the full path from the root to your macro file, including Extensions/yourExtension? also an common mistake

in this line here:
<macro name="units_size_xl_xenon_01_macro" class="ship_xl">
also have you provided the full path from the root to your macro file, including Extensions/yourExtension? also an common mistake

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

-
- Moderator (Deutsch)
- Posts: 4630
- Joined: Sun, 26. Jan 14, 09:56
o_o okaaaay.
I did/copied everything the mission computer mod did. And it definitely doesn't uses the full path.
(Of course with the permission of the author)
Well thanks.
Then the final update is nearly ready to come.
Trust me UniTrader, you don't want to do all this md-stuff.
Even though I would have liked it if you had already fiddled around with it as the most helpful member in the modding community it seems
Well one day you have to work with them by yourself and then I am going to be there for you (or not, depends if I see your thread
)
I did/copied everything the mission computer mod did. And it definitely doesn't uses the full path.
(Of course with the permission of the author)
Well thanks.
Then the final update is nearly ready to come.
Trust me UniTrader, you don't want to do all this md-stuff.
Even though I would have liked it if you had already fiddled around with it as the most helpful member in the modding community it seems

Well one day you have to work with them by yourself and then I am going to be there for you (or not, depends if I see your thread

Code: Select all
Und wenn ein Forenbösewicht, was Ungezogenes spricht, dann hol' ich meinen Kaktus und der sticht sticht sticht.
/l、
゙(゚、 。 7
l、゙ ~ヽ /
じしf_, )ノ
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
well, mostly i use it for spawning stuff & warping the player to the spot currently of interest for me to save time, but didnt do much more yet.. (although i am planning to make a longer Plot with it.. but the Shipyard has to be finished first.. and currently not really in the mood to do modding stuff myself..)Tamina wrote:Trust me UniTrader, you don't want to do all this md-stuff.
Even though I would liked it if you had fiddled around with it as the most helpful member in the modding community it seems
regarding how the MC did it: does it have a subst01.cat/dat? that one replaces files and paths in there are handled like they were in the Game Root Folder - opposed to the ext01.cat/dat which are handled like they are in the Extension Folder itself

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