Quote:
|
Originally Posted by Arkan1k
I am currently trying to figure out ways that I can read from or save to a text file either on the server or the client's computer. I have been experimenting with "requestText(str, str)" for a while, but I can't really figure out at all how you would be able to read a specific file with it.
|
NPC Code:
requesttext("document", "docu/docu_graalscript.txt");
This does not appear to return anything on Rudora (and yes, the file does exist).
However, Stefan helped me with trying to read a file serverside which worked:
NPC Code:
lines = "";
lines.loadlines("");
this.line = "";
for (i=0; i<lines.size(); i++)
this.line @= lines[i]@"\n";
this.line @= "";
The only problem I have found with this is download times for large documents, but I am yet to look into that.
Quote:
|
Originally Posted by Arkan1k
Some other functions I have found are these. Yet I have no clue on how they work and am requesting any help in figuring them out.
|
I am assuming that loadlines and loadstring are very similar; loadlines downloads the file into an array, each value being a line, and loadstring loads the entire file into a string, seperating lines by \n, although I'm not sure.
I am yet to look at saving to files, so I cannot help you there.
Edit Found this in the scripted RC, so I hope it will give you some insight.
text.savestring("rclog.txt",1);
It would save the string "text" to "rclog.txt", obviously. I do not know what the last parameter is for, though.
Quote:
|
Originally Posted by Arkan1k
I have also attached something I slapped together, rather messily (is that a word? It is now.). It is sort of based on command prompt. Something I've been using to test the above commands and to teach myself gscrip2.
|
I shall have a look at it sometime; its still on Rudora. :P