![]() |
File Loader v1.0 - Printable Version +- Gothic Online Forums (https://archive.gothic-online.com) +-- Forum: Scripting (English) (https://archive.gothic-online.com/forum-11.html) +--- Forum: Resources (https://archive.gothic-online.com/forum-14.html) +---- Forum: Modules (https://archive.gothic-online.com/forum-32.html) +---- Thread: File Loader v1.0 (/thread-9.html) Pages:
1
2
|
File Loader v1.0 - Nubzior - 09.10.2015 Implementation: Code: <module src="GO_wFileLoader.nud" type="server" /> // For windows Squirrel function: userpointer handler = fileOpen(string file, string fileMode) bool fileExists(string filename) bool fileClose(userpointer handler) bool fileWrite(userpointer handler, string text) string fileRead(userpointer handler) bool fileRename(string oldname, string newname) bool fileRemove(string filename) int fileLength(userpointer handler) Short example: Code: local file = fileOpen("test.txt", "r+") Windows: https://mega.nz/#!CYYGiRSb!wthbuogO5ksePQX_gK9lROOtvi9nF-O0-yg4hvXRQcA Linux: https://mega.nz/#!KIQEQawK!uEKve1P1wTWSQBTZlJ4cF_yfmJG444v80EPZ2Y-MTkc Creditsy: Sative - wersja 0.3 RE: File Loader v0.3 - Axe - 07.12.2015 Well actually i have a problem with this module. For example when i use this 'fileWrite(file, "Lorem ipsum...");' of course before i added 'local file = fileOpen("test.txt", "r+")' then it saves only 4 words i mean when i open test.txt file there is only 'lore' inside, can somebody tell me what i am doing wrong? RE: File Loader v0.3 - Sative - 07.12.2015 http://squirrel-lang.org/doc/sqstdlib2.html#d0e159 Try this. RE: File Loader v0.3 - Axe - 07.12.2015 (07.12.2015, 09:53)Sative Wrote: http://squirrel-lang.org/doc/sqstdlib2.html#d0e159Not really sure what you mean. I mean I asked if my code is bad or is this module broken? RE: File Loader v0.3 - Sative - 07.12.2015 Probably module, but you would use w+ as parameter. RE: File Loader v0.3 - Axe - 07.12.2015 It doesnt matter if there is w+, r+ or whatever else, it always cut text after 4 letters. RE: File Loader v0.3 - HammelGammel - 07.12.2015 Use the downloadlink in this thread. The fileloader that comes with GO does that for some reason. Had that problem too initially, before downloading it manually. RE: File Loader v0.3 - Axe - 07.12.2015 (07.12.2015, 14:04)HammelGammel Wrote: Use the downloadlink in this thread. The fileloader that comes with GO does that for some reason. Had that problem too initially, before downloading it manually. oh dude, awesome, it works. Thank you so much. ++++++ RE: File Loader v0.3 - HammelGammel - 07.12.2015 You're welcome ![]() I'm getting more and more confused with this. This is my code: Code: local file = fileOpen("saveFiles/Players/" + name + ".txt", "r+"); The formatting seems to crash the server most of the time (Not always) when one of the lines in the file contains a very long string. "test" doesn't crash, but "ITSC_LIGHTHEAL{equipped{0}amount{1}}ITMI_RAKE{equipped{0}amount{1}}ITFO_APPLE{equipped{0}amount{199}}ITPL_TEMP_HERB{equipped{0}amount{1}}" does. When I don't format, it doesn't crash and when I print out the buffer-variable, it works fine, concatenation doesn't work properly though. When concatenating it will only use a few letters and cut the rest off for some reason. I need to concatenate though, since there seems to be a maximum length when using fileRead and I am saving the inventory of the players as a big string. I'm running out of ideas how to work around this, so: What am I doing wrong? O.o I just don't get it. RE: File Loader v0.3 - Bimbol - 23.12.2015 Only way to fix it is probably recompile it, and fix bugs. |