/textout is great for outputting text (whether it be in a variable or explicitly defined) directly to a file in any format you want. It would be great if there were a reverse capability where you could read text from a file and either store it to a variable or display it to the screen. This would allow /textout to become a powerful tool for moving data out of lists and arrays and into text files (since it would be easier to retrieve the data).
/textin seems like a good fit for this but it can currently only directly output the text to the mud. It would be great if you could use /textin similar to /textout with optional arguments. Something like: /textin {c:\mm\logdata.txt} {variable} {testvariable} or /textin {c:\mm\logdata.txt} {display}.
Your help would be greatly appreciated. Thanks!
Anonymous
Easier said than done but while I'm looking at it consider using the database commands to do this. To access text files as database files you need a file called Schema.ini in the folder you'll have your text db. In it you need a section for each text file you'll want to use. The section looks like this:
[ClanDb.txt]
ColNameHeader = False
Format = CSVDelimited
CharacterSet = ANSI
Col1=ClanNumber short
Col2=ClanName char width 50
Col3=ClanLeader char width 20
Results of select statements run against databases go into arrays. For example:
if you hae a text file ClanDB.txt with:
1,"Circle of Power","Romsek"
2,"The White Rose","Gnoden"
3,"Presence","Ausjos"
5,"Legion of Legends","Wonac"
then
/sqlquery {select * from ClanDB.txt where clannumber >0}{clans}{txt:@sessionpath()}
creates an array called clans with 5 rows of 3 columns.
/loop {1,5,n}_
{/showme {@a(clans,$n,1) @a(clans,$n,2) @a(clans,$n,3)}}
You can create an empty file or delete the contents of an existing one with
/textout {@sesionpath()ClanDB.txt}{ }
An example of an action to fill a text file using db commands would be:
/action {[%0][ %1] %2}
{
/sqlexecute {insert into ClanDB.txt (ClanNumber, ClanName, ClanLeader) values ($0,'@Ltrim($2)','@Ltrim($1)')}
{txt:@sessionpath()}
}_
{clandb}
Of course if you were to do things like this you'd need to manage the action with disablegroup and enable group and clear the array with /unarray clans if you planned on using it repeatedly.