Page 1 of 1

Enable scripts Log

Posted: Wed Oct 18, 2017 3:23 pm
by roguedjack
Hi,

How do I enable script Logs output? eg: in AI.bsf i see calls to Log() and i'd like to read the log.
I tried changing vars like "DebugMode" in TWEAKS.TXT but the game overwrites the file at startup.
Do I have to modify another file or add arguments to the exe like -debug ?
I use Steam if that makes any difference.

Thanks.

Re: Enable scripts Log

Posted: Wed Oct 18, 2017 4:36 pm
by pipfromslitherine
You should make changes to the tweaks in your USER.TXT file in My Documents/My Games/FieldOfGlory2. You should never change files in the installation folder.

DEBUGMODE 1

is the correct setting to add.

Cheers

Pip

Re: Enable scripts Log

Posted: Wed Oct 18, 2017 4:37 pm
by rbodleyscott
roguedjack wrote:Hi,

How do I enable script Logs output? eg: in AI.bsf i see calls to Log() and i'd like to read the log.
I tried changing vars like "DebugMode" in TWEAKS.TXT but the game overwrites the file at startup.
Do I have to modify another file or add arguments to the exe like -debug ?
I use Steam if that makes any difference.

Thanks.
In /Documents/My Games/FieldOfGlory2

there is a file called User.txt

Shut the game down before editing it, or the game will overwrite your edited version when it closes.

Add the line

DEBUGMODE 1

Re: Enable scripts Log

Posted: Wed Oct 18, 2017 4:49 pm
by roguedjack
Thanks!!

Re: Enable scripts Log

Posted: Wed Oct 18, 2017 7:17 pm
by roguedjack
I tried but I dont see Log() outputs in any file. I couldn't find a log.txt for instance, and it doesnt output to error.txt. I suspect Log() just prints to stdout or was disabled in the release?

Its no big deal, I found a workaround.

For anyone else wondering, to output debug stuff from your scripts to error.txt

1) Add the var as explained above in User.txt
DEBUGMODE 1

2) Then in your scripts...
...to output a const string use harcoded

Code: Select all

DebugLog()

...to output a string and a few int vars use

Code: Select all

DebugLogX() DebugLogY()
defined in Functions.bsf.

The lines will output in error.txt prefixed with "SCRIPTDEBUG: "
Might be usefull to people scripting campaigns and what not.
Happy script debugging!

Re: Enable scripts Log

Posted: Wed Oct 18, 2017 8:35 pm
by pipfromslitherine
IIRC Log just outputs to the battle log (toggle using F6 IIRC). DebugLog (as you point out) sends a string to the error.log file and to any attached debug stream.

Cheers

Pip

Re: Enable scripts Log

Posted: Wed Oct 18, 2017 9:58 pm
by roguedjack
Log outputs to the battle log. Thanks again for the help!

Re: Enable scripts Log

Posted: Wed Oct 18, 2017 10:02 pm
by rbodleyscott
roguedjack wrote:Log outputs to the battle log. Thanks again for the help!
Not the combat log.

Press f6 to make the Log() log appear.