1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

UE2 - UT2kX Reading from files

Discussion in 'Programming' started by AJRAD, Jun 22, 2008.

  1. AJRAD

    AJRAD {[RTW]} Leader

    Joined:
    Sep 27, 2005
    Messages:
    37
    Likes Received:
    0
    Ok... another dodgy area.
    Yep I searched the wiki and the whole internets for like 2 hours and I've found nowt.
    So...

    Is there a built in way that I can read a text file into unrealscript as a string so I can do further stuff to it?
    Like.. the file would be on the server in the system folder, I just want ut2004 to read it and put the contents in a variable.

    I was thinking of just writing a quick C++ function to do it natively but the mod this is a part of needs to be downloadable by clients, and I don't think DLLs are downloaded (are they?)

    Thanks in advance for any help at all.
     
  2. Angel_Mapper

    Angel_Mapper Goooooooats

    Joined:
    Jun 17, 2001
    Messages:
    3,532
    Likes Received:
    3
    Just use an ini file and a config var.

    ini would look like this:

    [MyPackage.MyClass]
    SomeString=Hello


    class like this:

    var config string SomeString;
     
  3. AJRAD

    AJRAD {[RTW]} Leader

    Joined:
    Sep 27, 2005
    Messages:
    37
    Likes Received:
    0
    Yep I know about inis, its just that I've already written a script that procsses the file my way, and I need to load it in unrealscript so I can send it to my webserver (using LibHTTP and I've got that bit working btw).
     
  4. Angel_Mapper

    Angel_Mapper Goooooooats

    Joined:
    Jun 17, 2001
    Messages:
    3,532
    Likes Received:
    3
    There's no way to read from text files, so you're going to have to use ini files.
     
  5. AJRAD

    AJRAD {[RTW]} Leader

    Joined:
    Sep 27, 2005
    Messages:
    37
    Likes Received:
    0
    Mhm.. fine. It sucks but I suppose if you say its impossible it is. Thanks anyway
     
  6. Continuum

    Continuum Lobotomistician

    Joined:
    Jul 24, 2005
    Messages:
    1,305
    Likes Received:
    0
    You could create a listen/server socket (apache/http would probably have quite a bit of overhead in the http response but could probably work as well) in an external application and use the TCP client to make calls / receive the response stream (the text of your file). A bit more involved than just reading in a file but definatley doable, guess it depends on how efficient it needs to be also. It may be more efficient to process the file outside uscript.

    http://wiki.beyondunreal.com/Legacy:Creating_A_TCP_Client
     

Share This Page