ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Superslayer on December 27, 2009, 06:18:20 PM

Title: Write multiple lines
Post 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:

Code: [Select]
%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:

Code: [Select]
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 :)
Title: Re: Write multiple lines
Post by: Khameleon on December 28, 2009, 08:20:42 AM
Have you checked out tm's save to file subs?
Title: Re: Write multiple lines
Post by: Superslayer on December 28, 2009, 08:55:09 AM
Ya, it doesn't seem to write each variable to a separate line, which is imperative to my scripts function.
Title: Re: Write multiple lines
Post by: TrailMyx on December 28, 2009, 11:46:46 AM
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.
Title: Re: Write multiple lines
Post by: Superslayer on December 28, 2009, 12:03:11 PM
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.
Title: Re: Write multiple lines
Post by: manwinc on January 13, 2010, 12:10:02 PM
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

Title: Re: Write multiple lines
Post by: Superslayer on January 13, 2010, 12:58:32 PM
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.
Title: Re: Write multiple lines
Post by: manwinc on January 13, 2010, 06:20:00 PM
The sub doesn't belong to me, but I will gladly Post it and Put his name with it :)