jspn

JSPN Documentation

Welcome to the JSPN Documentation, this will teach you everything you need to know about JSPN

“JSON” is for storage, “JSPN” is for writing programs in the same format of JSON.
If you wanted to know, “JSPN” stands for Javascript Programming Notation.

Learning JSON Basics

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:

JSPN’S basics

Creating a program Key

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!

Simple Programs

Programs are made up of keys. (functions/code in jspn)
In this section you will learn:

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]
    }
}

An important note

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

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]
    }
}

Log

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"]
    }
}