Welcome to the JSPN Documentation, this will teach you everything you need to know about JSPN
First, JSPN is Powered by JSON.
If you are already familliar with JSON, Skip this section.
If you are NOT fammiliar with JSON, here are the basics:
in this section you will learn:
{"name":"jimmy"}
This will set the key name to the value jimmy.
But what if you want to make multiple JSON keys?
You can easily store multiple keys by adding a second group like this:
{"name":"jimmy", "age":27000}
You can add a nearly infinite amount of keys in json:
{"name":"jimmy", "age":27000, "coolness amount":"super cool", "is god":true, "do you need to give jimmy cookies":true}
You can also add JSON inside of JSON! (objects)
{
"shoppinglist":{
"apples":"1",
"bananas":"4",
"oranges":"100"
},
"money":{
"100 dollar bills":26,
"20 dollar bills":30,
"pennies":5
}
}
Arrays are also supported in json (even though they dont technically count as json)
{"jimmy's friends":["bob", "billy", "joe"]}
If you understood this, you are now ready to start using JSPN.
If you dont understand, look it up or something idk.
Your main code will need to be in a special key, called the program
key.
First, create a json object:
{}
Then, create an object inside with the name program
:#
{
"program":{
// your code goes here
}
}
If your file looks like the code above, you are ready to start coding with JSPN!
Programs are made up of keys. (functions/code in jspn)
In this section you will learn:
Say is the main way for users to see outputed text
You Can use say like this:
{
"program":{
"say":"hello world"
}
}
JSPN was meant to run in Penguinmod, using say you can make sprites have speech bubbles with text in them.
You can also set how long you want the speech bubble to display using arrays (in seconds). (note: this will also pause the program until the speech bubble dissapears.)
{
"program":{
"say":["hello world", 3]
}
}
JSPN functions cannot be used twice in a program with the same name.
{
"program":{
"say":["i am jimmy", 2], // will be skipped due to them both being the same key
"say":["i am bob", 2]
}
}
To fix this, add a number to the end of the second “say”, and all says after that.
This rule applies to all functions.
{
"program":{
"say":["i am jimmy", 2], // will work normally
"say2":["i am bob", 2]
}
}
Wait pauses for the specified amount of time.
{
"program":{
"say":["Jimmy: lets wait for billy", 2],
"wait":20, // will wait for 20 seconds before running the next line
"say2":["Billy: i have arrived", 2]
}
}
The JSPN version of
print("text")
or
console.log("text")
You can use it like
{
"program":{
"say":["Jimmy: lets wait for billy", 2],
"log":"waiting for billy...", // will not show for the user if the list JSPN logs is hidden
"wait":20,
"log2":"billy has arrived",
"say2":["Billy: i have arrived", 2],
"say3":["Billy: wheres joe?", 2],
"wait2":1,
"log3":["Joe: HELP, IM STUCK IN THE LOGS"]
}
}