Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Understanding Presets and JSON

James Stine edited this page May 16, 2019 · 2 revisions

This page will try to explain more about how presets are saved, and what JSON is and how you can understand it more for use in other applications of Paisley Park.

Presets

First off, let's explain what a "Preset" for Paisley Park is. A preset is simply just a configuration of waymarks saved to be loaded up again later. If you want to load a configuration for raid, you can save a preset and load it again later. Really handy! How exactly are these presets saved though? Each waymark exists in 3D space with an X, Y and Z coordinate. When you place a waymark down in game, it has coordinates where it's located. These coordinates are saved by Paisley Park when you create a new preset to be used again later.

If you've ever used the Import or Export buttons, you'll notice that you're copying and pasting a large block of text with a lot of symbols, numbers and words. This is JSON (JavaScript Object Notation). To put it simply, JSON is just a way of storing a collection of data. In our case, Paisley Park stores each preset in JSON format. Each preset has information like the name of the preset as well as all the waymark locations.

JSON

Let's take a closer look at one of these presets in their JSON form to better understand what it is and how it works.

{"Name":"Goblet Test","MapID":0,"A":{"X":-94.85513,"Y":7.99999857,"Z":-33.2138176,"ID":0,"Active":true},"B":{"X":-104.761047,"Y":8.0,"Z":-49.08125,"ID":1,"Active":true},"C":{"X":-98.81845,"Y":8.0,"Z":-58.015686,"ID":2,"Active":true},"D":{"X":-87.9950943,"Y":9.615963,"Z":-63.2107,"ID":3,"Active":true},"One":{"X":-82.0417,"Y":8.0,"Z":-52.2887268,"ID":4,"Active":true},"Two":{"X":-75.99051,"Y":6.0,"Z":-70.4296,"ID":5,"Active":true}}

You'll notice there's a lot here, it might seem overwhelming at first, but, let's take it and break it apart. We can see some familiar words in here like "Name", "Bad", "MapID" and some letters like "X", "Y", "Z", and the waymarks. We can actually restructure this big block of text to look more appealing and to be easier to understand. We can use a few different websites to do this for us. Let's try this one.

{
  "Name": "bad",
  "MapID": 83,
  "A": {
    "X": -94.0994644,
    "Y": 8,
    "Z": -49.0615,
    "ID": 0,
    "Active": true
  },
  "B": {
    "X": -95.66961,
    "Y": 8,
    "Z": -46.9789124,
    "ID": 1,
    "Active": true
  },
  "C": {
    "X": 0,
    "Y": 0,
    "Z": 0,
    "ID": 2,
    "Active": false
  },
  "D": {
    "X": -92.63963,
    "Y": 7.999999,
    "Z": -51.27273,
    "ID": 3,
    "Active": true
  },
  "One": {
    "X": 0,
    "Y": 0,
    "Z": 0,
    "ID": 4,
    "Active": false
  },
  "Two": {
    "X": 0,
    "Y": 0,
    "Z": 0,
    "ID": 5,
    "Active": false
  }
}

While a lot longer, it now is laid out in a more readable manner, you might start to understand it just a little better now. JSON is just a set of "key": "value" pairs. What does that mean? The key part means that it's like an identifier or a name given to a value. For example, the first key we see here is "name". In this case the value is "Goblet Test", and indeed the preset's name is "Goblet Test". You'll notice a lot of commas, these are needed to separate the elements.

"A": {
    "X": -94.0994644,
    "Y": 8,
    "Z": -49.0615,
    "ID": 0,
    "Active": true
}

Here's just a slice of one of the waymarks. It has an "X", "Y", "Z" as well as an "ID" and "Active". These are the coordinates of the waymark, as well as an "Active" state (meaning if the waymark is on or off). "ID" represents the number for the waymark. A is 0, B is 1, C is 2, etc.

Now what?

This is just a brief overview of the presets and JSON. You won't need to understand these concepts to use Paisley Park. However, if you wish to use the more advanced features like the HTTP Server to hook Paisley Park up with Triggernometry or Cactbot, it helps to better understand these concepts.

Clone this wiki locally