Hello everyone, I would like to know how to make sure that within a TXT file there is the exact word.
This command should be used as a password.
I add an example
Please don't double post (posting underneath yourself), keep everything contained in a single message, until someone else responds.
This would probably need a plugin though, so I'm moving this to plugin requests.
So you kinda were alerted to avoid double post and you did a triple post...
But by the way, check if the .txt file has the same name as in the code given and is in the same folder as the game.exe
No, you don't need to. You should keep the "password" surrounded by the " " though.
I used the above mentioned script to make my own function:
function CensorshipCheck() {
var fs = require ("fs");
$gameVariables.setValue (267, fs.readFileSync ("./Censorship.txt", {encoding: "utf-8"}));
}
CensorshipCheck();
This works well, apart from it producing a "missing file" error if the Censorship.txt file isn't present. How can I avoid this error message? In other words; how do I make the function do nothing if the Censorship.txt file is missing?
try {
var x = fs.readFileSync (your things);
$gameVariables.setValue (267, x);
}catch (e) {};
Not sure if try catch catches the error, but hopefully it does. Otherwise you'd have to use fs.readdir to find whether the returned array contains the filename.