Anyway to turn debug mode on?

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

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

SpaceCadet11864
Posts: 476
Joined: Tue, 4. Dec 18, 02:14
x4

Anyway to turn debug mode on?

Post by SpaceCadet11864 »

I see a lot of scripts even an additional menu is available if debug is turned on, any way to turn this on?
A.Persyn
Posts: 121
Joined: Sun, 14. Mar 10, 13:14
x3tc

Re: Anyway to turn debug mode on?

Post by A.Persyn »

Create a shortcut for X4.exe.
Open the Properties window for the shortcut.
In the target section, place a space after the last quotation mark and add: -logfile rebirth.log
EXAMPLE: "d:\SteamLibrary\steamapps\common\X4 Foundations\X4.exe" -logfile rebirth.log
The output file will be in Documents\Egosoft\X4 folder.
SpaceCadet11864
Posts: 476
Joined: Tue, 4. Dec 18, 02:14
x4

Re: Anyway to turn debug mode on?

Post by SpaceCadet11864 »

Thanks!!

I ended up wanting to save each session of logs so here's what I came up with:

Code: Select all

"C:\Program Files (x86)\Steam\steamapps\common\X4 Foundations\X4.exe" -logfile x4-%date:~10,4%-%date:~4,2%-%date:~7,2%_%time%.log
That way its something like: x4-2018-12-10_11:04:11.90.log
linolafett
EGOSOFT
EGOSOFT
Posts: 3544
Joined: Mon, 26. Mar 12, 14:57
x4

Re: Anyway to turn debug mode on?

Post by linolafett »

Thats pretty clever, nice.
01001100 01101001 01101110 01100101 01110011 00100000 01101111 01100110 00100000 01110100 01101001 01101101 01100101 01110011 00101110 00101110 00101110

My art stuff
SpaceCadet11864
Posts: 476
Joined: Tue, 4. Dec 18, 02:14
x4

Re: Anyway to turn debug mode on?

Post by SpaceCadet11864 »

Thanks, but its not writing log files, I even changed it to "rebirth.log" and still no go.

Is steam getting in the way maybe?
EDIT: nervermind, i found the log files xD silly me
sebast076
Posts: 38
Joined: Mon, 27. Apr 09, 16:35
x4

Re: Anyway to turn debug mode on?

Post by sebast076 »

You can add -scriptlogfiles too
SpaceCadet11864
Posts: 476
Joined: Tue, 4. Dec 18, 02:14
x4

Re: Anyway to turn debug mode on?

Post by SpaceCadet11864 »

damn, it doesnt like the dynamic vars though. So I'll just try a batch file then.
SpaceCadet11864
Posts: 476
Joined: Tue, 4. Dec 18, 02:14
x4

Re: Anyway to turn debug mode on?

Post by SpaceCadet11864 »

ah here we go, this is much better!

Code: Select all

@echo off

rem !!--- please change this to where your game is installed. do not add any spacing aroud the equals operator
set X4_EXE_PATH="%PROGRAMFILES(X86)%\Steam\steamapps\common\X4 Foundations\X4.exe"

rem stores a value like `x4-game-2018-12-10_11:04:11.90.log` - to be passed in -logfile
set LOG_FILE_NAME="x4-game-%date:~10,4%-%date:~4,2%-%date:~7,2%_%time%.log"
rem stores a value like `x4-script-2018-12-10_11:04:11.90.log` - to be passed in -scriptlogfile
set SCRIPT_LOG_FILE_NAME="x4-script-%date:~10,4%-%date:~4,2%-%date:~7,2%_%time%.log"

set "exec=%X4_EXE_PATH% -logfile %LOG_FILE_NAME% -scriptlogfile %SCRIPT_LOG_FILE_NAME%"

rem execution phase, first we log out the command, if any of the variables are blank, make sure you dont have whitespace around any of the variables
echo Executing %X4_EXE_PATH% -logfile %LOG_FILE_NAME% -scriptlogfile %SCRIPT_LOG_FILE_NAME%
start "" %X4_EXE_PATH% -logfile %LOG_FILE_NAME% -scriptlogfile %SCRIPT_LOG_FILE_NAME%
Here's the resource should it be added to our growing list of tools and things: https://gist.github.com/MattMcFarland/4 ... 85b5d3b726
SpaceCadet11864
Posts: 476
Joined: Tue, 4. Dec 18, 02:14
x4

