![]() |
gscript2: requestText
1 Attachment(s)
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. Currently I have: NPC Code:requestText(str, str): I am sure there's a few more. But I am unable to test. 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. NPC Code:loadfolder(str, int) I would appreciate any help. 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 didn't really need to make them all "/commands" but, what's the dif? Included is a small formatText function which basically is used like: NPC Code: And it basically swaps the [r] tags and any other tags you may add into the function with their respective <font color=#color></font> tags. I didn't put much effort into it, but I'm sure we can improve on it. And if you call weaponlist or any other kind of thing through "/request" you can add either "-e" or "-l" to open the requested text in a editable text box or a list. Perhaps even we can start up a few community projects that we can all work on together. Anyway, again, I would love any help from anyone, and enjoy my little cmd script. |
Quote:
NPC Code: 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 = ""; The only problem I have found with this is download times for large documents, but I am yet to look into that. Quote:
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:
|
For the last parameter, 0=overwite, and 1=append. Hope that helps.
As for Delph, I don't believe you can do requesttext("document", "docu/docu_graalscript.txt");. You need to do a loadlines/string serverside. |
Quote:
|
[QUOTE=SkyldThe only problem I have found with this is download times for large documents, but I am yet to look into that.[/QUOTE]
To fix that put it into a function, functions make scripts run smoother and faster. Which is proubably why GS2 is mostly in a function like format for everything. |
A tutorial for Gscript2 (Just a quick one) would truly help everyone.
|
| All times are GMT +2. The time now is 06:17 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.