WebSK is a Skript addon that lets you create the back-end of websites using Skript. This means you can easily implement ingame elements inside a website (or HTTP API). It relies on mapping certain webserver paths to functions, which will execute any Skript code you want it to, as long as it returns a string to return on the web page.
Setup is as easy as this:
Then, you can add paths to your webserver like this (this should be inside the script load event):
An example of a request function is:
An example of something you can create with this addon is a system that displays someone's amount of money on the website (requires vault):
You would reach this website by going to (ip):8000/money?player=(playername)
For more examples, go to https://files.jederu.nl/websk.html.
Setup is as easy as this:
Code:
on script load:
start webserver on port 8000
on script unload:
stop webserver
Then, you can add paths to your webserver like this (this should be inside the script load event):
Code:
add webserver path "/" to run myHomePage()
An example of a request function is:
Code:
function myHomePage(req: request) :: string:
return "Home page"
An example of something you can create with this addon is a system that displays someone's amount of money on the website (requires vault):
Code:
on script load:
start webserver on port 8000
add webserver path "/money" to run checkMoney()
on script unload:
stop webserver
function checkMoney(req: request) :: string:
set {_player} to parameter "player" of {_req} parsed as offline player
return "%money of {_player}%"
For more examples, go to https://files.jederu.nl/websk.html.