Print variables from source code to external file

Discussions about Coding and Scripting
bunny
Posts: 1
Joined: Sun Oct 31, 2021 9:45 am

Print variables from source code to external file

Post by bunny » Sun Oct 31, 2021 9:52 am

I'm looking for a method to get variables about a player such as his speed, location from the source file onto a text file or any external file. As goal to get useful information about the players while recording the games with the demomanager I found online. Is this possible to achieve as I'm new into unreal script.

User avatar
Barbie
Godlike
Posts: 2394
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Print variables from source code to external file

Post by Barbie » Sun Oct 31, 2021 9:31 pm

Writing to a free chosen file is not possible in UScript, but you can use the LOG() function to write that to the log file. Ofc you have to extract these lines afterwards.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett

Eternity
Experienced
Posts: 103
Joined: Sat Nov 30, 2019 10:56 pm

Re: Print variables from source code to external file

Post by Eternity » Sun Oct 31, 2021 9:46 pm

Now i wonder how NexGen does it... There should be a way...

User avatar
f7r
Average
Posts: 74
Joined: Mon Oct 19, 2020 6:53 pm

Re: Print variables from source code to external file

Post by f7r » Sun Oct 31, 2021 10:02 pm

Eternity wrote:
Sun Oct 31, 2021 9:46 pm
Now i wonder how NexGen does it... There should be a way...
This way is a 'native function' in external library on C++.

User avatar
Feralidragon
Godlike
Posts: 5454
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Print variables from source code to external file

Post by Feralidragon » Sun Oct 31, 2021 10:09 pm

Well, technically, you can indeed write to external files using UScript.

There's a whole thread about it, feel free to search it. (:

Eternity
Experienced
Posts: 103
Joined: Sat Nov 30, 2019 10:56 pm

Re: Print variables from source code to external file

Post by Eternity » Mon Nov 01, 2021 3:03 am

f7r wrote:
Sun Oct 31, 2021 10:02 pm
This way is a 'native function' in external library on C++.
Of course, with custom external library it is not any problem to do this.
But NexGen does not use any custom external libraries. Maybe there are some undocumented native functions existing in standard libraries...

Automatically merged

Now i see... NexGen uses 'StatLog'/'StatLogFile' native classes that contain all related native functions...
No questions here anymore.

Automatically merged

Found related thread by keyword "StatLogFile".

Buggie
Godlike
Posts: 1489
Joined: Sat Mar 21, 2020 5:32 am

Re: Print variables from source code to external file

Post by Buggie » Mon Nov 01, 2021 7:36 am

Pure uscript:

1. Make class with few config text fields, set separate ini file for config.
Each time when need save data call SaveConfig.

2. Or use Log, as mention above.

3. UT able make simple HTTP requests, so you can setup local webserver and call some requests for send data.

4. UT able work with IRC server, so you can setup local IRC server and use it for receive data.

5. Not sure, but look like UT able work with sockets in some way, like it do for query master server. This too can be used for send data.

If this need on server:

6. If you able modify GameType - can send some data as answer for query server.

7. You can use internal web server for answer on requests via HTTP.

Higor
Godlike
Posts: 1835
Joined: Sun Mar 04, 2012 6:47 pm

Re: Print variables from source code to external file

Post by Higor » Mon Nov 01, 2021 10:15 am

Or use XC_Core.BinarySerializer...
ImageImage
Image unreal://23.111.157.138:7777
Image unreal://46.228.199.205:7788