Author Topic: Write multiple lines  (Read 2591 times)

0 Members and 1 Guest are viewing this topic.

Offline SuperslayerTopic starter

  • Elite
  • *
  • *
  • Posts: 1006
  • Activity:
    0%
  • Reputation Power: 14
  • Superslayer barely matters.Superslayer barely matters.
  • Gender: Male
  • Well what do you drink? Not tea.
  • Respect: +43
  • Referrals: 0
    • View Profile
Write multiple lines
« on: December 27, 2009, 06:18:20 PM »
0
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 :)

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: Write multiple lines
« Reply #1 on: December 28, 2009, 08:20:42 AM »
0
Have you checked out tm's save to file subs?

Offline SuperslayerTopic starter

  • Elite
  • *
  • *
  • Posts: 1006
  • Activity:
    0%
  • Reputation Power: 14
  • Superslayer barely matters.Superslayer barely matters.
  • Gender: Male
  • Well what do you drink? Not tea.
  • Respect: +43
  • Referrals: 0
    • View Profile
Re: Write multiple lines
« Reply #2 on: December 28, 2009, 08:55:09 AM »
0
Ya, it doesn't seem to write each variable to a separate line, which is imperative to my scripts function.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13303
  • Activity:
    0.4%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Write multiple lines
« Reply #3 on: December 28, 2009, 11:46:46 AM »
0
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.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline SuperslayerTopic starter

  • Elite
  • *
  • *
  • Posts: 1006
  • Activity:
    0%
  • Reputation Power: 14
  • Superslayer barely matters.Superslayer barely matters.
  • Gender: Male
  • Well what do you drink? Not tea.
  • Respect: +43
  • Referrals: 0
    • View Profile
Re: Write multiple lines
« Reply #4 on: December 28, 2009, 12:03:11 PM »
0
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.

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: Write multiple lines
« Reply #5 on: January 13, 2010, 12:10:02 PM »
0
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

Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline SuperslayerTopic starter

  • Elite
  • *
  • *
  • Posts: 1006
  • Activity:
    0%
  • Reputation Power: 14
  • Superslayer barely matters.Superslayer barely matters.
  • Gender: Male
  • Well what do you drink? Not tea.
  • Respect: +43
  • Referrals: 0
    • View Profile
Re: Write multiple lines
« Reply #6 on: January 13, 2010, 12:58:32 PM »
0
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.

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: Write multiple lines
« Reply #7 on: January 13, 2010, 06:20:00 PM »
0
The sub doesn't belong to me, but I will gladly Post it and Put his name with it :)
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Tags: