Debug File

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

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

Post Reply
werit
Werit Gaming
Posts: 39
Joined: Mon, 8. Jul 19, 14:45
x4

Debug File

Post by werit » Wed, 24. Jul 19, 01:40

Hi all,

I was able to get the debug file created. Are debug prints from all of the built-in scripts/xml files turned off by default? The log is very quiet. If they are disabled, is there an easy way to enable them?

It seems like

Code: Select all

<set_value name="$DebugChance" exact="0"/>
disables debugging on a per file basis.

Thanks!

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Debug File

Post by euclid » Wed, 24. Jul 19, 13:48

Hi werit,

Yes, most but not all are set to zero chance. You are on the right track. Just set the chance to 100 for the specific scripts you want to check. However, be aware that there are various names, like $DebugChance2. If you want to "see" them all then I recommend a file search utility, for example AstroGreb.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

werit
Werit Gaming
Posts: 39
Joined: Mon, 8. Jul 19, 14:45
x4

Re: Debug File

Post by werit » Wed, 24. Jul 19, 14:18

euclid wrote:
Wed, 24. Jul 19, 13:48
Hi werit,

Yes, most but not all are set to zero chance. You are on the right track. Just set the chance to 100 for the specific scripts you want to check. However, be aware that there are various names, like $DebugChance2. If you want to "see" them all then I recommend a file search utility, for example AstroGreb.

Cheers Euclid
Thanks, Euclid!

I also just saw this:

viewtopic.php?p=4626955#p4626955

The post mentions something about a diff file that could use XPath to replace them seemingly at runtime.

Does this apply to X4 as well, and is there any more information about diff files?

Thanks!

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Debug File

Post by euclid » Wed, 24. Jul 19, 14:59

XML patching/Editing is not new. There are various tutorials, for example this by theqmann. So in short: Yes, all those XML Edit commands also apply to X4.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

werit
Werit Gaming
Posts: 39
Joined: Mon, 8. Jul 19, 14:45
x4

Re: Debug File

Post by werit » Wed, 24. Jul 19, 15:13

euclid wrote:
Wed, 24. Jul 19, 14:59
XML patching/Editing is not new. There are various tutorials, for example this by theqmann. So in short: Yes, all those XML Edit commands also apply to X4.

Cheers Euclid
Thanks! Do you have any idea how the -debug all command-line option fits into all this?

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Debug File

Post by euclid » Wed, 24. Jul 19, 20:28

Nope, sorry, I've never used that but suspect it will spam your debug.log ;-)

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

werit
Werit Gaming
Posts: 39
Joined: Mon, 8. Jul 19, 14:45
x4

Re: Debug File

Post by werit » Wed, 24. Jul 19, 21:18

euclid wrote:
Wed, 24. Jul 19, 20:28
Nope, sorry, I've never used that but suspect it will spam your debug.log ;-)

Cheers Euclid
Ok, so to turn on debugging for something like FactionLogic.xml, I created a file with the same name in my mod. In it I have:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<diff>
  <replace sel='/mdscript/cues/library[@name="Manager"]/params/param[@name="DebugChance"]/@default'>100</replace>
  <replace sel='/mdscript/cues/library[@name="Manager"]/params/param[@name="DebugChance2"]/@default'>100</replace>
</diff>
Is that what I should be doing to turn on the debug prints? I don't get any node errors, but no output either.

Thanks!

Mysterial
Posts: 644
Joined: Wed, 6. Nov 02, 20:31
x4

Re: Debug File

Post by Mysterial » Thu, 25. Jul 19, 17:10

That would only work on a new game. In an existing game the cues already exist so changing parameters will do nothing. You would have to add a cue in the library that sets the values... but even that will not propagate everywhere, because the goals copy the main manager value, the subgoals copy the goal's value, etc etc. If you're set on enabling it for an existing game you will be better off figuring out what you actually want to debug and change the values at that level.

werit
Werit Gaming
Posts: 39
Joined: Mon, 8. Jul 19, 14:45
x4

Re: Debug File

Post by werit » Thu, 25. Jul 19, 23:22

Yay, a solution!

This will turn on the debugging logs in FactionLogic. You would also need to do it for things like DebugChance2.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<diff>
  <add sel='/mdscript/cues/library[@name="Manager"]/cues'><cue name="Debugger"><actions><set_value name="$DebugChance" exact="100"/></actions></cue></add>
</diff>
Thanks to all who helped :)

Post Reply

Return to “X4: Foundations - Scripts and Modding”