-
Notifications
You must be signed in to change notification settings - Fork 23
Your First Script
Nathan Glover edited this page Mar 9, 2018
·
12 revisions
JavaScript-Expansions are all written in JavaScript (as the name implies).
Here is an example "Hello, world!" script:
function helloWorld() {
return "Hello, world!";
}
helloWorld();
As you can see, the scripts return one value.
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!
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%
And ta-da!
After you've learned the basics of placeholder scripts, head on over to Advanced Scripts to learn what you can fully do!