[JS] Include libraries/functions

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Hi guys.

Your documentation have one big problem, what I passed by until now, because I want to make better /home plugin, so here is the problem.

There is nowhere tutorial/forum topic/documentation how to include advanced functions. I want to use Ini file to save positions, but I don't know what I need and how to include it to make it work.

Code:
function BroadcastIni() {
    if (!Plugin.IniExists("Homes_INI")) {
        BroadcastIni = Plugin.CreateIni("Homes_INI");
        BroadcastIni.Save();
    }
    return Plugin.GetIni("Homes_INI");
}
Looking good yep? It's from documentation. But I have server error:"IniExists - No such function" - sorry I don't remember it, but everybody knows what's going on.

JintPlugin don't know what is "IniExists".

I saw how you doing it in Python. But I don't want to write in Python, just because I don't know how to include those functions to Javascript. Not only IniExisits, because Unity functions would be also cool, to check if player is on his own foundation for example.

Please help.
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,096
4,836
113
At your house.
github.com
Hi guys.

Your documentation have one big problem, what I passed by until now, because I want to make better /home plugin, so here is the problem.

There is nowhere tutorial/forum topic/documentation how to include advanced functions. I want to use Ini file to save positions, but I don't know what I need and how to include it to make it work.

Code:
function BroadcastIni() {
    if (!Plugin.IniExists("Homes_INI")) {
        BroadcastIni = Plugin.CreateIni("Homes_INI");
        BroadcastIni.Save();
    }
    return Plugin.GetIni("Homes_INI");
}
Looking good yep? It's from documentation. But I have server error:"IniExists - No such function" - sorry I don't remember it, but everybody knows what's going on.

JintPlugin don't know what is "IniExists".

I saw how you doing it in Python. But I don't want to write in Python, just because I don't know how to include those functions to Javascript. Not only IniExisits, because Unity functions would be also cool, to check if player is on his own foundation for example.

Please help.
Hmm. I would go with Python Itself but your call. Also surprised that you want to write a homesystem, lol.

Anyways. Looking in the Plugin class of Jint engine: https://github.com/Notulp/Fougerite/blob/master/JintPlugin/JintPlugin.cs

Seems like it doesn't have that function.

You could use the JSON function, or go with the Magma engine to use all the examples of JavaScripts we have. I wasn't aware of this.
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Hmm. I would go with Python Itself but your call. Also surprised that you want to write a homesystem, lol.
Javascript because I'm webmaster and I don't like changes, so you know. It's easier for me to just stay with it.

Homesystem - there are too much complicated. I want to have TP in it. Basically I made almost every plugin for my server, because everything what I download have some functions/complications what I don't want to have, or are made wrong.

I have PvE server, so just /sethome /gohome /delhome and /sharehome is everything what I need.

So I need to go to Python... Fsprsoarssriarspaf.
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,096
4,836
113
At your house.
github.com
Javascript because I'm webmaster and I don't like changes, so you know. It's easier for me to just stay with it.

Homesystem - there are too much complicated. I want to have TP in it. Basically I made almost every plugin for my server, because everything what I download have some functions/complications what I don't want to have, or are made wrong.

I have PvE server, so just /sethome /gohome /delhome and /sharehome is everything what I need.

So I need to go to Python... Fsprsoarssriarspaf.
Python makes you skills in every points, if you want to stick with JavaScript, use the Magma engine. (Place JS in Magma folder)

I have been using Python for 8 years now, and will make you just a better programmer in any case.
I never fail in python definitions, cause that's how python professionals do It :D (lol)

HomeSystem 2.5.3 isn't complicated, It just has options, which are good to have.
You can develop website via Python too.

It's your choice what to pick anyways, really.
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Best would be just PHP.

I'll use Python, Magma looks so different. Hope it'll not take me too long to rewrite all plugins.

Thanks.
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Yeah I did that and just working on /home. It's still stupid that I lost about 2 hours for searching for answers about this error with JS, and for rewriting plugins. I could have everything done now if I know 2 days ago that today I'll rewrite everything to PY.

I don't know who made that language, but for me (programmed in C++, PHP etc) every line should end ";", or "}".

Here everything is in blocks without end. No end for IF, no end for functions. Nothing. Weird.
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,096
4,836
113
At your house.
github.com
Yeah I did that and just working on /home. It's still stupid that I lost about 2 hours for searching for answers about this error with JS, and for rewriting plugins. I could have everything done now if I know 2 days ago that today I'll rewrite everything to PY.

I don't know who made that language, but for me (programmed in C++, PHP etc) every line should end ";", or "}".

Here everything is in blocks without end. No end for IF, no end for functions. Nothing. Weird.
This is the reason why Python is easy. I'm a Java fan though, but Python rocks :p