ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Superslayer on December 27, 2009, 06:18:20 PM
-
I'm looking to find an efficient way of writing information to a file, but be written in a certain way. Suppose I have a string that goes something like this:
%string data1_data2_data3_data4@data1_data2_data3_data4@data1_data2_data3_data4@data1 .....
With '@' being the delimiter, I'm looking to write the sub strings to file on their own lines so it'd look like this:
data1_data2_data3_data4
data1_data2_data3_data4
data1_data2_data3_data4
data1_data2_data3_data4
..with each entry of 'data' being different obviously. Now I suppose I could write one line at a time, but is there a certain DOS command that will automatically put a carriage return at the end of each specified delimiter so there's only one 'blip' of the DOS cmd window? It needs to be a file, and must be one line per sub string.
Thanks for any input all :)
-
Have you checked out tm's save to file subs?
-
Ya, it doesn't seem to write each variable to a separate line, which is imperative to my scripts function.
-
There's no way contained in EUO to *quickly* write variables to separate lines. That's why I created the file save stuff so that it minimized the number of writes by allow for multiple variables saved in a single CMD call.
However what you describe is basically what my file stuff does. I even include the namespace information so you can completely re-construct a namespace and the contents.
Now I have some neat C# routines I use personally, but I won't release those since I don't want to create a dependency outside EUO.
-
I'll take a closer look at your file subs later on, it'll be more pertinent once I finally release version 1.0 of the WIT which is actually in view from where I see it now. My UCI program is written in C# also, perhaps I can fiddle with that.
-
Actually, I did an Inventory script for Scriptuo.com not too long ago. Somehow in doing this I found an ingenious sub someone had written that would allow you to Write a file Like this(Below), only up to 2000 and some odd lines in 1 Execute. (I'm assuming thats where the problem is). I'll have to see if I can locate it again and send you the sub
Hat of the Magi: 12
Ornament of the Magician: 14
Leggings of Bane: 10
Transfer Tokens: 7
-
That'd be great Manwinc. Currently I have my script writing one line at a time when the script is finished, but if you're lucky enough to find what you're looking for I along with others would be greatly thankful.
-
The sub doesn't belong to me, but I will gladly Post it and Put his name with it :)