Print variables from source code to external file

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

Print variables from source code to external file

Post by bunny »

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: 2802
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 »

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
Skilled
Posts: 172
Joined: Sat Nov 30, 2019 10:56 pm

Re: Print variables from source code to external file

Post by Eternity »

Now i wonder how NexGen does it... There should be a way...
User avatar
f7r
Experienced
Posts: 111
Joined: Mon Oct 19, 2020 6:53 pm

Re: Print variables from source code to external file

Post by f7r »

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: 5493
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 »

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

There's a whole thread about it, feel free to search it. (:
Eternity
Skilled
Posts: 172
Joined: Sat Nov 30, 2019 10:56 pm

Re: Print variables from source code to external file

Post by Eternity »

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: 2732
Joined: Sat Mar 21, 2020 5:32 am

Re: Print variables from source code to external file

Post by Buggie »

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: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Print variables from source code to external file

Post by Higor »

Or use XC_Core.BinarySerializer...
Post Reply