Reading file information

Discussions about Coding and Scripting
Post Reply
ShaiHulud
Adept
Posts: 459
Joined: Sat Dec 22, 2012 6:37 am

Reading file information

Post by ShaiHulud »

Hello

Absolute straight-off-of-the-boat uscript beginner. But, willing to learn, and trying to find my way around. My objective at present, is to add an additional command to the VoteMenu in use on our server. It would work something like this - the user would open the console and type:

!new
!new maps 50
!new days 10

The first would return a list of, say, the 25 most recently added maps (a sort of default). The second would return a list of the 50 (or if the server hosted fewer than 50 maps, the total number of maps available) most recently added maps. The third would return a list of all maps added during the previous 10 days.

But this would obviously require that the VoteMenu be able to read file creation information from disk, and I can't seem to find out anything about how to do that. I suppose a more labour intensive way would be for the server admin to add this information whenever a new map was added to the server, but that would be tedious.

So, is this possible at all, or should I abandon the attempt?

Thank you in advance.
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Reading file information

Post by Feralidragon »

Unfortunately, you can't do something like that afaik.
The closest thing you can do on how to detect maps, is shown in this class (see LoadMapList()):
http://uncodex-ut.host56.com/Source_ume ... istcw.html

Which basically uses the function GetMapName( string NameEnding, string MapName, int Dir ); from the Actor class to retrieve maps.

However, I have an idea in how you can achieve something close to that:
- create a big config string list, where you can put map names, like:
var config string Maps[2048];

- on each load of your mod, check all the maps and save the ones which aren't on this list as of yet, that way every time you add new ones, as long as you have this list saved properly into an ini, they will appear as the last ones in this list, so you just have to check from the last one to retrieve the 10 newest, 20 newest, and so on.

It's not as clean or accurate, but it's the only possible way I see using UnrealScript alone.
User avatar
Sp0ngeb0b
Adept
Posts: 376
Joined: Wed Feb 13, 2008 9:16 pm
Location: Cologne
Contact:

Re: Reading file information

Post by Sp0ngeb0b »

Feralidragon wrote:but it's the only possible way I see using UnrealScript alone.
I fear he's right, to read the fileinformation you would have to create a native serverside-mod.
Website, Forum & UTStats

Image
******************************************************************************
Nexgen Server Controller || My plugins & mods on GitHub
******************************************************************************
User avatar
Wises
Godlike
Posts: 1089
Joined: Sun Sep 07, 2008 10:59 am
Personal rank: ...

Re: Reading file information

Post by Wises »

does Uscript have the ability to access external files date/timestamps?
if so could we not make a mutator which scans the /Maps folder and puts all Map info into an .ini file.. with Dates Modified/added
from here do a sort on the file and return the maps ?

probably not.. but yeah ^_^
User avatar
Feralidragon
Godlike
Posts: 5493
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Reading file information

Post by Feralidragon »

^ It doesn't, that's what the whole issue is. If this version of UnrealEngine had the capability to somewhat read or write to files that way, then you cannot even imagine what kind of things could have been done already (I really mean it).
But that would also mean that it would be extremely easy to install malware in your computer through your UT install.
UnrealEngine 3 for instance, only allows you to call APIs or to write in their own object format to your system, unless you bind dlls to do more than that.
ShaiHulud
Adept
Posts: 459
Joined: Sat Dec 22, 2012 6:37 am

Re: Reading file information

Post by ShaiHulud »

Thanks for the input everyone, this confirmed what I supposed was probably true. Feralidragon, your idea is a good one, I might go with something like that ultimately, but this will probably be a back-burner project for now.
Post Reply