Enable scripts Log

Post Reply
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 129
Joined: Wed Oct 18, 2017 1:40 pm

Enable scripts Log

Post 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.
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
pipfromslitherine
Site Admin
Site Admin
Posts: 9886
Joined: Wed Mar 23, 2005 10:35 pm

Re: Enable scripts Log

Post 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
follow me on Twitter here
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: Enable scripts Log

Post 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
Richard Bodley Scott

Image
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 129
Joined: Wed Oct 18, 2017 1:40 pm

Re: Enable scripts Log

Post by roguedjack »

Thanks!!
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 129
Joined: Wed Oct 18, 2017 1:40 pm

Re: Enable scripts Log

Post 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!
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
pipfromslitherine
Site Admin
Site Admin
Posts: 9886
Joined: Wed Mar 23, 2005 10:35 pm

Re: Enable scripts Log

Post 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
follow me on Twitter here
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 129
Joined: Wed Oct 18, 2017 1:40 pm

Re: Enable scripts Log

Post by roguedjack »

Log outputs to the battle log. Thanks again for the help!
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: Enable scripts Log

Post 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.
Richard Bodley Scott

Image
Post Reply

Return to “Field of Glory II: Modding”