Re: Anyway to turn debug mode on?

Post by SpaceCadet11864 »

Oh silly me, just needed to not use colons lol!

just append this to your shortcut:

Code: Select all

 -logfile "x4-game-%date_~10,4%-%date_~4,2%-%date_~7,2%_%time%.log" -scriptlogfile "x4-script-%date_~10,4%-%date_~4,2%-%date_~7,2%_%time%.log"
 
SpaceCadet11864
Posts: 476
Joined: Tue, 4. Dec 18, 02:14
x4

Re: Anyway to turn debug mode on?

Post by SpaceCadet11864 »

ok, so the logs are outputting to the files, but im not seeing that many messages. It seems like debug mode is turned off, how do I turn it on? I should be seeing lots of messages, if you search the files you'll see that debug is a prop that is set to true if debugging is enabled. that prop is checked a lot when it comes to logging. Anyone know how this is turned on?
happyslinky
Posts: 3
Joined: Tue, 4. Dec 18, 06:11
x4

Re: Anyway to turn debug mode on?

Post by happyslinky »

You need to add -debug all to the launch parameters. This is what I'm using:

Code: Select all

-debug all -logfile debuglog.txt
I'm guessing 'all' is a filter level and other values may work. There's a filter param on debug_text like this:

Code: Select all

<debug_text text="'Target: ' + $target + ' is not the boarding operation target ' + $operation + ' - ' + $operation.boardee + ' ' + $operation.boardee.knownname" filter="error"/>
I'm also curious -- does anyone know if there's a way to set $debugchance in the launch parameters? It appears all over the place like this:

Code: Select all

<debug_text text="'Now a child of ' + this.ship.parent + ' ' + this.ship.parent.knownname" chance="$debugoutputchance"/>
SpaceCadet11864
Posts: 476
Joined: Tue, 4. Dec 18, 02:14
x4

Re: Anyway to turn debug mode on?

Post by SpaceCadet11864 »

YES THANK YOU SO MUCH :D :D :D :D :D :D

Run X4 Foundations in debug mode - full guide with batch script so you can have dynamically named logs (timestamp as part of name)
User avatar
paris_england
Posts: 34
Joined: Wed, 3. Oct 18, 01:32
x4

Re: Anyway to turn debug mode on?

Post by paris_england »

Trying to output a file which is more than possible ... except ... I don't want it thrashing my SSD on c:

So does anyone know how to write a file to another drive?
<debug_to_file name="'test.txt'" directory="_not_C/test'" text="player.age" output="false" />
Thanks
User avatar
paris_england
Posts: 34
Joined: Wed, 3. Oct 18, 01:32
x4

Re: Anyway to turn debug mode on?

Post by paris_england »

To answer my own question -- and for want of a better alternative -- symlinks is the only thing I've found so far
morning_star
Posts: 9
Joined: Tue, 30. May 23, 03:46
x4

[help plz] debug files don't come out as they should

Post by morning_star »

Hi folks!

I followed the instructions for creating a batch file to start X4 in debug mode found on
the game starts in debug mode correctly, and it does output (lots of) stuff into that debug file.

however I do not get a seperate x4-game-[timestamp].log and x4-script-[timestamp].log, X4 just creates the standard debug file with no time stamps :(

I copy-pasted the batch code and put in the correct folder path - did I miss something else?

Thanks for any help & have a nice day!
User avatar
Dj_FRedy
Posts: 245
Joined: Mon, 27. Jun 11, 05:58
x4

Re: Anyway to turn debug mode on?

Post by Dj_FRedy »

As far as I know 'scriptlogfile' is an invalid command at the moment; It is noted in the second comment in Git. On the other hand 'scriptlogfiles', without needing to provide a specific file name below, will create a folder called 'logs' with subfolders previously named in the 'directory' attribute for the 'debug_to_file' element.
Try this way, remember to add your [gamePath]. Added 'skipintro' to speed up the start:

Code: Select all

@echo off

set gamePath=C:\SteamLibrary\steamapps\common\X4 Foundations

for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
set datetime=%datetime:~0,4%-%datetime:~4,2%-%datetime:~6,2%__%datetime:~8,2%-%datetime:~10,2%-%datetime:~12,2%
start /d "%gamePath%" X4.exe -skipintro -debug all -scriptlogfiles -logfile debuglog-%datetime%.txt

exit
"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.

Return to “X4: Foundations - Scripts and Modding”