|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Sat Dec 04, 2010 6:20 pm
Textfile input and loop |
Hi Folks, i want to import a text file into CMud. I tried the load button for a new variable String list, but i
only got one long line. I tried to read the file line by line with #READ, but how do i user something like this:
#READ file.txt {add each line as new StringList-Item}
How can i build this?
Many thanks
Jason |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Dec 04, 2010 6:47 pm |
Is each line going to be added to a single stringlist, or is each line going to become a separate stringlist variable all on its own?
If you are wanting the former, then use the %read() function instead. You can assign this result to a local variable, do whatever you need to do to it, and then when ready use the #ADDITEM command or the %additem() function to insert it into the stringlist.
If you are wanting the latter, then still use %read() but use #VARIABLE or a=b assignment syntax to create your variable instead of #ADDITEM/%additem. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
masterkrueger Wanderer
Joined: 24 Jan 2010 Posts: 65 Location: Hamburg
|
Posted: Sat Dec 04, 2010 6:55 pm |
Thanks MattLofton, ill take the first part. But still something weird is happening when i use String list.
I save a Stinglist a|b|c edit it and want to reload it, but sometimes nothing is shown, sometimes the old values a|b|c not what is really in the text file. Looks like something got cached?! |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Dec 06, 2010 12:43 am |
Post the script you wrote in [code] tags and we'll help you figure out what's happening.
|
|
_________________ Asati di tempari! |
|
|
|
|
|