Spatsiba 89 Posted November 27, 2018 Hey! I'm trying to load an external file from the game root directory. From what I understand I have everything set up correctly. If you have any experience doing this and could share your settings that'd be greatly appreciated. So far I've got: Spoiler //adminpass.txt "password" //restart.sqf _pass call compile preProcessFile "\adminpass.txt"; _pass serverCommand "#restart"; //Server config allowedFilePatching = 1; allowedPreprocessFileExtensions[] = {"txt"}; //Lots more in here just didn't want to spam discord with it //Commandline on server.exe -filePatching I don't know what I've missed. Right now _pass doesn't print "password". Share this post Link to post Share on other sites
Larrow 2822 Posted November 27, 2018 Remove the \ in the file path. 1 Share this post Link to post Share on other sites
Spatsiba 89 Posted November 27, 2018 Thanks for the reply Larrow! No joy with removing the "\". Neither does it help to "loadfile". Not sure what's wrong. The game can clearly find the file, just won't load it. I'm able to delete and edit the file on my server until I run the script, at which point arma is trying to read it but can't, resulting in it being "read" and unable to be edited until I shutdown the server process. Share this post Link to post Share on other sites
pierremgi 4905 Posted November 27, 2018 Not sure to understand. If you preprocessFile "adminpass.txt" you'll obtain "password" right? Not really a code, more a string by itself. So what do you want to do with: _pass call compile "password"? 1 Share this post Link to post Share on other sites
Ryko 18 Posted November 27, 2018 Try using #include "\adminpass.txt"; That said, if every client does not have this file on their computer in the root directory for arma, your mission will crash. Every arma installation has arma3_readme.txt, which you can edit to include whichever data you wish on the server, and the connected players will include harmless text. 1 Share this post Link to post Share on other sites
Spatsiba 89 Posted November 27, 2018 3 hours ago, pierremgi said: Not sure to understand. If you preprocessFile "adminpass.txt" you'll obtain "password" right? Not really a code, more a string by itself. So what do you want to do with: _pass call compile "password"? I thought it was pretty clear? If you look in my code block you'll see restart.sqf. I want to obtain the string including password. That way I can use serverCommand to restart the server, without putting my server password in the mission file itself. Call compile got in there from the ctrl + v I guess? heh Been testing this for a while now. Share this post Link to post Share on other sites
pierremgi 4905 Posted November 28, 2018 _pass = call compile preProcessFile "adminpass.txt"; perhaps? 1 Share this post Link to post Share on other sites
HazJ 1289 Posted November 28, 2018 // initServer.sqf [] execVM "\server\serverPassword.sqf"; // A3 server Root dir -> Folder named "server" -> serverPassword.sqf serverPassword = "yourPassword"; publicVarible "serverPassword"; You might not need to PV it. Depends on where you use it. Requires filePatching unless you PBO it with config.cpp, etc... 1 Share this post Link to post Share on other sites
Spatsiba 89 Posted November 28, 2018 On 2018-11-28 at 8:00 AM, HazJ said: // initServer.sqf [] execVM "\server\serverPassword.sqf"; // A3 server Root dir -> Folder named "server" -> serverPassword.sqf serverPassword = "yourPassword"; publicVarible "serverPassword"; You might not need to PV it. Depends on where you use it. Requires filePatching unless you PBO it with config.cpp, etc... Doesn't that defeat the purpose of keeping it hidden? If it gets sent to all clients as PV? I'm looking into just making it a serverside mod and seeing if that'll work. On 2018-11-28 at 2:23 AM, pierremgi said: _pass = call compile preProcessFile "adminpass.txt"; perhaps? Tried that, didn't work. Not sure what's up with this problem I'm having. It should work, I know others have had it work, I (ME) have had it working previously in a2 and a3. What's causing it to not work now? If anyone would be kind enough to hold my hand, making a mission file, server cfg, and commandline for a "test" where you grab external files I could maybe reverse engineer that? Share this post Link to post Share on other sites
HazJ 1289 Posted November 28, 2018 They don't see it, not unless they have some debug to output it. If they have debug access or if anyone hacks your server, don't worry about the password being revealed, worry about them running other code to troll, grief, etc... EDIT: As I said above, you may not need to PV anyway. Not that it will hurt. Depends where you use it. EDIT 2: That is server-side. The only difference between this and the PBO is one requires allowFilePatching and the other doesn't. 1 Share this post Link to post Share on other sites
pierremgi 4905 Posted November 28, 2018 The profileNameSpace of the server should do the trick also for hosting your variable. 1 Share this post Link to post Share on other sites
HazJ 1289 Posted November 28, 2018 40 minutes ago, pierremgi said: The profileNameSpace of the server should do the trick also for hosting your variable. Not needed nor ideal. You would have to save it in SQF from somewhere. Even if you were to do that server-side, you might as well just use the method I mentioned above. 1 Share this post Link to post Share on other sites
Spatsiba 89 Posted November 29, 2018 7 hours ago, pierremgi said: The profileNameSpace of the server should do the trick also for hosting your variable. I've thought about that too and I guess it works. In my experience profileNameSpace has a tendency to load default values even though it's defined sometimes. 6 hours ago, HazJ said: Not needed nor ideal. You would have to save it in SQF from somewhere. Even if you were to do that server-side, you might as well just use the method I mentioned above. I guess not. I'd like to be able to load more stuff from external files however. The password isn't the only issue. It's just the most urgent. It'd be nice to figure out how to use external files. I've solved the issue with getting the password but the loadfile/processFile on external txt/sqf still doesn't work. :/ Thanks for the help so far though everyone! :) Share this post Link to post Share on other sites
pierremgi 4905 Posted November 29, 2018 How do you manage this command ? Is it better or same as preprocessFile ? Share this post Link to post Share on other sites
Dedmen 2716 Posted November 29, 2018 5 hours ago, pierremgi said: Is it better or same as preprocessFile ? It's not better nor the same. loadFile just loads a plain textfile. preprocessFile loads a textfile and preprocesses it. Share this post Link to post Share on other sites
pierremgi 4905 Posted November 29, 2018 Ah... I see. And isn't it enough in this case because the file seems to be a simple string? Why preprocessing it? Just a noob question about so specific usage. Share this post Link to post Share on other sites
Dedmen 2716 Posted November 29, 2018 That is exactly what I told him when he asked the same question in Arma Discord. But loadFile had the same problem of not being able to load the file. 1 Share this post Link to post Share on other sites
Spatsiba 89 Posted November 29, 2018 6 hours ago, Dedmen said: That is exactly what I told him when he asked the same question in Arma Discord. But loadFile had the same problem of not being able to load the file. Yeah, shh about cross posting. ;) I thought it got burried in discord and the forums was a more appropriate place to ask. I only tried processing because it didn't work with loadfile. If I'd like to add comments and several variables in an external file I'd have to process it anyway. Still no luck with getting it to work though. Currently searching for someone who's done this and got it working to reverse engineer their work. Share this post Link to post Share on other sites