View Single Post
  #2  
Old 02-09-2005, 12:15 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
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
__________________
Skyld

Last edited by Skyld; 02-09-2005 at 12:35 PM..
Reply With Quote