Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
masterkrueger
Wanderer


Joined: 24 Jan 2010
Posts: 65
Location: Hamburg

PostPosted: 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
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
masterkrueger
Wanderer


Joined: 24 Jan 2010
Posts: 65
Location: Hamburg

PostPosted: 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?!
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net