Skip to content

Commit

Permalink
Merge branch 'main' into csc-alice
Browse files Browse the repository at this point in the history
  • Loading branch information
Alicekb committed Jun 26, 2024
2 parents cb8174d + 633d0cf commit 42b7878
Show file tree
Hide file tree
Showing 62 changed files with 2,674 additions and 2,026 deletions.
2 changes: 1 addition & 1 deletion config/_default/hugo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
title = "Beacon SDK"
title = ""
baseurl = "https://roll20.github.io/"
canonifyURLs = false
disableAliases = true
Expand Down
6 changes: 3 additions & 3 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ mainSections = ["docs"]
containerBreakpoint = "lg" # "", "sm", "md", "lg" (default), "xl", "xxl", or "fluid"

## Button
navBarButton = true # false (default) or true
navBarButtonUrl = "docs/gettingstarted/introduction/"
navBarButton = false # false (default) or true
navBarButtonUrl = "docs/guides/introduction/"
navBarButtonText = "Get started"

# FlexSearch
Expand Down Expand Up @@ -74,7 +74,7 @@ mainSections = ["docs"]
editPage = false # false (default) or true
lastMod = true # false (default) or true
repoHost = "GitHub" # GitHub (default), Gitea, GitLab, Bitbucket, or BitbucketServer
docsRepo = "https://roll20.github.io/"
docsRepo = ""
docsRepoBranch = "main" # main (default), master, or <branch name>
docsRepoSubPath = "" # "" (none, default) or <sub path>

Expand Down
6 changes: 3 additions & 3 deletions content/docs/components/InitRelay.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ These components are crucial for handling actions, computations, macros, and rol
{{< card-grid >}}
{{< link-card
title="Actions"
description=" Actions define specific operations that can be performed by characters within the VTT. These operations can range from simple tasks like rolling a dice to more complex interactions such as casting spells or activating abilities."
description=" Actions define specific operations that can be performed by characters within the Roll20 Tabletop. These operations can range from simple tasks like rolling a dice to more complex interactions such as casting spells or activating abilities."
href="/docs/components/actions/"
target="_blank"
>}}
{{< link-card
title="Handlers"
description="Handlers are event listeners that manage communication between the VTT and the character sheet. They respond to various events, such as changes in character attributes or settings, and trigger appropriate actions or updates."
description="Handlers are event listeners that manage communication between the Roll20 Tabletop and the character sheet. They respond to various events, such as changes in character attributes or settings, and trigger appropriate actions or updates."
href="/docs/components/handlers/"
target="_blank"
>}}
Expand All @@ -70,7 +70,7 @@ These components are crucial for handling actions, computations, macros, and rol
{{< card-grid >}}
{{< link-card
title="Rolls"
description="The Rolls component allows for advanced dice-rolling mechanics within the VTT. It supports both simple and complex rolls, providing flexibility in how roll results are displayed and computed."
description="The Rolls component allows for advanced dice-rolling mechanics within the Roll20 Tabletop. It supports both simple and complex rolls, providing flexibility in how roll results are displayed and computed."
href="/docs/components/rolls/"
target="_blank"
>}}
Expand Down
22 changes: 18 additions & 4 deletions content/docs/components/dispatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@ dispatch.update({
character: Partial<Character>
}): Promise<void>
```
The `update` method sends character changes to the host (Roll20 Tabletop or Roll20 Characters) to be persisted. The partial character passed in here must contain the character's id, and can contain any combination of the attributes, bio, and gmNotes properties. When updating a character’s attributes, only include those attributes that have changed.
The `update` method sends character changes to the host (Roll20 Tabletop or Roll20 Characters) to be persisted.

The partial character passed in here must contain the character's id, and can contain any combination of the attributes, bio, and gmNotes properties. When updating a character’s attributes, only include those attributes that have changed.

#### updateCharacter
```javascript
dispatch.updateCharacter({
character: Partial<Character>
}): Promise<void>
```
Like the `update` method, `updateCharacter` sends character changes to the host page (Roll20 Tabletop or Roll20 Characters) to be persisted. However, this method takes a full set of character attributes as the character argument, and automatically computes the diff with existing character attributes, so that only changed attributes are sent to the data store.
Like the `update` method, `updateCharacter` sends character changes to the host page (Roll20 Tabletop or Roll20 Characters) to be persisted.

However, this method takes a full set of character attributes as the character argument, and automatically computes the diff with existing character attributes, so that only changed attributes are sent to the data store.

#### roll
```javascript
Expand All @@ -41,7 +45,11 @@ dispatch.roll({
messageId?: string
}): Promise<{messageId: string, results: RollResults }>
```
The `roll` method takes one or more rolls in the form of an object, where the keys are unique roll names and the values are roll strings. messageId can be provided to attach the roll to an existing chat message, either overriding it or appending to it in the chat log. If messageId is omitted, the roll will be associated with a new chat message and a new messageId for that message will be returned with the roll results. The method returns a promise that resolves with an object containing the messageId and the RollResult (see Types). The roll result is returned in the same format as in the non-beacon dice rolls computed roll system.
The `roll` method takes one or more rolls in the form of an object, where the keys are unique roll names and the values are roll strings. messageId can be provided to attach the roll to an existing chat message, either overriding it or appending to it in the chat log.

If messageId is omitted, the roll will be associated with a new chat message and a new messageId for that message will be returned with the roll results.

The method returns a promise that resolves with an object containing the messageId and the RollResult (see Types). The roll result is returned in the same format as in the non-beacon dice rolls computed roll system.

#### post
```javascript
Expand All @@ -55,7 +63,13 @@ dispatch.post({
}
}): Promise<string>
```
`post` posts a message to chat, either creating a new message or overwriting an existing one. It requires a character id and message content, a string containing either plain text or HTML to be posted. The method also accepts an options object. Currently, only whisper and secret are supported, the only valid value for whisper is gm, which will send the message as a whisper to the gm. The secret option is ignored unless whisper is also set, toggling to true will cause the message to not be visible to the controlling player. Like roll, messageId can be provided to update an existing chat message, but if omitted the method will generate a new messageId and post a new chat message. The method returns the messageId.
`post` posts a message to chat, either creating a new message or overwriting an existing one. It requires a character id and message content, a string containing either plain text or HTML to be posted.

The method also accepts an options object. Currently, only whisper and secret are supported, the only valid value for whisper is gm, which will send the message as a whisper to the gm.

The secret option is ignored unless whisper is also set, toggling to true will cause the message to not be visible to the controlling player.

Like roll, messageId can be provided to update an existing chat message, but if omitted the method will generate a new messageId and post a new chat message. The method returns the messageId.

#### query
```javascript
Expand Down
2 changes: 1 addition & 1 deletion content/docs/components/macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ seo:
noindex: false # false (default) or true
---

