Guide on voting for 1.10.2?
Jessssuhh opened this issue · 9 comments
I have FE for 1.10.2, trying to set up votifier. I don't seem to have any of the scripting files mentioned in the wiki?
Here you go:
// Server.chatConfirm("Voting script loaded!");
function onServervote(sender: mc.ICommandSender) {
//Server.chatConfirm("Vote event callled");
Server.runCommand(sender.doAs(null, true), 'wallet', sender.getPlayer().getName(), 'add', 200);
sender.chatConfirm('You are rewarded for voting ' + sender.getPlayer().getName() + '!' );
}
That.. doesn't really answer my question? I don't even have a folder called scripts or scripting. Do I make a directory at scripting/servervote and put it in there? My problem is none of the docs match up with what I have.
And now that I think about it, that looks to be a completely different script style to what the section on voting scripts demonstrates. What the hell?
I'm sorry the part of the wiki about votifier is out dated. The scripting engine has been replaced with JavaScript. You should have a JScripting folder with mc.d.ts, fe.d.ts and tsconfig.json in it. Follow the wiki about JScripting to get started how to transpile above example into a .js file.
Make sure you alter tsconfig.json to your needs as it tells TypeScript what to look at when transpiling the .ts into a .js. So if you copied above example in a file called "voting.ts", placed it in ./ForgeEssentials/JScripting and while using Atom configured to use TypeScript and save the file, the file "voting.js" is automatically created in the output folder as stated in tsconfig.json. To use the script generated, either restart your server or much faster, use /fescript reload
command.
At the moment I'm doing this all locally, so its all in Backup/ForgeEssentials/JScripting, in which I have fe.d.ts, mc.d.ts, onServerVote (generated & empty) tsconfig.txt vote.js & ts, votifier.js & ts. Vote was my attempt at creating a /vote command.
If I understand the tsconfig file correctly, it should link any ts file in the same directory with mc and fe, so I've left it as default.
Ah! Ok, I'm having a crack at this but I'm thrown by the error saying that
"function onServervote(sender: mc.ICommandSender)"
is expected to be
"function onServervote(sender, mc,ICommandSender)"
Which I know is wrong because, I'm guessing, you're pointing at a function in another file.
Zeth, listen. I wouldn't be on here asking for help if I knew exactly what I was doing. If I knew anything about typescript, I probably would have seen the .ts files and thought "aha, they've changed the scripting language!"
Votifier is one of the main reasons I have FE on my server. PLEASE understand that no one has the exact knowledge you do; acting as if I should is quite counter productive. Because then I have to waste your time asking questions you could've answered in the first place.
Mc.d.ts and fe.d.ts aren't referencable in *.ts that I create, so things like "function onServervote(sender: mc.ICommandSender)" do not work. I tried to copy relevant parts into my file, but each one just threw more errors and unknown references. Eventually I just copied both mc and fe in entirety in, which threw a migraine-enducing 782 errors. I don't know what you expect people to do, here. The majority of us are used to config-style yes no questions.