diff --git a/Your-First-Script.md b/Your-First-Script.md new file mode 100644 index 0000000..f438290 --- /dev/null +++ b/Your-First-Script.md @@ -0,0 +1,38 @@ +## Creating Your Script + +JavaScript-Expansions are all written in JavaScript (as the name implies). + +Here is an example "Hello, world!" script: + +```JavaScript +function helloWorld() { + return "Hello, world!"; +} + +helloWorld(); +``` + +As you can see, the scripts return one value. + + +## Using Your Script + +To use our hello_world script, first let's save the above as `hello_world.js` inside the `plugins/PlaceholderAPI/javascripts/` folder. + +Next, add it to the `plugins/PlaceholderAPI/javascript_placeholders.yml` file so the expansion knows to load it! + +```YAML +hello_world: + expression: 'file: hello_world.js' + type: string +``` + +Then, after reloading PAPI (`/papi reload`) you can use your placeholder! + +To test it, run `/papi parse %javascript_hello_world%` + +## Advanced Scripts + +You can save data with your script and also access the Bukkit API! + +// coming soon \ No newline at end of file