When utilizing Macros within the VTT, there are instances where a legacy macro might need to be employed for a Beacon sheet.
When utilizing Macros within the Roll20 Tabletop, there are instances where a legacy macro might need to be employed for a Beacon sheet.

This scenario commonly arises when transitioning from an existing legacy sheet to a Beacon sheet. During such transitions, it's possible that the attributes called from the legacy macro may not align with the structure of attributes in the Beacon Sheet.

Expand Down
7 changes: 7 additions & 0 deletions content/docs/gettingstarted/examplesheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ To set this sheet up properly, make sure that you have the following:
- SCSS
- Ability to run Unit & End-to-End Tests

{{< callout context="note" >}}
To download the community quick start sheet, refer to these repositories:
- [Community Sheet Repo](https://github.com/Roll20/roll20-beacon-sheets)

- [Quick Start Sheet](https://github.com/Roll20/roll20-beacon-sheets/tree/main/sheets/quickstart-example-sheet)

{{< /callout >}}

_**Figure 1**: Advanced sheet_

Expand Down
4 changes: 2 additions & 2 deletions content/docs/gettingstarted/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This will install the Beacon SDK package to your project's `package.json` file.

The Beacon package exports various utilities you can use in your application. The main one that needs to be setup to enable the connection between Beacon SDK and Roll20 is `initRelay`.

Ideally you would want to call this when your sheet is initalizing, and it is the function where you will define sheet actions, computed values, and how the sheet will response to or send character data changes. [visit the initRelay page for a more detailed breakdown.]()
Ideally you would want to call this when your sheet is initalizing, and it is the function where you will define sheet actions, computed values, and how the sheet will response to or send character data changes. [visit the initRelay page for a more detailed breakdown.](/docs/components/initrelay/)

Add the following to your project:
```javascript
Expand All @@ -71,7 +71,7 @@ const dispatch = initRelay({
})
```

`initRelay` returns a dispatch function that allows you to call methods or send changes from the sheet to Roll20. Check out the page on [dispatch]() to learn more about the different methods.
`initRelay` returns a dispatch function that allows you to call methods or send changes from the sheet to Roll20. Check out the page on [dispatch](/docs/components/dispatch/) to learn more about the different methods.

## Step 3: Settings up the Roll20 tabletop sandbox

Expand Down
45 changes: 26 additions & 19 deletions content/docs/gettingstarted/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,53 @@ seo:
canonical: "" # custom canonical URL (optional)
noindex: false # false (default) or true
---
{{< callout context="caution" title="This project is currently in closed beta. " icon="outline/alert-triangle" >}}
Please complete the [form](https://forms.gle/XXnj1SbfmYnUq8Hu9) to request access to the closed beta.

The Beacon SDK is a toolset designed to enhance and streamline the development of virtual tabletop (VTT) character sheets and other interactive elements.
For more info about the release of the closed beta, refer to this [document](
https://docs.google.com/document/d/1lVXp2TKb5gof-6hXvjWgQ7Zo09LZlorBoyjv5un8IeU/edit?usp=sharing)

{{< /callout >}}

Whether you're a game master (GM), a developer, or a player, the Beacon SDK provides a framework to create dynamic, responsive, and fully integrated VTT experiences.
The Beacon SDK is a toolset designed to enhance and streamline the development of virtual tabletop (VTT) character sheets and other interactive elements.

Whether you're a game master (GM), a developer, or a player, the Beacon SDK provides a framework to create dynamic, responsive, and fully integrated Roll20 Tabletop experiences.

## What is the Beacon SDK?

The Beacon SDK (software development kit) is a toolset used to create digital character sheets on Roll20 for Roll20 Tabletop and Roll20 Characters.
Whether you're an experience developer, or just starting out, the Beacon SDK provides a framework to create dynamic, responsive, and fully integrated character sheet experiences.
The Beacon SDK is a specialized software development kit for virtual tabletops.

It facilitates creating and managing interactive character sheets, roll templates, macros, and other Roll20 Tabletop functionalities.

The Beacon SDK also introduces a new way to develop characters sheets for Roll20. Beacon SDK allows you to connect your local development environment to sandboxes in Roll20 Characters and Roll20 Tabletop, giving you real-time updates as you develop.
The SDK ensures easy communication between the Roll20 Tabletop platform and the character sheets, allowing real-time updates and interactions.

## Key Features

- **Character Sheets**: Design and implement a web app character sheet with dynamic attributes and real-time updates.
- **Local Development**: Work where you are most comfortable and get real-time updates in sandboxes in Roll20.
- **Testing Sheets**: Release a testing sheet and give others special access to it before you push it live for everyone.
- **Roll Mechanics**: Integrate complex roll formulas and display roll results directly within the Roll20 Tabletop and Roll20 Characters.
- **Character Sheets**: Design and implement detailed character sheets with dynamic attributes and real-time updates.
- **Roll Mechanics**: Integrate complex roll formulas and display roll results directly within the Roll20 Tabletop.
- **Macros**: Create and manage macros for automated actions and roll calculations.
- **Event Handling**: Utilize a comprehensive set of handlers to manage various events and interactions within the Roll20 Tabletop.
- **Legacy Support**: Convert and integrate legacy macros and roll templates with the new Beacon architecture.
- **Customization**: Define custom actions, computed attributes and handle specific roll templates tailored to your game's needs.
- **Customization**: Define custom actions computed properties and handle specific roll templates tailored to your game's needs.

## Components Overview

The Beacon SDK is composed of several key components:

- **Actions**: Define and manage custom actions that can be triggered within the VTT.
- **Handlers**: Event handlers that process and respond to various VTT events and messages.
- **Computed Attributes**: Define dynamically computed attributes based on other attributes.
- **Actions**: Define and manage custom actions that can be triggered within the Roll20 Tabletop.
- **Handlers**: Event handlers that process and respond to various Roll20 Tabletop events and messages.
- **Computed Properties**: Define dynamically computed properties based on other attributes.
- **Macro Attributes**: Convert and manage legacy macro attributes for compatibility with the Beacon SDK.
- **Rolls**: Implement advanced roll mechanics and display results dynamically within the VTT.
- **Rolls**: Implement advanced roll mechanics and display results dynamically within the Roll20 Tabletop.

For a comprehensive overview of these components, view the components section.

## Getting Started

To get started with the Beacon SDK, you must initialize the relay, set up your character sheets, and define the necessary actions, handlers, and computed attributes.
To get started with the Beacon SDK, you must initialize the relay, set up your character sheets, and define the necessary actions, handlers, and computed properties.

This documentation provides detailed guides and example sheets to help you through each step of the process.
This documentation provides detailed guides and examples to help you through each step of the process.

By leveraging the Beacon SDK, you can create rich, interactive, fully integrated VTT experiences that enhance gameplay and streamline game management.
By leveraging the Beacon SDK, you can create rich, interactive, fully integrated Roll20 Tabletop experiences that enhance gameplay and streamline game management.

Whether adapting existing character sheets or building new ones from scratch, the Beacon SDK offers the tools and flexibility to bring your digital character sheet to life.
Whether adapting existing character sheets or building new ones from scratch, the Beacon SDK offers the tools and flexibility to bring your virtual tabletop to life.
17 changes: 12 additions & 5 deletions content/docs/gettingstarted/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ To set this sheet up properly, make sure that you have the following tools insta
- Vite
- SCSS

{{< callout context="note" >}}
To download the community quick start sheet, refer to these repositories:
- [Community Sheet Repo](https://github.com/Roll20/roll20-beacon-sheets)

- [Quick Start Sheet](https://github.com/Roll20/roll20-beacon-sheets/tree/main/sheets/quickstart-example-sheet)

{{< /callout >}}

_**Figure 1**: Quickstart sheet_

Expand Down Expand Up @@ -49,11 +56,11 @@ npm run dev

Once this code executes successfully, you can access the Vite server at `http://localhost:5173`.

This method is useful when you do not have access to the Roll20 website or would like to work on parts of your project that do not depend on a connection to the VTT or Roll20 Characters, such as working on styling, mocking up the environment, building Vue components, testing functionality, etc.
This method is useful when you do not have access to the Roll20 website or would like to work on parts of your project that do not depend on a connection to the Roll20 Tabletop or Roll20 Characters, such as working on styling, mocking up the environment, building Vue components, testing functionality, etc.


{{< callout context="tip" >}}
In development mode, you cannot save or access existing character data or use the Beacon SDK functions that depend on VTT or Roll20 Characters functionality, such as dice rolling and token manipulation.
In development mode, you cannot save or access existing character data or use the Beacon SDK functions that depend on Roll20 Tabletop or Roll20 Characters functionality, such as dice rolling and token manipulation.
{{< /callout >}}

b. **Sandbox Development**: This method will run the Vite server with the port set to `7620` and the environment set to staging mode.
Expand All @@ -62,9 +69,9 @@ b. **Sandbox Development**: This method will run the Vite server with the port s
npm run sandbox
```

This command will build the SCSS files and then run the Vite server. This will set the server up for connecting to a VTT custom sheet sandbox as well as through the sandbox in Roll20 Characters.
This command will build the SCSS files and then run the Vite server. This will set the server up for connecting to a Roll20 Tabletop custom sheet sandbox as well as through the sandbox in Roll20 Characters.

To test your changes in the VTT custom sheet sandbox, you will need to add the following to the `sheet.json` editor in the game settings:
To test your changes in the Roll20 Tabletop custom sheet sandbox, you will need to add the following to the `sheet.json` editor in the game settings:

```json
{
Expand Down Expand Up @@ -93,4 +100,4 @@ npm run lint

```bash
npm run format
```
```
Loading

0 comments on commit 42b7878

Please sign in to comment.