WebSK

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

jensjeflensje

New Member
Dec 3, 2017
5
4
3
19
Rotterdam, The Netherlands
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:
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}%"
You would reach this website by going to (ip):8000/money?player=(playername)

For more examples, go to https://files.jederu.nl/websk.html.