From d730ec35ce456721327374f09ad9f6f28971a8e8 Mon Sep 17 00:00:00 2001 From: Alexander B Date: Fri, 28 Jun 2019 18:31:35 -0500 Subject: [PATCH 01/48] Fix typo in types.md --- docs/types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/types.md b/docs/types.md index 80ed0b67..a9903aa7 100644 --- a/docs/types.md +++ b/docs/types.md @@ -141,7 +141,7 @@ Local | The center of the Object's model is `{x=0, y=0, z=0}`. The center of an #####Rotation -X is pitch (nodding your head), Y is yaw (shaking you head), Z is roll (tilting your head). +X is pitch (nodding your head), Y is yaw (shaking your head), Z is roll (tilting your head). #####Direction From b8336eca34a64f18529a8be6f0455610cc1323cf Mon Sep 17 00:00:00 2001 From: Rolando Romero Date: Sun, 30 Jun 2019 03:33:28 -0500 Subject: [PATCH 02/48] Added required "name" attribute for Save&Play --- docs/externaleditorapi.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/externaleditorapi.md b/docs/externaleditorapi.md index 3ce8d679..346303ae 100644 --- a/docs/externaleditorapi.md +++ b/docs/externaleditorapi.md @@ -151,11 +151,13 @@ TTS listens for a JSON message with an ID of 1 containing an array of the Lua Sc "messageID": 1, "scriptStates": [ { + "name": "Global", "guid": "-1", "script": "...", "ui": "..." }, { + "name": "Block Rectangle", "guid": "a0b2d5", "script": "..." }, From 9a9c4dff9829ae44c6ba48f1c594dcaed81735a6 Mon Sep 17 00:00:00 2001 From: David Smith Date: Sat, 28 Dec 2019 12:42:41 -0800 Subject: [PATCH 03/48] Update intro.md Updated links to Object Classes and Static Classes to be relative so they no longer 404. All of the targeted links are one level higher in the directory structure. --- docs/intro.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/intro.md b/docs/intro.md index 40141cb8..435b0d2b 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -52,26 +52,26 @@ Defining class requires further knowledge on object-oriented programming to real ####Object Classes Associated with in-game Objects. -* [Clock](clock) -* [Counter](counter) -* [Object](object) -* [AssetBundle](assetbundle) -* [RPGFigurine](rpgfigurine) -* [TextTool](texttool) +* [Clock](../clock) +* [Counter](../counter) +* [Object](../object) +* [AssetBundle](../assetbundle) +* [RPGFigurine](../rpgfigurine) +* [TextTool](../texttool) ####Static Classes Associated with in-game properties and systems. -* [JSON](json) -* [Player](player) -* [WebRequest](webrequest) -* [Physics](physics) -* [Lighting](lighting) -* [Turns](turns) -* [Notes](notes) -* [UI](ui) -* [Wait](wait) -* [Web Request](webrequest) +* [JSON](../json) +* [Player](../player) +* [WebRequest](../webrequest) +* [Physics](../physics) +* [Lighting](../lighting) +* [Turns](../turns) +* [Notes](../notes) +* [UI](../ui) +* [Wait](../wait) +* [Web Request](../webrequest) For more information on what a class is, you can refer to the relevant [Lua Documentation](https://www.lua.org/pil/16.1.html). From 86c1d4ece5dd7a6940ff55ab4163f81d66e84dce Mon Sep 17 00:00:00 2001 From: BreadMoirai Date: Tue, 25 Feb 2020 20:37:05 -0800 Subject: [PATCH 04/48] Fix code snippet for #getValue --- docs/ui.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui.md b/docs/ui.md index 2a647382..eb288a67 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -125,7 +125,7 @@ end ``` Lua -string = UI.getAttribute("testElement") +string = UI.getValue("testElement") print(string) ``` From 9b27c98320e606853f2288842a01aca657acba40 Mon Sep 17 00:00:00 2001 From: Rylern <60394504+Rylern@users.noreply.github.com> Date: Thu, 19 Mar 2020 21:50:19 +0100 Subject: [PATCH 05/48] Update attributes.md --- docs/ui/attributes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui/attributes.md b/docs/ui/attributes.md index e89933cf..702f46ce 100644 --- a/docs/ui/attributes.md +++ b/docs/ui/attributes.md @@ -1,4 +1,4 @@ -boundaryAs mentioned in the [Introduction](xml/introUI), attributes are modifiers that can be applied to elements. They can be applied to individual elements or to whole groups of them. +As mentioned in the [Introduction](xml/introUI), attributes are modifiers that can be applied to elements. They can be applied to individual elements or to whole groups of them. !!!important They consists of two parts, a **tag** and a **value**. ***The value is always in quotation marks.*** From 5304aa61dda5a5c34a1b7435a2f48e271f2a3bc5 Mon Sep 17 00:00:00 2001 From: Charles Cantrell Date: Wed, 8 Apr 2020 19:23:42 -0400 Subject: [PATCH 06/48] Proof Edits Corrected minor typos and spelling errors. No substantive changes. --- docs/intro.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/intro.md b/docs/intro.md index 40141cb8..e859a480 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -3,7 +3,7 @@ In this section, you will find details on all events/classes/functions specific ##Using TTS Documentation ###Left Column -This is the top-level list of classes and other information needed when scripting with Lua in Tabletop Simulator. Event, Base and Object are the three pages you will use the most, with the rest referring to niche information you can access as you go. It is a good idea to familiarize yourself with the contents of those three pages in order to have a good high-level understanding of off what scripting is capable of doing. +This is the top-level list of classes and other information needed when scripting with Lua in Tabletop Simulator. Event, Base and Object are the three pages you will use the most, with the rest referring to niche information you can access as you go. It is a good idea to familiarize yourself with the contents of those three pages in order to have a good high-level understanding of what scripting is capable of doing. ###Right Column The Table of Contents will lay out the contents of the page you are on. It always starts with high-level summary information first and, if needed, detailed information towards the bottom. The next to a summary element will take you directly down to the relevant detailed explanation below. @@ -20,7 +20,7 @@ Just click the link in the pencil icon in the top-right of an article, or visit ##TTS Terms ###Object -On in-game physical Object that currently exists in the scene. If an Object is placed inside of a bag/deck/etc, it stops existing and is no longer in the scene until it is pulled back out. +An in-game physical Object that currently exists in the scene. If an Object is placed inside of a bag/deck/etc, it stops existing and is no longer in the scene until it is pulled back out. ###Player A person in the game. Each Player is assigned a color, with spectators being "Grey". If you are attempting to identify a Player, you would use the color of the seat they are in to do so. @@ -29,7 +29,7 @@ A person in the game. Each Player is assigned a color, with spectators being "Gr The Global script, which is a script that is not attached to any particular Object. It is always present during a game. ###Object Script -A script that is attached to an in-game Objecet, and is saved as part of it. This is similar to any other property like its scale or tint. Some functions ask for an Object reference in order to attempt to run a function on it. In these cases, Global (exactly as written here) is also a valid Object reference. +A script that is attached to an in-game Object, and is saved as part of it. This is similar to any other property like its scale or tint. Some functions ask for an Object reference in order to attempt to run a function on it. In these cases, Global (exactly as written here) is also a valid Object reference. ###GUID In Tabletop Simulator, a GUID is a unique 6-character [string](types) which can be used to identify in-game [Objects](object). GUIDs are automatically assigned when objects exist within the scene. @@ -47,7 +47,7 @@ If an object is duplicated, it will sometimes have the same GUID for 1 frame bef ###Classes -Defining class requires further knowledge on object-oriented programming to really understand. However for the purposes of Tabletop Simulator Lua scripting, you can think of a class as a standard or collection that handles categories of objects. +Defining classes requires further knowledge of object-oriented programming to really understand. However for the purposes of Tabletop Simulator Lua scripting, you can think of a class as a standard or collection that handles categories of objects. ####Object Classes Associated with in-game Objects. From 13f2cb7708f210b6b2a7b895c3ae4ef5050392a7 Mon Sep 17 00:00:00 2001 From: Seferan Date: Fri, 10 Apr 2020 09:31:18 -0500 Subject: [PATCH 07/48] Updating Atom Documentation for opening Console Console is opened using Control + Shift + i (atleast on windows). Original text indicated Control + Alt + i --- docs/atom.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/atom.md b/docs/atom.md index 5268879c..e8d49d4d 100644 --- a/docs/atom.md +++ b/docs/atom.md @@ -89,8 +89,8 @@ The plugin will automatically check for updates when Atom is started. If a new u These are just a few basic tips to help get the most out of Atom. * Print Messages - * All print() functions automatically send their messages to Atom's console (ctrl + alt + i). + * All print() functions automatically send their messages to Atom's console (ctrl + shift + i). * Error Messages - * All Lua errors are automatically sent to Atom's console (ctrl + alt + i). + * All Lua errors are automatically sent to Atom's console (ctrl + shift + i). * Quick Save + Play * Hitting Ctrl + Shift + S will trigger Save & Play. From 13749ee41ee9adee967a259aaedcde1b1f1230a6 Mon Sep 17 00:00:00 2001 From: flocker1 <40889133+flocker1@users.noreply.github.com> Date: Tue, 14 Apr 2020 17:10:47 +0800 Subject: [PATCH 08/48] Update intro.md fixed typo --- docs/intro.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/intro.md b/docs/intro.md index 40141cb8..f5040ff7 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -3,7 +3,7 @@ In this section, you will find details on all events/classes/functions specific ##Using TTS Documentation ###Left Column -This is the top-level list of classes and other information needed when scripting with Lua in Tabletop Simulator. Event, Base and Object are the three pages you will use the most, with the rest referring to niche information you can access as you go. It is a good idea to familiarize yourself with the contents of those three pages in order to have a good high-level understanding of off what scripting is capable of doing. +This is the top-level list of classes and other information needed when scripting with Lua in Tabletop Simulator. Event, Base and Object are the three pages you will use the most, with the rest referring to niche information you can access as you go. It is a good idea to familiarize yourself with the contents of those three pages in order to have a good high-level understanding of what scripting is capable of doing. ###Right Column The Table of Contents will lay out the contents of the page you are on. It always starts with high-level summary information first and, if needed, detailed information towards the bottom. The next to a summary element will take you directly down to the relevant detailed explanation below. From f3c29f4ba3716777b337abff39b912d1bf3bcb7b Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Tue, 21 Apr 2020 12:02:50 -0400 Subject: [PATCH 09/48] added missing fill-related attributes --- docs/ui/attributes.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/ui/attributes.md b/docs/ui/attributes.md index e89933cf..eebb0524 100644 --- a/docs/ui/attributes.md +++ b/docs/ui/attributes.md @@ -79,7 +79,12 @@ Attribute Name          & image | Name of image (in the asset manager). | string | (*none*) preserveAspect | Should the aspect ratio of this image be preserved? | [](attributes#attribute-types) | *(varies)* color | Color for this element's image | [](attributes#attribute-types) | `clear` or `#FFFFFF` -type | Image Type | Simple, Sliced, Filled, Tiled | *(varies)* +type | How to display the image. |
  • Simple
  • Sliced
  • Tiled
  • Filled
| *(varies)* +fillCenter | When `type="Sliced"`: whether to draw the center of the image. | [](attributes#attribute-types) | `true` +fillMethod | When `type="Filled"`: how to fill the image. |
  • Horizontal
  • Vertical
  • Radial90
  • Radial180
  • Radial360
| `Radial360` +fillOrigin | When `type="Filled"`: where to start filling from. `0` is the lower-leftmost corner/edge, and each successive number is the next corner/edge going around clockwise. |
  • 0
  • 1
  • 2
  • 3
| `0` +fillAmount | When `type="Filled"`: how much of the picture is filled in, with `0` being none at all, and `1` being all of it.| float | `1` +fillClockwise | When `type="Filled"`: whether to fill radially clockwise as opposed to counterclockwise. | [](attributes#attribute-types) | `true` raycastTarget | If the element blocks clicks. | [](attributes#attribute-types) | `true` From 5c1d7f86a505bd8dbc03fe9e06c204d2e10a3c89 Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Tue, 21 Apr 2020 12:42:39 -0400 Subject: [PATCH 10/48] added missing text attributes --- docs/ui/attributes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/ui/attributes.md b/docs/ui/attributes.md index eebb0524..019384be 100644 --- a/docs/ui/attributes.md +++ b/docs/ui/attributes.md @@ -62,6 +62,7 @@ Attribute Name          & text | This can be used to determine the text that appears. It can also be modified externally by the script. | string | *(none)* alignment | |
  • UpperLeft
  • UpperCenter
  • UpperRight
  • MiddleLeft
  • MiddleCenter
  • MiddleRight
  • LowerLeft
  • LowerCenter
  • LowerRight
| MiddleCenter color | | [](attributes#attribute-types) | `#323232` +font | The font used for the text. Only `Arial` and `Courier New` are known to work. | string | `Arial` fontStyle | |
  • Normal
  • Bold
  • Italic
  • BoldItalic
| `Normal` fontSize | | float | `14` resizeTextForBestFit | Resize text to fit? | [](attributes#attribute-types) | `false` @@ -69,6 +70,8 @@ resizeTextMinSize | Minimum font size | float | `10` resizeTextMaxSize | Maximum font size | float | `40` horizontalOverflow | |
  • Wrap
  • Overflow
| `Overflow` verticalOverflow | |
  • Truncate
  • Overflow
| `Truncate` +lineSpacing | How much space to leave between each line. | float | `1` +alignByGeometry | Whether text bounds are calculated based on character shapes as opposed to font data | [](attributes#attribute-types) | `false` ###Image Attributes From c15131df98bcf7921bb41cb95a58fe222f419274 Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Wed, 22 Apr 2020 01:20:53 -0400 Subject: [PATCH 11/48] added missing general and tooltip attributes --- docs/ui/attributes.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/docs/ui/attributes.md b/docs/ui/attributes.md index 019384be..12f9f980 100644 --- a/docs/ui/attributes.md +++ b/docs/ui/attributes.md @@ -32,8 +32,12 @@ Attribute Name          & active | Specifies whether or not this element is active. This can be used to hide/show elements via scripting. Triggering this via script will not trigger animations. | bool | `true` class | This allows you to group elements together by giving them the same class. It is used with [Defaults](defaults). | string | (none) id | Used by Lua scripting to identify an element within the XML. | string | (none) +name | Specifies the name of this game object in the Unity hierarchy. (See [Component](../../component)) | string | (varies) isDropReceiver | Determine if an object triggers onElementDropped. | bool | false visibility | What colors are able to see the element. See below for additional details. | string | (visible to all) +hoverClass | Class or classes to be applied only while the mouse is over the element | string | (none) +selectClass | Class or classes to be applied only while the element is selected | string | (none) +pressClass | Class or classes to be applied only while the element is pressed | string | (none) ####Visibility Targets The visibility attribute allows for only certain people or groups to see an element. Hiding an element will hide its children as well. @@ -166,12 +170,21 @@ Attribute Name          & -- | -- | -- | -- tooltip | Tooltip text. | string | *(none)* tooltipBorderColor | Color of the tooltips border. | [](attributes#attribute-types) | `#FFFFFF` -tooltipBackgroundColor | Color of the tooltips background | [](attributes#attribute-types) | `rgba(0,0,0,0.62)` -tooltipTextColor | Color of the text within this tooltip | [](attributes#attribute-types) | -tooltipPosition | Position of this tooltip in relation to the element. |
  • Above
  • Below
  • Left
  • Right
| `Right` -tooltipBorderImage | This attribute allows you to override the default image used for the tooltips border. | string | -tooltipBackgroundImage | This attribute allows you to override the default image used for the tooltips background. | string | -tooltipOffset | This attribute allows you to modify the distance this tooltip will appear from the element. | float | +tooltipBackgroundColor | Color of the tooltips background | [](attributes#attribute-types) | `rgba(0,0,0,0.62)`\* +tooltipTextColor | Color of the text within this tooltip | [](attributes#attribute-types) | `white` +tooltipTextOutlineColor | Color of the outline around the text within this tooltip. | [](attributes#attribute-types) | `black` +tooltipFont | Font used for the tooltip text. Only `Arial` and `Courier New` are known to work. | string | `Arial`\* +tooltipFontSize | Size of the tooltip text. | int | `12` +tooltipPosition | Position of this tooltip in relation to the element. |
  • Above
  • Below
  • Left
  • Right
| `Right`\* +tooltipBorderImage | This attribute allows you to override the default image used for the tooltips border. | string | \* +tooltipBackgroundImage | This attribute allows you to override the default image used for the tooltips background. | string | \* +tooltipOffset | This attribute allows you to modify the distance this tooltip will appear from the element. | float | `10`\* +tooltipWidth | The tooltip's maximum width before wrapping, or `0` for none. | float | (none) +tooltipDelayTime | How many seconds the element must be hovered before the tooltip shows. | float | ~`0.1`\* +tooltipFadeTime | How many seconds it takes for the tooltip to fade in or out. | float | ~`0.2`\* + +!!!bug + For each attribute marked with an asterisk (\*), if a tooltip is hovered with that attribute specified, then that tooltip's setting becomes the new default for any tooltips with that attribute unspecified. ###Event Attributes Allows Lua scripting events to be triggered by any element, through a variety of interactions. See the [Input Elements](inputelements) page for how to interact with Lua scripting. From d431f3fa16779bab2076f616852968fdfe12e9ac Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Wed, 22 Apr 2020 11:09:04 -0400 Subject: [PATCH 12/48] deleted conflicting CNAME --- docs/CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index 9ed6b20c..00000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -tts-api.ge.cx From 31cd57047544375b084e9ef36db53234b9fefa0e Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Wed, 22 Apr 2020 11:21:28 -0400 Subject: [PATCH 13/48] added .vscode/ to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index df624487..cee13065 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ site/ -mkdocs/ \ No newline at end of file +mkdocs/ +.vscode/ From cd0be91994848fbc31fd872bb7b6bf76a38e60cd Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Wed, 22 Apr 2020 14:25:27 -0400 Subject: [PATCH 14/48] Revert "added missing fill-related attributes" This reverts commit f3c29f4ba3716777b337abff39b912d1bf3bcb7b. cleaned personal master to continue work on branch --- docs/ui/attributes.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/ui/attributes.md b/docs/ui/attributes.md index 12f9f980..024ede53 100644 --- a/docs/ui/attributes.md +++ b/docs/ui/attributes.md @@ -86,12 +86,7 @@ Attribute Name          & image | Name of image (in the asset manager). | string | (*none*) preserveAspect | Should the aspect ratio of this image be preserved? | [](attributes#attribute-types) | *(varies)* color | Color for this element's image | [](attributes#attribute-types) | `clear` or `#FFFFFF` -type | How to display the image. |
  • Simple
  • Sliced
  • Tiled
  • Filled
| *(varies)* -fillCenter | When `type="Sliced"`: whether to draw the center of the image. | [](attributes#attribute-types) | `true` -fillMethod | When `type="Filled"`: how to fill the image. |
  • Horizontal
  • Vertical
  • Radial90
  • Radial180
  • Radial360
| `Radial360` -fillOrigin | When `type="Filled"`: where to start filling from. `0` is the lower-leftmost corner/edge, and each successive number is the next corner/edge going around clockwise. |
  • 0
  • 1
  • 2
  • 3
| `0` -fillAmount | When `type="Filled"`: how much of the picture is filled in, with `0` being none at all, and `1` being all of it.| float | `1` -fillClockwise | When `type="Filled"`: whether to fill radially clockwise as opposed to counterclockwise. | [](attributes#attribute-types) | `true` +type | Image Type | Simple, Sliced, Filled, Tiled | *(varies)* raycastTarget | If the element blocks clicks. | [](attributes#attribute-types) | `true` From 582be4b3e96adf96915c507bf43cc24d87f0ab29 Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Wed, 22 Apr 2020 14:29:34 -0400 Subject: [PATCH 15/48] Revert "added missing text attributes" This reverts commit 5c1d7f86a505bd8dbc03fe9e06c204d2e10a3c89. cleaned master to continue work on branch --- docs/ui/attributes.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/ui/attributes.md b/docs/ui/attributes.md index 024ede53..c7096e92 100644 --- a/docs/ui/attributes.md +++ b/docs/ui/attributes.md @@ -66,7 +66,6 @@ Attribute Name          & text | This can be used to determine the text that appears. It can also be modified externally by the script. | string | *(none)* alignment | |
  • UpperLeft
  • UpperCenter
  • UpperRight
  • MiddleLeft
  • MiddleCenter
  • MiddleRight
  • LowerLeft
  • LowerCenter
  • LowerRight
| MiddleCenter color | | [](attributes#attribute-types) | `#323232` -font | The font used for the text. Only `Arial` and `Courier New` are known to work. | string | `Arial` fontStyle | |
  • Normal
  • Bold
  • Italic
  • BoldItalic
| `Normal` fontSize | | float | `14` resizeTextForBestFit | Resize text to fit? | [](attributes#attribute-types) | `false` @@ -74,8 +73,6 @@ resizeTextMinSize | Minimum font size | float | `10` resizeTextMaxSize | Maximum font size | float | `40` horizontalOverflow | |
  • Wrap
  • Overflow
| `Overflow` verticalOverflow | |
  • Truncate
  • Overflow
| `Truncate` -lineSpacing | How much space to leave between each line. | float | `1` -alignByGeometry | Whether text bounds are calculated based on character shapes as opposed to font data | [](attributes#attribute-types) | `false` ###Image Attributes From 307e538a26e18453e3999d9337e5990d4bfdf9de Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Wed, 22 Apr 2020 14:30:59 -0400 Subject: [PATCH 16/48] Revert "added missing general and tooltip attributes" This reverts commit c15131df98bcf7921bb41cb95a58fe222f419274. cleaned master to continue work on branch --- docs/ui/attributes.md | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/docs/ui/attributes.md b/docs/ui/attributes.md index c7096e92..e89933cf 100644 --- a/docs/ui/attributes.md +++ b/docs/ui/attributes.md @@ -32,12 +32,8 @@ Attribute Name          & active | Specifies whether or not this element is active. This can be used to hide/show elements via scripting. Triggering this via script will not trigger animations. | bool | `true` class | This allows you to group elements together by giving them the same class. It is used with [Defaults](defaults). | string | (none) id | Used by Lua scripting to identify an element within the XML. | string | (none) -name | Specifies the name of this game object in the Unity hierarchy. (See [Component](../../component)) | string | (varies) isDropReceiver | Determine if an object triggers onElementDropped. | bool | false visibility | What colors are able to see the element. See below for additional details. | string | (visible to all) -hoverClass | Class or classes to be applied only while the mouse is over the element | string | (none) -selectClass | Class or classes to be applied only while the element is selected | string | (none) -pressClass | Class or classes to be applied only while the element is pressed | string | (none) ####Visibility Targets The visibility attribute allows for only certain people or groups to see an element. Hiding an element will hide its children as well. @@ -162,21 +158,12 @@ Attribute Name          & -- | -- | -- | -- tooltip | Tooltip text. | string | *(none)* tooltipBorderColor | Color of the tooltips border. | [](attributes#attribute-types) | `#FFFFFF` -tooltipBackgroundColor | Color of the tooltips background | [](attributes#attribute-types) | `rgba(0,0,0,0.62)`\* -tooltipTextColor | Color of the text within this tooltip | [](attributes#attribute-types) | `white` -tooltipTextOutlineColor | Color of the outline around the text within this tooltip. | [](attributes#attribute-types) | `black` -tooltipFont | Font used for the tooltip text. Only `Arial` and `Courier New` are known to work. | string | `Arial`\* -tooltipFontSize | Size of the tooltip text. | int | `12` -tooltipPosition | Position of this tooltip in relation to the element. |
  • Above
  • Below
  • Left
  • Right
| `Right`\* -tooltipBorderImage | This attribute allows you to override the default image used for the tooltips border. | string | \* -tooltipBackgroundImage | This attribute allows you to override the default image used for the tooltips background. | string | \* -tooltipOffset | This attribute allows you to modify the distance this tooltip will appear from the element. | float | `10`\* -tooltipWidth | The tooltip's maximum width before wrapping, or `0` for none. | float | (none) -tooltipDelayTime | How many seconds the element must be hovered before the tooltip shows. | float | ~`0.1`\* -tooltipFadeTime | How many seconds it takes for the tooltip to fade in or out. | float | ~`0.2`\* - -!!!bug - For each attribute marked with an asterisk (\*), if a tooltip is hovered with that attribute specified, then that tooltip's setting becomes the new default for any tooltips with that attribute unspecified. +tooltipBackgroundColor | Color of the tooltips background | [](attributes#attribute-types) | `rgba(0,0,0,0.62)` +tooltipTextColor | Color of the text within this tooltip | [](attributes#attribute-types) | +tooltipPosition | Position of this tooltip in relation to the element. |
  • Above
  • Below
  • Left
  • Right
| `Right` +tooltipBorderImage | This attribute allows you to override the default image used for the tooltips border. | string | +tooltipBackgroundImage | This attribute allows you to override the default image used for the tooltips background. | string | +tooltipOffset | This attribute allows you to modify the distance this tooltip will appear from the element. | float | ###Event Attributes Allows Lua scripting events to be triggered by any element, through a variety of interactions. See the [Input Elements](inputelements) page for how to interact with Lua scripting. From 1409a9d5330421d653fd2f7615b84ad19c628c4f Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Fri, 1 May 2020 23:37:29 -0400 Subject: [PATCH 17/48] facelifted the built-in objects page converted entries to tables and added anchors and descriptions --- docs/built-in-object.md | 324 +++++++++++++++++++++------------------- 1 file changed, 171 insertions(+), 153 deletions(-) diff --git a/docs/built-in-object.md b/docs/built-in-object.md index 98c6b0e1..b6dff4dd 100644 --- a/docs/built-in-object.md +++ b/docs/built-in-object.md @@ -1,154 +1,172 @@ -Objects can be spawned by any script using the [spawnObject()](base.md#spawnobject) function. These are the `type` Strings used to designate the type of Object to spawn. - - -##Boards - -* backgammon_board -* CardBot_Board -* Checker_Board -* Chess_Board -* Chinese_Checkers_Board -* Go_Board -* Pachisi_Board -* reversi_board - -##Containers - -* Bag -* Bowl -* Cup -* go_game_bowl_black -* go_game_bowl_white -* Infinite_Bag - -##Figurines - -* Figurine_Card_Bot -* Figurine_Kimi_Kat -* Figurine_Knil -* Figurine_Mara -* Figurine_Sir_Loin -* Figurine_Zeke -* Figurine_Zomblor - -##Game Pieces - -* backgammon_piece_brown -* backgammon_piece_white -* BlockRectangle -* BlockSquare -* BlockTriangle -* Card -* Checker_black -* Checker_red -* Checker_white -* Chess_Bishop -* Chess_King -* Chess_Knight -* Chess_Pawn -* Chess_Queen -* Chess_Rook -* Chinese_Checkers_Piece -* Chip_10 -* Chip_50 -* Chip_100 -* Chip_500 -* Chip_1000 -* Deck -* Die_4 -* Die_6 -* Die_6_Rounded -* Die_8 -* Die_10 -* Die_12 -* Die_20 -* Die_Piecepack -* Domino -* go_game_piece_black -* go_game_piece_white -* Mahjong_Coin -* Mahjong_Stick -* Mahjong_Tile -* Metal Ball -* PiecePack_Arms -* PiecePack_Crowns -* PiecePack_Moons -* PiecePack_Suns -* PlayerPawn -* Quarter -* reversi_chip - -##RPG Figurines - -* rpg_BARGHEST -* rpg_BASILISK -* rpg_BEAR -* rpg_BLACK_DRAGON -* rpg_CENTAUR -* rpg_CERBERUS -* rpg_CHIMERA -* rpg_CRASC -* rpg_CYCLOP -* rpg_DARKNESS_WARLORD -* rpg_DRAGONIDE -* rpg_EVIL_WATCHER -* rpg_GHOUL -* rpg_GIANT_VIPER -* rpg_GOBLIN -* rpg_GOLEM -* rpg_GRIFFON -* rpg_HYDRA -* rpg_KNIGHT -* rpg_KOBOLD -* rpg_LIZARD_WARRIOR -* rpg_MAGE -* rpg_MANTICORA -* rpg_MUMMY -* rpg_OGRE -* rpg_ORC -* rpg_RANGER -* rpg_RAT -* rpg_SKELETON_KNIGHT -* rpg_TEMPLATE -* rpg_THIEF -* rpg_TREE_ENT -* rpg_TROLL -* rpg_VAMPIRE -* rpg_WARRIOR -* rpg_WEREWOLF -* rpg_WYVERN - -##Tilesets - -* Tileset_Barrel -* Tileset_Chair -* Tileset_Chest -* Tileset_Corner -* Tileset_Floor -* Tileset_Rock -* Tileset_Table -* Tileset_Tree -* Tileset_Wall - -##Tools - -* Calculator -* Counter -* Digital_Clock -* Notecard -* Tablet - -##Triggers - -* ScriptingTrigger - * A Scripting Zone, a zone used for scripting -* FogOfWarTrigger - * A [Hidden Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#hidden-zone) -* FogOfWar - * A [Fog of War Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone) - -##Other - -* 3DText - * The text that the [Text Tool](https://kb.tabletopsimulator.com/game-tools/text-tool/) spawns. +This page has information on each type of non-custom object, including the `type` strings used to designate the type of Object to spawn using the [spawnObject()](base.md#spawnobject) function. + +For Custom Objects, see [Custom Game Objects](custom-game-objects.md). + +Each item listed here is treated as a unique object type. (ie. A red checker tinted black will not stack on top of a regular black checker.) + +## Boards + +All boards spawn locked by default. + +Type | Description | Notes +-- | -- | -- +Backgammon_Board | The fold-open board of Backgammon. | Includes snap-points along each triangle. +CardBot_Board | The main board and 4 player boards of CardBots, Build & Destroy. | Includes snap-points on each card and deck location. Not spawnable in the Objects->Components menu. +Checker_Board | The 8x8 board of Checkers. | Includes snap-points on each grid square. +Chess_Board | The 8x8 board of Chess. | Includes snap-points on each grid square. +Chinese_Checkers_Board | The 6-pointed board of Sternhalma, or Chinese Checkers. | Includes snap-points on each indent. +Go_Board | The 9-starred board of Go. | Includes snap-points on each line intersection. Not spawnable in the Objects->Components menu. +Pachisi_Board | A 6-player Pachisi board. | Includes snap-points on each indent. Not spawnable in the Objects->Components menu. +Reversi_Board | The 8x8 board of Reversi. | Includes snap-points on each grid square. Not spawnable in the Objects->Components menu. + +## Containers + +Type | Description | Notes +-- | -- | -- +Bag | A pouch that objects can be stored in and taken from. | +Bowl | A wooden bowl that obects can be dropped in. | The bowl does not have an inventory, objects merely rest within it visually. +Go_Game_Bowl_Black | A bowl that any number of [Black Go Stones](#Go_Game_Piece_Black) can be taken from and dropped back into. | +Go_Game_Bowl_White | A bowl that any number of [White Go Stones](#Go_Game_Piece_White) can be taken from and dropped back into. | +Infinite_Bag | A pouch that infinite copies of a single object can be taken from and dropped back into. | An object must be put into the bag to become the source object. + +## Figurines + +Type | Description | Notes +-- | -- | -- +Figurine_Card_Bot | A rectagule-based figurine of a CardBot from CardBots, Build & Destroy. | Called "CardBot" in the in-game menu. Faces visually to the side. +Figurine_Kimi_Kat | A rectagule-based figurine of two sitting cats. | +Figurine_Knil | A baseless figurine of a sword-wielding knight in full-plate armor. | Called "Knight of Knil" in the in-game menu. +Figurine_Mara | A baseless figurine of a bearded man in slacks. | +Figurine_Sir_Loin | A rectagule-based figurine of a sword-wielding warrior with a shield on his back. | Faces visually backwards. +Figurine_Zeke | A baseless figurine of a cloaked character wielding a sword. | Called "Zeke Kodoku" in the in-game menu. +Figurine_Zomblor | A baseless figurine of a zombified riot-officer with knives for hands, wearing a skirt. | + +## Game Pieces + +Type | Description | Notes +-- | -- | -- +Backgammon_Piece_Brown | A brown Backgammon piece. | +Backgammon_Piece_White | A white Backgammon piece. | +BlockRectangle | A blue rectangular prism. | +BlockSquare | A red cube. | +BlockTriangle | A green triangular prism. | +Card | A card that is blank on both sides. | It is the size of a playing card, but will not stack into a deck. +Checker_Black | A black checker with a crown emblem on the top side. | +Checker_Red | A black checker with a crown emblem on the top side. | +Checker_White | A black checker with a crown emblem on the top side. | +Chess_Bishop | A chrome Chess bishop. | Faces visually to the left. +Chess_King | A chrome Chess King. | +Chess_Knight | A chrome Chess knight. | Faces visually backward (a common chess practice). +Chess_Pawn | A chrome Chess pawn. | +Chess_Queen | A chrome Chess queen. | +Chess_Rook | A chrome Chess rook. | +Chinese_Checkers_Piece | A marble for use in Sternhalma, or Chinese Checkers. | +Chip_10 | A blue poker chip worth $10 | Faces visually to the left. +Chip_50 | A green poker chip worth $50 | Faces visually to the left. +Chip_100 | A red poker chip worth $100 | Faces visually to the left. +Chip_500 | A silver poker chip worth $500 | Faces visually to the left. +Chip_1000 | A gold poker chip worth $1000 | Faces visually to the left. +Deck | A deck of the 52 standard playing cards. | Spawns face-up. Shuffles immediately when spawned. +Die_4 | A 4-sided die. | Spawns with 2 facing toward positive Z. +Die_6 | A 6-sided die with dots. | Spawns with 2 facing upwards. +Die_6_Rounded | A 6-sided die with dots and rounded corners. | Spawns with 1 facing upwards. +Die_8 | An 8-sided die. | Spawns with the edge between 6 and 7 facing upwards. +Die_10 | A 10-sided die. | Spawns with the edge between 3 and 4 facing upwards. +Die_12 | A 12-sided die. | Spawns with the corner between 7, 9 and 11 facing upwards. +Die_20 | A 20-sided die. | Spawns with the edge between 1 and 17 facing upwards. +Die_Piecepack | A wooden 6-sided die. | Spawns with 2 facing upwards. +Domino | A blank domino. | +Go_Game_Piece_Black | A black Go stone. | Spawned from a [black Go bowl](#Go_Game_Bowl_Black). +Go_Game_Piece_White | A white Go stone. | Spawned from a [white Go bowl](#Go_Game_Bowl_White). +Mahjong_Coin | A coin used in Mahjong. | +Mahjong_Stick | A stick used in Mahjong. | +Mahjong_Tile | A tile used in Mahjong. | +Metal Ball | A marble. | This type includes a space character and not an underline. +PiecePack_Arms | A wooden coin with a blue fleur-de-lis on the underside. | +PiecePack_Crowns | A wooden coin with a green crown on the underside. | +PiecePack_Moons | A wooden coin with a black moon on the underside. | +PiecePack_Suns | A wooden coin with a red sun on the underside. | +PlayerPawn | A small game piece representing a player. | +Quarter | An american quarter minted in 1942. | Spawns tails-up, facing to the right. +Reversi_Chip | A dual-colored Reversi chip. | Spawns white-side up. + +## RPG Figurines + +Type | Description | Notes +-- | -- | -- +rpg_BARGHEST | An animated figurine of a mythical barghest. | +rpg_BASILISK | An animated figurine of a mythical basilisk (a.k.a. cockatrice). | +rpg_BEAR | An animated figurine of a bear. | +rpg_BLACK_DRAGON | An animated figurine of an eastern dragon. | +rpg_CENTAUR | An animated figurine of an armoured centaur. | +rpg_CERBERUS | An animated figurine of an infernal 3-headed dog. | +rpg_CHIMERA | An animated figurine of a mythical chimera. | +rpg_CRASC | An animated figurine of a one-eyed manta-like creature. | +rpg_CYCLOP | An animated figurine of a club-wielding cyclops. | +rpg_DARKNESS_WARLORD | An animated figurine of an armoured, morningstar-wielding orc. | +rpg_DRAGONIDE | An animated figurine of an armored humanoid lizard. | +rpg_EVIL_WATCHER | An animated figurine of a cycloptic scaled head with eye-stalks and bat-wings. | +rpg_GHOUL | An animated figurine of an undead humanoid | +rpg_GIANT_VIPER | An animated figurine of a large snake. | +rpg_GOBLIN | An animated figurine of a lightly-armored goblin with two knives. | +rpg_GOLEM | An animated figurine of a large earthen golem. | +rpg_GRIFFON | An animated figurine of a mythical griffon. | +rpg_HYDRA | An animated figurine of a large 3-headed lizard. | +rpg_KNIGHT | An animated figurine of a knight in full-plate armor wielding a sword and shield. | +rpg_KOBOLD | An animated figurine of a small helmeted humanoid. | +rpg_LIZARD_WARRIOR | An animated figurine of a sword-wielding lizard-like humanoid | +rpg_MAGE | An animated figurine of a staff-wielding mage. | +rpg_MANTICORA | An animated figurine of a mythical manticore. | This type is spelled with an A. +rpg_MUMMY | An animated figurine of a living mummy. | +rpg_OGRE | An animated figurine of a large boily humanoid. | +rpg_ORC | An animated figurine of an axe-wielding orc. | +rpg_RANGER | An animated figurine of a bow-wielding ranger. | +rpg_RAT | An animated figurine of a giant rat. | +rpg_SKELETON_KNIGHT | An animated figurine of an armored living skeleton. | +rpg_TEMPLATE | The base of an RPG figurine. | It has the same animatable triggers as any other RPG Figurine, but no associated animations. +rpg_THIEF | An animated figurine of a cowled knife-wielding thief. | +rpg_TREE_ENT | An animated figurine of a large tree creature. | +rpg_TROLL | An animated figurine of a large green humanoid. | +rpg_VAMPIRE | An animated figurine of a large wingless bat. | +rpg_WARRIOR | An animated figurine of a stout beared axe-wielding warrior in scale mail. | +rpg_WEREWOLF | An animated figurine of a mythical werewolf. | +rpg_WYVERN | An animated figurine of a mythical wyvern. | + +## Tilesets + +Type | Description | Notes +-- | -- | -- +Tileset_Barrel | A small barrel for use in RPG Tilesets. | +Tileset_Chair | A small chair for use in RPG Tilesets. | +Tileset_Chest | A small chest for use in RPG Tilesets. | +Tileset_Corner | A floor tile with two walls for use in RPG Tilesets. | +Tileset_Floor | A floor tile for use in RPG Tilesets. | +Tileset_Rock | A small rock for use in RPG Tilesets. | +Tileset_Table | A small table for use in RPG Tilesets. | +Tileset_Tree | A small tree for use in RPG Tilesets. | +Tileset_Wall | A floor tile with a wall for use in RPG Tilesets. | + +## Tools + +Type | Description | Notes +-- | -- | -- +Calculator | A useable calulator. | Faces visually backwards. +Counter | A useable digital counter. | +Digital_Clock | A useable digital clock. | +Notecard | An editable notecard. | +Tablet | A tablet that displays a webpage. | + +## Triggers + +Type | Description | Notes +-- | -- | -- +ScriptingTrigger | A Scripting Zone, a zone used for scripting. | +FogOfWarTrigger | A [Hidden Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#hidden-zone) | +FogOfWar | A [Fog of War Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone) | + +## Other + +Type | Description | Notes +-- | -- | -- +3DText | The text that the [Text Tool](https://kb.tabletopsimulator.com/game-tools/text-tool/) spawns. | From af45a2d64e97da0d55c05af1a3d7594e72b13c8c Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Mon, 4 May 2020 18:21:28 -0400 Subject: [PATCH 18/48] added site_url to fix broken 404 --- mkdocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/mkdocs.yml b/mkdocs.yml index 55558d54..f7f9d404 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,5 @@ site_name: Tabletop Simulator API +site_url: https://nabbydude.github.io/Tabletop-Simulator-API theme: name: 'material' palette: From 1d5a6c9067e0b597381f2aa57313acfe1d542afe Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Wed, 22 Apr 2020 03:54:40 +1000 Subject: [PATCH 19/48] Github Action to deploy to Github Pages --- .github/workflows/mkdocs.yml | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/mkdocs.yml diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml new file mode 100644 index 00000000..4d1cfef2 --- /dev/null +++ b/.github/workflows/mkdocs.yml @@ -0,0 +1,41 @@ +name: Github Pages + +on: + push: + branches: + - master + +jobs: + deploy: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v1 + with: + python-version: '3.6' + architecture: 'x64' + + - name: Install pipenv + run: | + pip install pipenv + + - name: Cache dependencies + id: cache-dependencies + uses: actions/cache@v1 + with: + path: ~/.local/share/virtualenvs + key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} + + - name: Install dependencies + if: steps.cache-dependencies.outputs.cache-hit != 'true' + run: pipenv install + + - run: pipenv run mkdocs build + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./site From e8eaf2f3cefbc29b8d32bc14953297e805f4cfe6 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Wed, 22 Apr 2020 04:01:34 +1000 Subject: [PATCH 20/48] Bumped dependencies in particular markupsafe --- Pipfile.lock | 118 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 78 insertions(+), 40 deletions(-) diff --git a/Pipfile.lock b/Pipfile.lock index fd822d6e..1b75a671 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -18,57 +18,92 @@ "default": { "click": { "hashes": [ - "sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d", - "sha256:f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b" + "sha256:8a18b4ea89d8820c5d0c7da8a64b2c324b4dabb695804dbfea19b9be9d88c0cc", + "sha256:e345d143d80bf5ee7534056164e5e112ea5e22716bbb1ce727941f4c8b471b9a" ], - "version": "==6.7" + "version": "==7.1.1" }, "jinja2": { "hashes": [ - "sha256:74c935a1b8bb9a3947c50a54766a969d4846290e1e788ea44c1392163723c3bd", - "sha256:f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4" + "sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0", + "sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035" ], - "version": "==2.10" + "version": "==2.11.2" }, "livereload": { "hashes": [ - "sha256:583179dc8d49b040a9da79bd33de59e160d2a8802b939e304eb359a4419f6498", - "sha256:dd4469a8f5a6833576e9f5433f1439c306de15dbbfeceabd32479b1123380fa5" + "sha256:78d55f2c268a8823ba499305dcac64e28ddeb9a92571e12d543cd304faf5817b", + "sha256:89254f78d7529d7ea0a3417d224c34287ebfe266b05e67e51facaf82c27f0f66" ], - "version": "==2.5.2" + "version": "==2.6.1" }, "markdown": { "hashes": [ - "sha256:9ba587db9daee7ec761cfc656272be6aabe2ed300fece21208e4aab2e457bc8f", - "sha256:a856869c7ff079ad84a3e19cd87a64998350c2b94e9e08e44270faef33400f81" + "sha256:90fee683eeabe1a92e149f7ba74e5ccdc81cd397bd6c516d93a8da0ef90b6902", + "sha256:e4795399163109457d4c5af2183fbe6b60326c17cfdf25ce6e7474c6624f725d" ], - "version": "==2.6.11" + "version": "==3.2.1" }, "markupsafe": { "hashes": [ - "sha256:a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665" + "sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", + "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", + "sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", + "sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", + "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42", + "sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff", + "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", + "sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", + "sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", + "sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", + "sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66", + "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b", + "sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", + "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15", + "sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", + "sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", + "sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", + "sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905", + "sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", + "sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d", + "sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e", + "sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", + "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c", + "sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21", + "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2", + "sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", + "sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", + "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6", + "sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", + "sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", + "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2", + "sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7", + "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be" ], - "version": "==1.0" + "version": "==1.1.1" }, "mkdocs": { "hashes": [ "sha256:17d34329aad75d5de604b9ed4e31df3a4d235afefdc46ce7b1964fddb2e1e939", "sha256:8cc8b38325456b9e942c981a209eaeb1e9f3f77b493ad755bfef889b9c8d356a" ], + "index": "Tabletop Simulator API", "version": "==1.0.4" }, "mkdocs-material": { "hashes": [ - "sha256:2f6987ee2c70f9da0870079a4626f2d309f8528806f08e1a7da842b6c58e7c5c", - "sha256:3905942fc8e659bd690420f5fd56bc1f31505067b574377aa8508011389696f0" + "sha256:47f3931462afa0378bc5704996f702fdef16d44ae8b698249497cf19c2b7f087", + "sha256:ca5ee59e2745ae566f0475e2c596b437d2a9ad6fdac46808bc7c808808b25b74" ], - "version": "==3.0.4" + "index": "Tabletop Simulator API", + "version": "==3.0.6" }, "pygments": { "hashes": [ "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d", "sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc" ], + "index": "Tabletop Simulator API", "version": "==2.2.0" }, "pymdown-extensions": { @@ -76,42 +111,45 @@ "sha256:2e1d8f4a4c351cfa6c5ad88a0f2f4a3a30af481a942fdf8f9db0936e12ff37c2", "sha256:54675680f6ad3ee8242fcb8926703b30ea3dcbeb9e21b7f7f19077f0ec982a82" ], + "index": "Tabletop Simulator API", "version": "==5.0" }, "pyyaml": { "hashes": [ - "sha256:3d7da3009c0f3e783b2c873687652d83b1bbfd5c88e9813fb7e5b03c0dd3108b", - "sha256:3ef3092145e9b70e3ddd2c7ad59bdd0252a94dfe3949721633e41344de00a6bf", - "sha256:40c71b8e076d0550b2e6380bada1f1cd1017b882f7e16f09a65be98e017f211a", - "sha256:558dd60b890ba8fd982e05941927a3911dc409a63dcb8b634feaa0cda69330d3", - "sha256:a7c28b45d9f99102fa092bb213aa12e0aaf9a6a1f5e395d36166639c1f96c3a1", - "sha256:aa7dd4a6a427aed7df6fb7f08a580d68d9b118d90310374716ae90b710280af1", - "sha256:bc558586e6045763782014934bfaf39d48b8ae85a2713117d16c39864085c613", - "sha256:d46d7982b62e0729ad0175a9bc7e10a566fc07b224d2c79fafb5e032727eaa04", - "sha256:d5eef459e30b09f5a098b9cea68bebfeb268697f78d647bd255a085371ac7f3f", - "sha256:e01d3203230e1786cd91ccfdc8f8454c8069c91bee3962ad93b87a4b2860f537", - "sha256:e170a9e6fcfd19021dd29845af83bb79236068bf5fd4df3327c1be18182b2531" + "sha256:06a0d7ba600ce0b2d2fe2e78453a470b5a6e000a985dd4a4e54e436cc36b0e97", + "sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76", + "sha256:4f4b913ca1a7319b33cfb1369e91e50354d6f07a135f3b901aca02aa95940bd2", + "sha256:69f00dca373f240f842b2931fb2c7e14ddbacd1397d57157a9b005a6a9942648", + "sha256:73f099454b799e05e5ab51423c7bcf361c58d3206fa7b0d555426b1f4d9a3eaf", + "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f", + "sha256:7739fc0fa8205b3ee8808aea45e968bc90082c10aef6ea95e855e10abf4a37b2", + "sha256:95f71d2af0ff4227885f7a6605c37fd53d3a106fcab511b8860ecca9fcf400ee", + "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d", + "sha256:cc8955cfbfc7a115fa81d85284ee61147059a753344bc51098f3ccd69b0d7e0c", + "sha256:d13155f591e6fcc1ec3b30685d50bf0711574e2c0dfffd7644babf8b5102ca1a" ], - "version": "==3.13" + "version": "==5.3.1" }, "six": { "hashes": [ - "sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", - "sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" + "sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a", + "sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c" ], - "version": "==1.11.0" + "version": "==1.14.0" }, "tornado": { "hashes": [ - "sha256:1c0816fc32b7d31b98781bd8ebc7a9726d7dce67407dc353a2e66e697e138448", - "sha256:4f66a2172cb947387193ca4c2c3e19131f1c70fa8be470ddbbd9317fd0801582", - "sha256:5327ba1a6c694e0149e7d9126426b3704b1d9d520852a3e4aa9fc8fe989e4046", - "sha256:6a7e8657618268bb007646b9eae7661d0b57f13efc94faa33cd2588eae5912c9", - "sha256:a9b14804783a1d77c0bd6c66f7a9b1196cbddfbdf8bceb64683c5ae60bd1ec6f", - "sha256:c58757e37c4a3172949c99099d4d5106e4d7b63aa0617f9bb24bfbff712c7866", - "sha256:d8984742ce86c0855cccecd5c6f54a9f7532c983947cff06f3a0e2115b47f85c" + "sha256:0fe2d45ba43b00a41cd73f8be321a44936dc1aba233dee979f17a042b83eb6dc", + "sha256:22aed82c2ea340c3771e3babc5ef220272f6fd06b5108a53b4976d0d722bcd52", + "sha256:2c027eb2a393d964b22b5c154d1a23a5f8727db6fda837118a776b29e2b8ebc6", + "sha256:5217e601700f24e966ddab689f90b7ea4bd91ff3357c3600fa1045e26d68e55d", + "sha256:5618f72e947533832cbc3dec54e1dffc1747a5cb17d1fd91577ed14fa0dc081b", + "sha256:5f6a07e62e799be5d2330e68d808c8ac41d4a259b9cea61da4101b83cb5dc673", + "sha256:c58d56003daf1b616336781b26d184023ea4af13ae143d9dda65e31e534940b9", + "sha256:c952975c8ba74f546ae6de2e226ab3cc3cc11ae47baf607459a6728585bb542a", + "sha256:c98232a3ac391f5faea6821b53db8db461157baa788f5d6222a193e9456e1740" ], - "version": "==5.1" + "version": "==6.0.4" } }, "develop": {} From 44fb8e6eb839699167d783329b211c59f79890f3 Mon Sep 17 00:00:00 2001 From: Zehir Date: Wed, 22 Apr 2020 01:30:59 +0200 Subject: [PATCH 21/48] Adding Vector documentation --- docs/vector.md | 707 +++++++++++++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 708 insertions(+) create mode 100644 docs/vector.md diff --git a/docs/vector.md b/docs/vector.md new file mode 100644 index 00000000..fc8c1fd1 --- /dev/null +++ b/docs/vector.md @@ -0,0 +1,707 @@ +Representation of 3D vectors and points. + +This structure is used to pass 3D positions and directions around. It also contains functions for doing common vector operations. + +Besides the functions listed below, other classes can be used to manipulate vectors and points as well. + +Example Usage: `target = Vector(1, 0, 0) + Vector(0, 1, 0)` + +Check [Manipulation examples](#manipulation-examples) for more detailed usage. + +!!!tip + Vector and Color are the first classes to be defined in pure Lua. This means you **have** to use colon operator (e.g. `pos:angle()`) to call member functions, not the dot operator. Failing to do so will fail with cryptic error messages displayed. + +##Constructors summary + +!!!tip + Every place that returns a coordinate table, like `obj.getPosition()`, serves a Vector class instance already - you do not have to explicitly construct it. + When constructing Vector instances, the `.new` part can be omitted, making e.g. `Vector(1, 2, 3)` equivalent to `Vector.new(1, 2, 3)`. + +Function Name | Description | Return |   +-- | -- | -- | --: +Vector([](/types) x, [](/types) y, [](/types) z) | Return a vector with specified (x, y, z) components. | [](/types) +Vector([](/types) v) | Return a vector with x/y/z or 1/2/3 components from source table (x/y/z first). | [](/types) +Vector.new(...) | Same as Vector(...). | [](/types) + +###Constructors examples + +```lua +function onLoad() + local vec1 = Vector.new(0.5, 1, 1.5) + local vec2 = Vector(1, -1, 0) -- same as Vector.new(1, -1, 0) + + print(Vector.between(vec1, vec2)) --> Vector: {0.5, -2. -1.5} + print(Vector.max(vec1, vec2)) --> Vector: {1, 1. 1.5} + print(Vector.min(vec1, vec2)) --> Vector: {0.5, -1. -0} +end +``` + +--- + +##Element access summary + +Apart from being able to access elements using x, y, z and 1, 2, 3 keys directly, following methods directly modify vector components. + +Function Name | Description | Return |   +-- | -- | -- | -- +[setAt](#setat)([](/types) k, [](/types) value) | Sets a component to value and returns self. | [](/types#vector) +[set](#set)([](/types) x, [](/types) y, [](/types) z) | Sets `x`, `y`, `z` components to given values and returns self. Providing a nil value makes it ignore that argument. | [](/types#vector) +[get](#get)() | Returns `x`, `y`, `z` components as three separate values. | [](/types), [](/types), [](/types) +[copy](#copy)() | Returns a separate Vector with identical component values. | [](/types#vector) + +!!!tip + Before `Vector` was introduced, coordinate tables contained separate values under 1, 2, 3 and x, y, z keys, with letter keys taking precedence when they were different. This is no longer the case, and using letter and numerical keys is equivalent. However, when iterating over Vector components you have to use `pairs` and only letter keys will be read there. + +###Element access examples + +```lua +function onLoad() + local vec = Vector(1, 2, 3) + vec.x = 2 -- set the first component + vec[2] = 4 -- set the second component + vec:setAt('z', 6) -- set the third component + + print(vec:get()) --> same as print(vec.x, vec.y, vec.z) + + for axis, value in pairs(vec) do + print(axis .. "="..value) --> x=2 then y=4 and finally z=6 + end + + vec:copy():setAt('x', - 11) + print(vec.x) --> 2, because we only changed 'x' on a copy +end +``` + +--- + +##Methods summary + + +###Static methods summary + +Method Name | Description | Return |   +-- | -- | -- | --: +[Vector.equals](#vectorequals)([](/types) vec1, [](/types) vec2, [](/types) margin) | Returns true if two vectors are approximately equal. The `margin` argument is optional and defaults to tolerating a difference of ~0.03 in both vector magnitude. | [](/types) +[Vector.min](#vectormin)([](/types) vec1, [](/types) vec2) | Returns a vector that is made from the smallest components of two vectors. | [](/types) +[Vector.max](#vectormax)([](/types) vec1, [](/types) vec2) | Returns a vector that is made from the largest components of two vectors. | [](/types) +[Vector.between](#vectorbetween)([](/types) vec1, [](/types) vec2) | Return a vector pointing from vec1 to vec2. | [](/types) +[Vector.lerp](#vectorlerp)([](/types) p1, [](/types) p2, [](/types) t) | Linearly interpolates between two points. Numeric arg [0, 1] is the fraction. | [](/types) +[Vector.cross](#vectorcross)([](/types) vec1, [](/types) vec2) | Return a cross-product vector of two vectors. | [](/types) +[Vector.dot](#vectordot)([](/types) vec1, [](/types) vec2) | Return a dot product of two vectors. | [](/types) +[Vector.angle](#vectorangle)([](/types) vec1, [](/types) vec2) | Return an angle between two vectors, in degrees [0, 180]. | [](/types) +[Vector.distance](#vectordistance)([](/types) p1, [](/types) p2) | Returns distance between two points. | [](/types) +[Vector.sqrDistance](#vectorsqrdistance)([](/types) p1, [](/types) p2) | Returns squared distance between two points. | [](/types) + + +!!!tip + All static methods can be call like other method with this format: + + ``` Lua + vec1:method(vec2, args) + ``` + +###Arithmetics methods summary +Method Name | Description | Return |   +-- | -- | -- | --: +vec:[add](#add)([](/types) otherVec) | Adds components of otherVec to self. | [](/types) +vec:[sub](#sub)([](/types) otherVec) | Subtracts components of otherVec from self. | [](/types) +vec:[inverse](#inverse)() | Multiply self-components by -1. | [](/types) +vec:[scale](#scale)([](/types) otherVec) | Multiplies self-components by corresponding components from otherVec. | [](/types) +vec:[scale](#scale)([](/types) num) | Multiplies self-components by a numeric factor. | [](/types) +vec:[clamp](#clamp)([](/types) num) | If self-magnitude is higher than provided limit, scale self-down to match it. | [](/types) +vec:[normalize](#normalize)() | Makes this vector have a magnitude of 1. | [](/types) +vec:[project](#project)([](/types) otherVec) | Make self into projection on another vector. | [](/types) +vec:[projectOnPlane](#projectonplane)([](/types) otherVec) | Project self on a plane defined through a normal vector arg. | [](/types) +vec:[reflect](#reflect)([](/types) otherVec) | Reflect self over a plane defined through a normal vector arg. | [](/types) +vec:[moveTowards](#movetowards)([](/types) otherVec, [](/types) num) | Move self towards another vector, but only up to a provided distance limit. | [](/types) +vec:[rotateTowards](#rotatetowards)([](/types) target, [](/types) maxAngle) | Rotate self towards another vector, but only up to a provided angle limit. | [](/types) +vec:[rotateTowardsUnit](#rotatetowardsunit)([](/types) target, [](/types) maxAngle) | Same as rotateTowards, but only works correctly if `target` Vector is normalized. Less expensive than `rotateTowards`. | [](/types) +vec:[rotateOver](#rotateover)([](/types) axis, [](/types) angle) | Rotate a Vector `angle` degres over given `axis` (can be `'x'`, `'y'`, `'z'`) and return self. | [](/types) + +!!!tip + Numerous methods of Vector will return the same vector instance to allow easy "chaining". That way you can do more complex processing without saving an intermediate result in a variable, like e.g. `vec:setAt('y', 0):scale(0.5):rotateOver('y', 90)`. + + All arithmetic methods can be used as static: + + ``` Lua + target = Vector(1, 2, 3) + vec = Vector.rotateTowards(vec, target, 6) + ``` + +Vector also allows you to use arithmetic operators to performs basic operations: + +Operator | Description | Return |   +-- | -- | -- | -- +[](/types) one + [](/types) two | Returns a new Vector that is a sum of `one` and `two` | [](/types#vector) +[](/types) one - [](/types) two | Returns a new Vector that is a difference of `one` and `two` | [](/types#vector) +[](/types) one * [](/types) factor | Returns a new Vector that is `one` with each component multiplied by the factor. | [](/types#vector) +[](/types) one == [](/types) two | Returns a boolean whether `one` and `two` are very similar to each other (less than ~0.03 difference in magnitude) | [](/types) + +####Arithmetics and operators examples + +```lua +function onLoad() + local vec = Vector(1, 2, 3) + vec:add(Vector(3, 2, 1)) --> vec is now {4, 4, 4} + vec:sub(Vector(1, 0, 1)) --> vec is now {3, 4, 3} + + local another = vec + Vector(-1, -2, -1) --> another is {2, 2, 2}, vec remains unchanged + + print(another:equals(Vector(1, 2, 3))) --> false + print(another == Vector(2, 2, 2)) --> true + print(another == Vector(1.99, 2.01, 2)) --> true, small differences are tolerated +end +``` + +###Property methods summary +Method Name | Description | Return |   +-- | -- | -- | --: +vec:[magnitude](#magnitude)() | Returns the length of this vector. | [](/types) +vec:[sqrMagnitude](#sqrmagnitude)() | Returns the squared length of this vector. | [](/types) +vec:[string](#string)([](/types) prefix) | Return string describing self, optional string prefix. | [](/types) +vec:[normalized](#normalized)() | Return a new vector that is normalized (length 1) version of self. | [](/types) +vec:[orthoNormalize](#orthonormalize)() | Return three normalized vectors perpendicular to each other, first one being in the same dir as self. | [](/types) base, [](/types) normal, [](/types) binormal +vec:[orthoNormalize](#orthonormalize)([](/types) binormalPlanar) | Same as vec:orthoNormalize(), but second vector is guranteed to be on a self-binormalPlanar plane. | [](/types) base, [](/types) normal, [](/types) binormal +vec:[heading](#heading)([](/types) axis) | Returns an angle (In degrees) of rotation of Vector over a given `axis` (can be `'x'`, `'y'`, `'z'`). | [](/types) + +--- + +##Methods details + +###Static methods details + +####Vector.equals(...) + +[](/types) Returns true if two vectors are approximately equal. +The `margin` argument is optional and defaults to tolerating a difference of `~0.03` in both vector magnitude. + +!!!info "Vector.equals(vec1, vec2, margin)" + * [](/types) **vec1**: First vector. + * [](/types) **vec2**: Second vector. + * [](/types) **margin**: (Optional) Numeric tolerance. + +``` Lua +vec1 = Vector(1, 2, 3.10) +vec2 = Vector(1, 2, 3.15) +print(Vector.equals(vec1, vec2)) --> false +print(Vector.equals(vec1, vec2, 0.01)) --> true +``` + +####Vector.min(...) + +[](/types) Returns a vector that is made from the smallest components of two vectors. + +!!!info "Vector.min(vec1, vec2)" + * [](/types) **vec1**: First vector. + * [](/types) **vec2**: Second vector. + +``` Lua +vec1 = Vector(1, 2, 3) +vec2 = Vector(4, 3, 2) +print(Vector.min(vec1, vec2)) --> Vector: { 1, 2, 2 } +``` + +####Vector.max(...) + +[](/types) Returns a vector that is made from the largest components of two vectors. + +!!!info "Vector.max(vec1, vec2)" + * [](/types) **vec1**: First vector. + * [](/types) **vec2**: Second vector. + +``` Lua +vec1 = Vector(1, 2, 3) +vec2 = Vector(4, 3, 2) +print(Vector.max(vec1, vec2)) --> Vector: { 4, 3, 3 } +``` + +####Vector.between(...) + +[](/types) Return a vector pointing from vec1 to vec2. + +!!!info "Vector.between(vec1, vec2)" + * [](/types) **vec1**: First vector. + * [](/types) **vec2**: Second vector. + +``` Lua +vec1 = Vector(1, 2, 3) +vec2 = Vector(4, 3, 2) +print(Vector.between(vec1, vec2)) --> Vector: { 3, 1, -1 } +``` + +####Vector.lerp(...) + +[](/types) Linearly interpolates between two points. + +Interpolates between the points a and b by the interpolant t. The parameter t is clamped to the range [0, 1]. This is most commonly used to find a point some fraction of the way along a line between two endpoints (e.g. to move an object gradually between those points). + +The value returned equals (b - a) * t. When t = 0 returns a. When t = 1 returns b. When t = 0.5 returns the point midway between a and b. + +!!!info "Vector.lerp(p1, p2)" + * [](/types) **p1**: First point. + * [](/types) **p2**: Second point. + * [](/types) **t**: Fraction. + +``` Lua +p1 = Vector(1, 2, - 4) +p2 = Vector(1, 2, 4) +print(Vector.lerp(p1, p2, 0.25)) --> Vector: { 1, 2, -2 } +``` + +####Vector.cross(...) + +[](/types) Return a cross-product vector of two vectors. + +The cross product of two vectors results in a third vector which is perpendicular to the two input vectors. The result's magnitude is equal to the magnitudes of the two inputs multiplied together and then multiplied by the sine of the angle between the inputs. You can determine the direction of the result vector using the "left hand rule". + +!!!info "Vector.cross(vec1, vec2)" + * [](/types) **vec1**: First vector. + * [](/types) **vec2**: Second vector. + +``` Lua +vec1 = Vector(1, 2, 3) +vec2 = Vector(4, 3, 2) +print(Vector.cross(vec1, vec2)) --> Vector: { -5, 10, -5 } +print(Vector.cross(vec2, vec1)) --> Vector: {-5, -10, 5 } +``` + +####Vector.dot(...) + +[](/types) Return the dot product of two vectors. + +The dot product is a float value equal to the magnitudes of the two vectors multiplied together and then multiplied by the cosine of the angle between them. + +For normalized vectors Dot returns 1 if they point in exactly the same direction, -1 if they point in completely opposite directions and zero if the vectors are perpendicular. + +!!!info "Vector.dot(vec1, vec2)" + * [](/types) **vec1**: First vector. + * [](/types) **vec2**: Second vector. + +``` Lua +vec1 = Vector(0, 1, 2) +vec2 = Vector(0, 2, 4) +print(Vector.dot(vec1, vec2)) --> 10 +print(Vector.dot(vec1:normalized(), vec2:normalized())) --> 1 +``` + +####Vector.angle(...) + +[](/types) Returns the angle in degrees between two vectors. + +The angle returned is the unsigned angle between the two vectors. This means the smaller of the two possible angles between the two vectors is used. The result is never greater than 180 degrees. + +!!!info "Vector.angle(vec1, vec2)" + * [](/types) **vec1**: First vector. + * [](/types) **vec2**: Second vector. + +``` Lua +vec1 = Vector(1, 2, 3) +vec2 = Vector(4, 3, 2) +print(Vector.angle(vec1, vec2)) --> 37.43 +``` + +####Vector.distance(...) + +[](/types) Returns distance between two points. + +!!!info "Vector.distance(p1, p2)" + * [](/types) **p1**: First point. + * [](/types) **p2**: Second point. + +``` Lua +p1 = Vector(1, 2, 3) +p2 = Vector(4, 3, 2) +print(Vector.distance(p1, p2)) --> 3.32 +print((p1 - p2):magnitude()) --> 3.32 +``` + +####Vector.sqrDistance(...) + +[](/types) Returns squared distance between two points. + +!!!info "Vector.sqrDistance(p1, p2)" + * [](/types) **p1**: First point. + * [](/types) **p2**: Second point. + +``` Lua +p1 = Vector(1, 2, 3) +p2 = Vector(4, 3, 2) +print(Vector.sqrDistance(p1, p2)) --> 11 +``` + +###Arithmetics methods details + +####setAt(...) + +[](/types) Update one component of the vector and returning self. + +!!!info "setAt(key, num)" + * [](/types) **key**: Index of component (1, 2 or 3 for x, y or z). + * [](/types) **num**: New value. + +``` Lua +vec = Vector(1, 2, 3) +vec:setAt(1, 4):setAt('y', 3) +print(vec) --> Vector: { 4, 3, 3 } +``` + +####set(...) + +[](/types) Update all components of the vector and returning self. + +!!!info "set(x, y, z)" + * [](/types) **x**: New value of X component. + * [](/types) **y**: New value of Y component. + * [](/types) **z**: New value of Z component. + +``` Lua +vec = Vector(1, 2, 3) +vec:set(4, 3, 2) +print(vec) --> Vector: { 4, 3, 2 } +``` + +####add(...) + +[](/types) Adds components of otherVec to self and returning self. + +!!!info "add(otherVec)" + * [](/types) **otherVec**: The vector to add. + +``` Lua +vec = Vector(1, 2, 3) +otherVec = Vector(4, 5, 6) +vec:add(otherVec) +print(vec) --> Vector: { 5, 7, 9 } + +-- Same as +vec = Vector(1, 2, 3) +otherVec = Vector(4, 5, 6) +vec = vec + otherVec +print(vec) --> Vector: { 5, 7, 9 } +``` + +####sub(...) + +[](/types) Subtracts components of otherVec from self and returning self. + +!!!info "sub(otherVec)" + * [](/types) **otherVec**: The vector to subtracts. + +``` Lua +vec = Vector(1, 2, 3) +otherVec = Vector(6, 5, 4) +vec:sub(otherVec) +print(vec) --> Vector: { -5, -3, -1 } + +-- Same as +vec = Vector(1, 2, 3) +otherVec = Vector(6, 5, 4) +vec = vec - otherVec +print(vec) --> Vector: { -5, -3, -1 } +``` +####inverse() + +[](/types) Multiply self-components by -1. + +``` Lua +vec = Vector(1, 2, 3) +vec:inverse() +print(vec) --> Vector: { -1, -2, -3 } +``` + +####scale(...) + +[](/types) Multiplies self-components by corresponding components from otherVec. + +Every component in the result is a component of vec multiplied by the same component of otherVec or by a number factor. + +!!!info "scale(otherVec)" + * [](/types) **otherVec**: The vector to scale. + +!!!info "scale(num)" + * [](/types) **num**: The numeric factor. + +``` Lua +vec = Vector(1, 2, 3) +otherVec = Vector(2, 3, 4) +vec:scale(otherVec) +print(vec) --> Vector: { 2, 6, 12 } +vec:scale(2) +print(vec) --> Vector: { 4, 12, 24 } +``` + +####clamp(...) + +[](/types) If self-magnitude is higher than provided limit, scale self-down to match it. + +!!!info "clamp(num)" + * [](/types) **num**: The numeric max magnitude. + +``` Lua +vec = Vector(1, 2, 3) +vec:clamp(2) +print(vec) --> Vector: { 0.53, 1.07, 1.60 } +``` + +####normalize() + +[](/types) Makes this vector have a magnitude of 1. + +When normalized, a vector keeps the same direction but its length is 1.0. + +Note that this function will change the current vector. If you want to keep the current vector unchanged, use [normalized()](#normalized) method. + +``` Lua +vec = Vector(1, 2, 3) +vec:normalize() +print(vec) --> Vector: { 0.27, 0.53, 0.80 } +``` + +####project(...) + +[](/types) Make self into projection on another vector. + +To understand vector projection, imagine that `otherVec` is resting on a line pointing in its direction. Somewhere along that line will be the nearest point to the tip of vector. The projection is just `otherVec` rescaled so that it reaches that point on the line. + +!!!info "project(otherVec)" + * [](/types) **otherVec**: The normal vector. + +``` Lua +vec = Vector(2, 1, 4) +vec:project(Vector(1, - 2, 1)) +print(vec) --> Vector: { 0.67, -1.3, 0.67 } +``` + +####projectOnPlane(...) + +[](/types) Projects a vector onto a plane defined by a normal orthogonal to the plane. + +A Vector stores the position of the given `vec` in 3d space. A second Vector is given by `otherVec` and defines a direction from a plane towards vector that passes through the origin. Vector.projectOnPlane uses the two Vector values to generate the position of vector in the `otherVec` direction, and return the location of the Vector on the plane. + +!!!info "projectOnPlane(otherVec)" + * [](/types) **otherVec**: The plane normal vector. + +``` Lua +vec = Vector(2, 1, 4) +vec:projectOnPlane(Vector(1, - 2, 1)) +print(vec) --> Vector: { 1.33, 2.33, 3.33 } +``` + +####reflect(...) + +[](/types) Make self into reflection on another vector. + +The `otherVec` vector defines a plane (a plane's normal is the vector that is perpendicular to its surface). The `vec` vector is treated as a directional arrow coming in to the plane. The returned value is a vector of equal magnitude to `vec` but with its direction reflected. + + +!!!info "reflect(otherVec)" + * [](/types) **otherVec**: The normal vector. + +``` Lua +vec = Vector(1, 2, 3) +vec:reflect(Vector(4, 3, 2)) +print(vec) --> Vector: { -3.41, -1.31, 0.79 } +``` + +####moveTowards(...) + +[](/types) Move self towards another vector, but only up to a provided distance limit. + +!!!info "moveTowards(otherVec, num)" + * [](/types) **target**: The position to move towards. + * [](/types) **num**: The distance limit. + +``` Lua +vec = Vector(1, 2, 3) +vec:moveTowards(Vector(4, 3, 2), 0.5) +print(vec) --> Vector: { 1.45, 2.15, 2.85 } +``` + +####rotateTowards(...) + +[](/types) Rotate self towards another vector, but only up to a provided angle limit. + +This function is similar to [moveTowards()](#movetowards) except that the vector is treated as a direction rather than a position. The current vector will be rotated round toward the target direction by an angle of `maxAngle`, although it will land exactly on the target rather than overshoot. If the magnitudes of current and target are different, then the magnitude of the result will be linearly interpolated during the rotation. If a negative value is used for `maxAngle`, the vector will rotate away from target until it is pointing in exactly the opposite direction, then stops. + +!!!info "rotateTowards(target, maxAngle)" + * [](/types) **target**: The position to rotate towards. + * [](/types) **maxAngle**: The maximum angle in **degree** allowed for this rotation. + +``` Lua +vec = Vector(1, 2, 3) +vec:rotateTowards(Vector(4, 3, 2), 45) +print(vec) --> Vector: { 2.78, 2.08, 1.39 } +``` + +####rotateTowardsUnit(...) + +[](/types) Same as [rotateTowards()](#rotatetowards), but only works correctly if `target` Vector is normalized. Less expensive than `rotateTowards()`. + +!!!info "rotateTowardsUnit(target, maxAngle)" + * [](/types) **target**: The position to rotate towards. + * [](/types) **maxAngle**: The maximum angle in **degree** allowed for this rotation. + +``` Lua +vec = Vector(1, 2, 3) +vec:rotateTowardsUnit(Vector(4, 3, 2):normalized(), 45) +print(vec) --> Vector: { 3.29, 0.87, -1.55 } +``` + +####rotateOver(...) + +[](/types) Rotate a Vector `angle` degrees over given `axis` (can be `'x'`, `'y'`, `'z'`) and return self. + +!!!info "rotateOver(axis, angle)" + * [](/types) **axis**: The axis to rotate around. + * [](/types) **angle**: The angle in **degree** for this rotation. + +``` Lua +vec = Vector(3, 2, 3) +vec:rotateOver('y', 45) +print(vec) --> Vector: { 4.24, 2, 0 } +``` + +###Property methods details + +####get() + +[](/types) +[](/types) +[](/types) Returns `x`, `y`, `z` components as three separate values. + +``` Lua +vec = Vector(1, 2, 3) +x, y, z = vec:get() +print(x + y + z) --> 6 +``` +####copy() + +[](/types) Copy self into a new vector and return it. + +``` Lua +vec1 = Vector(1, 2, 3) +vec2 = vec1:copy() +vec1:set(4, 3, 2) +print(vec1) --> Vector { 4, 3, 2 } +print(vec2) --> Vector { 1, 2, 3 } +``` + +####magnitude() + +[](/types) Returns the length of this vector. + +``` Lua +vec = Vector(1, 2, 3) +print(vec:magnitude()) --> 3.74 (sqrt of 14) +``` + +####sqrMagnitude() + +[](/types) Returns the squared length of this vector. + +``` Lua +vec = Vector(1, 2, 3) +print(vec:sqrMagnitude()) --> 14 +``` + +####string(...) + +[](/types) Return string describing self, optional string prefix. + +!!!info "string(prefix)" + * [](/types) **prefix**: The prefix of return string. + +``` Lua +vec = Vector(1, 2, 3) +str = vec:string('Prefix') +print(str) --> Prefix: { 1, 2, 3 } +print(vec:string('Prefix')) --> Prefix: { 1, 2, 3 }0 +``` + +!!!warning + This function returns one extra float that will be displayed in print function. + +####normalized() + +[](/types) Return a new vector that is normalized (length 1) version of self. + +``` Lua +vec = Vector(1, 2, 3) +print(vec:normalized()) --> Vector: { 0.27, 0.53, 0.80} +``` + +####orthoNormalize(...) + +[](/types) +[](/types) +[](/types) Return three normalized vectors perpendicular to each other, first one being in the same direction as self. If `binormalPlaner` is provided, the second vector is guaranteed to be on a self-binormalPlanar plane. + +!!!info "orthoNormalize(binormalPlanar)" + * [](/types) **binormalPlanar**: (optional) The vector for binormal planar. + + +``` Lua +vec = Vector(0, 0, 2) +base, normal, binormal = vec:orthoNormalize(Vector(0, 1, 0)) +print(base) --> Vector: { 0, 0, 1} +print(normal) --> Vector: { -1, 0, 0} +print(binormal) --> Vector: { 0, -1, 0} +``` + +####heading(...) + +[](/types) Returns an angle (In degrees) of rotation of Vector over a given `axis` (can be `'x'`, `'y'`, `'z'`). + +!!!info "heading(axis)" + * [](/types) **axis**: Can be `'x'`, `'y'`, `'z'`. + +``` Lua +vec = Vector(1, 2, 3) +angle = vec:heading('z') +print(angle) --> 26.57 +``` + +--- + +##Manipulation examples + +Moving an object towards a target position in small steps +```lua +function onLoad() + local obj = assert(getObjectFromGUID('555555'), 'Object not found!') + obj.lock() + + local current = Vector(10, 5, 0) -- obj starting position + local target = Vector(-10, 5, 0) -- obj destination + local movementType = 'linear' -- try with 'spherical' or 'asymptotic' to see how other methods work + + -- We want out movement stretched over time, a Wait will do it periodically + local waitID + waitID = Wait.time( + function() + -- move the current postion towards destination + + if movementType == 'linear' then + -- simple linear movement, 1 unit at a time + current:moveTowards(target, 1) + elseif movementType == 'spherical' then + -- rotate towards target, 10 degress at a time + current:rotateTowards(target, 5) + elseif movementType == 'asymptotic' then + -- move quarter of the way towards target (take note that lerp does not modify current directly) + current = current:lerp(target, 0.25) + end + + obj.setPositionSmooth(current, true, true) + + -- if we reached the destination, stop this timer + if current == target then + Wait.stop(waitID) + broadcastToAll('Finished!', {0, 1, 0}) + end + end, + 0.5, -- repeats every half second + -1 -- indefinitely, until stopped because we reached destination + ) +end +``` diff --git a/mkdocs.yml b/mkdocs.yml index 0258d4d0..3660e9b1 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -85,6 +85,7 @@ pages: - Time: time.md - Turns: turns.md - UI: ui.md + - Vector: vector.md - Wait: wait.md - Web Request: webrequest.md - UI API: From 27a64d01452899990e4727dfff33db3ea52a158b Mon Sep 17 00:00:00 2001 From: Zehir Date: Wed, 22 Apr 2020 16:27:58 +0200 Subject: [PATCH 22/48] Update Element access summary description Clarification of description. --- docs/vector.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/vector.md b/docs/vector.md index fc8c1fd1..2352486b 100644 --- a/docs/vector.md +++ b/docs/vector.md @@ -40,7 +40,7 @@ end ##Element access summary -Apart from being able to access elements using x, y, z and 1, 2, 3 keys directly, following methods directly modify vector components. +In addition to accessing vector components by their numeric indices (1, 2, 3) and textual identifiers (x, y, z), the following methods may also be utilized. Function Name | Description | Return |   -- | -- | -- | -- From c28351390f45de94612ab2256630dcefd0fb99d0 Mon Sep 17 00:00:00 2001 From: Zehir Date: Wed, 22 Apr 2020 23:32:33 +0200 Subject: [PATCH 23/48] Adding self type tag --- docs/css/type_icons.css | 9 +++++++++ docs/types.md | 1 + 2 files changed, 10 insertions(+) diff --git a/docs/css/type_icons.css b/docs/css/type_icons.css index db8feec9..b3c5b697 100644 --- a/docs/css/type_icons.css +++ b/docs/css/type_icons.css @@ -120,6 +120,15 @@ content: "object"; } +/*Self*/ +.sel { + color: #000000; + background-color: #fa983a; +} +.sel:after { + content: "self"; +} + /*Var*/ .var { color: #000000; diff --git a/docs/types.md b/docs/types.md index a9903aa7..e9cc30ff 100644 --- a/docs/types.md +++ b/docs/types.md @@ -11,6 +11,7 @@ Tag | Type | Description | Example [](/types) | string | A series of characters. | `#!lua "Hello."` [](/types) | table | A container with keys and values. | `#!lua {["key"]="value", true, 5}` [](/types) | object | An in-game physical Object. Sometimes Global. | `#!lua Global or self` +[](/types) | self | A reference to the current Lua Object. | `#!lua self` [](/types) | player | An in-game Player. | `#!lua Player["White"]` [](/types) | variable | A combination of other types. | From 55b590be8b3d7c98a3c613b2f681089ded2ad32a Mon Sep 17 00:00:00 2001 From: Zehir Date: Wed, 22 Apr 2020 23:37:37 +0200 Subject: [PATCH 24/48] Update Vector doc format Re-arrange --- docs/types.md | 25 +-- docs/vector.md | 478 +++++++++++++++++++++++++------------------------ 2 files changed, 252 insertions(+), 251 deletions(-) diff --git a/docs/types.md b/docs/types.md index e9cc30ff..048b2579 100644 --- a/docs/types.md +++ b/docs/types.md @@ -80,12 +80,15 @@ Example: `printToAll("Test", "Green")` --- +###Vector + Vector is a type of Object with x, y, and z coordinates that is used to define a position, rotation or direction. +You can use the [Vector](../vector) class to manipulate vectors. + +Example: `#!lua target = Vector(1, 0, 0) + Vector(0, 2, 0):normalized()` -###Vector - Vector is a type of Table that is used to define a position, rotation or direction. ####Keys -The Table will contain the keys `x`, `y`, `z` and/or `1`, `2`, `3`. The letter and numeric keys are duplicates of each other. +The Table will contain the keys `x`, `y`, `z` and/or `1`, `2`, `3`. The letter and numeric keys are equivalent. Letter Key | Number Key :--: | :--: @@ -93,28 +96,16 @@ The Table will contain the keys `x`, `y`, `z` and/or `1`, `2`, `3`. The letter a y | 2 z | 3 - -As an example, An Object at coordinate X=5, Y=2, Z=-1 would return this table: +As an example, An Object at coordinate X=5, Y=2, Z=-1 would return this [`Vector`](../vector): ``` Lua { x=5, y=2, z=-1, - 1=5, 2=2, 3=-1, } ``` ####Mixed Keys - -Only one type of key, number or letter, is required. If both a are present in a Table, the numeric key is ignored and only the **letter key** is used. - -``` Lua ---Valid Table for 1 to the right -{x=1, y=0, z=0} ---Valid Table for 1 unit forward -{0, 0, 1} ---This Table would be for 1 unit to the right. -{x=1, y=0, z=0, 0, 0, 1} -``` +Before [`Vector`](../vector) was introduced, coordinate tables contained separate values under 1, 2, 3 and x, y, z keys, with letter keys taking precedence when they were different. This is no longer the case, and using letter and numerical keys is equivalent. However, when iterating over Vector components you have to use `pairs` and only letter keys will be read there. ####Value Range diff --git a/docs/vector.md b/docs/vector.md index 2352486b..af70991a 100644 --- a/docs/vector.md +++ b/docs/vector.md @@ -4,7 +4,7 @@ This structure is used to pass 3D positions and directions around. It also conta Besides the functions listed below, other classes can be used to manipulate vectors and points as well. -Example Usage: `target = Vector(1, 0, 0) + Vector(0, 1, 0)` +Example Usage: `#!lua target = Vector(1, 0, 0) + Vector(0, 2, 0):normalized()` Check [Manipulation examples](#manipulation-examples) for more detailed usage. @@ -14,14 +14,18 @@ Check [Manipulation examples](#manipulation-examples) for more detailed usage. ##Constructors summary !!!tip - Every place that returns a coordinate table, like `obj.getPosition()`, serves a Vector class instance already - you do not have to explicitly construct it. - When constructing Vector instances, the `.new` part can be omitted, making e.g. `Vector(1, 2, 3)` equivalent to `Vector.new(1, 2, 3)`. + Every place that returns a coordinate table, like `#!lua obj.getPosition()`, serves a Vector class instance already - you do not have to explicitly construct it. + When constructing Vector instances, the `.new` part can be omitted, making e.g. `#!lua Vector(1, 2, 3)` equivalent to `#!lua Vector.new(1, 2, 3)`. Function Name | Description | Return |   -- | -- | -- | --: Vector([](/types) x, [](/types) y, [](/types) z) | Return a vector with specified (x, y, z) components. | [](/types) Vector([](/types) v) | Return a vector with x/y/z or 1/2/3 components from source table (x/y/z first). | [](/types) Vector.new(...) | Same as Vector(...). | [](/types) +Vector.min([](/types) vec1, [](/types) vec2) | Returns a vector that is made from the smallest components of two vectors. | [](/types) | [](#vectormin) +Vector.max([](/types) vec1, [](/types) vec2) | Returns a vector that is made from the largest components of two vectors. | [](/types) | [](#vectormax) +Vector.between([](/types) vec1, [](/types) vec2) | Return a vector pointing from vec1 to vec2. | [](/types) | [](#vectorbetween) + ###Constructors examples @@ -44,10 +48,10 @@ In addition to accessing vector components by their numeric indices (1, 2, 3) an Function Name | Description | Return |   -- | -- | -- | -- -[setAt](#setat)([](/types) k, [](/types) value) | Sets a component to value and returns self. | [](/types#vector) -[set](#set)([](/types) x, [](/types) y, [](/types) z) | Sets `x`, `y`, `z` components to given values and returns self. Providing a nil value makes it ignore that argument. | [](/types#vector) -[get](#get)() | Returns `x`, `y`, `z` components as three separate values. | [](/types), [](/types), [](/types) -[copy](#copy)() | Returns a separate Vector with identical component values. | [](/types#vector) +setAt([](/types) k, [](/types) value) | Sets a component to value and returns self. | [](/types#vector) | [](#setat) +set([](/types) x, [](/types) y, [](/types) z) | Sets `x`, `y`, `z` components to given values and returns self. | [](/types#vector) | [](#set) +get() | Returns `x`, `y`, `z` components as three separate values. | [](/types)
[](/types)
[](/types) | [](#get) +copy() | Returns a separate Vector with identical component values. | [](/types#vector) | [](#copy) !!!tip Before `Vector` was introduced, coordinate tables contained separate values under 1, 2, 3 and x, y, z keys, with letter keys taking precedence when they were different. This is no longer the case, and using letter and numerical keys is equivalent. However, when iterating over Vector components you have to use `pairs` and only letter keys will be read there. @@ -74,59 +78,7 @@ end --- -##Methods summary - - -###Static methods summary - -Method Name | Description | Return |   --- | -- | -- | --: -[Vector.equals](#vectorequals)([](/types) vec1, [](/types) vec2, [](/types) margin) | Returns true if two vectors are approximately equal. The `margin` argument is optional and defaults to tolerating a difference of ~0.03 in both vector magnitude. | [](/types) -[Vector.min](#vectormin)([](/types) vec1, [](/types) vec2) | Returns a vector that is made from the smallest components of two vectors. | [](/types) -[Vector.max](#vectormax)([](/types) vec1, [](/types) vec2) | Returns a vector that is made from the largest components of two vectors. | [](/types) -[Vector.between](#vectorbetween)([](/types) vec1, [](/types) vec2) | Return a vector pointing from vec1 to vec2. | [](/types) -[Vector.lerp](#vectorlerp)([](/types) p1, [](/types) p2, [](/types) t) | Linearly interpolates between two points. Numeric arg [0, 1] is the fraction. | [](/types) -[Vector.cross](#vectorcross)([](/types) vec1, [](/types) vec2) | Return a cross-product vector of two vectors. | [](/types) -[Vector.dot](#vectordot)([](/types) vec1, [](/types) vec2) | Return a dot product of two vectors. | [](/types) -[Vector.angle](#vectorangle)([](/types) vec1, [](/types) vec2) | Return an angle between two vectors, in degrees [0, 180]. | [](/types) -[Vector.distance](#vectordistance)([](/types) p1, [](/types) p2) | Returns distance between two points. | [](/types) -[Vector.sqrDistance](#vectorsqrdistance)([](/types) p1, [](/types) p2) | Returns squared distance between two points. | [](/types) - - -!!!tip - All static methods can be call like other method with this format: - - ``` Lua - vec1:method(vec2, args) - ``` - -###Arithmetics methods summary -Method Name | Description | Return |   --- | -- | -- | --: -vec:[add](#add)([](/types) otherVec) | Adds components of otherVec to self. | [](/types) -vec:[sub](#sub)([](/types) otherVec) | Subtracts components of otherVec from self. | [](/types) -vec:[inverse](#inverse)() | Multiply self-components by -1. | [](/types) -vec:[scale](#scale)([](/types) otherVec) | Multiplies self-components by corresponding components from otherVec. | [](/types) -vec:[scale](#scale)([](/types) num) | Multiplies self-components by a numeric factor. | [](/types) -vec:[clamp](#clamp)([](/types) num) | If self-magnitude is higher than provided limit, scale self-down to match it. | [](/types) -vec:[normalize](#normalize)() | Makes this vector have a magnitude of 1. | [](/types) -vec:[project](#project)([](/types) otherVec) | Make self into projection on another vector. | [](/types) -vec:[projectOnPlane](#projectonplane)([](/types) otherVec) | Project self on a plane defined through a normal vector arg. | [](/types) -vec:[reflect](#reflect)([](/types) otherVec) | Reflect self over a plane defined through a normal vector arg. | [](/types) -vec:[moveTowards](#movetowards)([](/types) otherVec, [](/types) num) | Move self towards another vector, but only up to a provided distance limit. | [](/types) -vec:[rotateTowards](#rotatetowards)([](/types) target, [](/types) maxAngle) | Rotate self towards another vector, but only up to a provided angle limit. | [](/types) -vec:[rotateTowardsUnit](#rotatetowardsunit)([](/types) target, [](/types) maxAngle) | Same as rotateTowards, but only works correctly if `target` Vector is normalized. Less expensive than `rotateTowards`. | [](/types) -vec:[rotateOver](#rotateover)([](/types) axis, [](/types) angle) | Rotate a Vector `angle` degres over given `axis` (can be `'x'`, `'y'`, `'z'`) and return self. | [](/types) - -!!!tip - Numerous methods of Vector will return the same vector instance to allow easy "chaining". That way you can do more complex processing without saving an intermediate result in a variable, like e.g. `vec:setAt('y', 0):scale(0.5):rotateOver('y', 90)`. - - All arithmetic methods can be used as static: - - ``` Lua - target = Vector(1, 2, 3) - vec = Vector.rotateTowards(vec, target, 6) - ``` +##Arithmetics summary Vector also allows you to use arithmetic operators to performs basic operations: @@ -137,7 +89,7 @@ Operator | Description | Return |   [](/types) one * [](/types) factor | Returns a new Vector that is `one` with each component multiplied by the factor. | [](/types#vector) [](/types) one == [](/types) two | Returns a boolean whether `one` and `two` are very similar to each other (less than ~0.03 difference in magnitude) | [](/types) -####Arithmetics and operators examples +###Arithmetics examples ```lua function onLoad() @@ -153,41 +105,57 @@ function onLoad() end ``` -###Property methods summary -Method Name | Description | Return |   --- | -- | -- | --: -vec:[magnitude](#magnitude)() | Returns the length of this vector. | [](/types) -vec:[sqrMagnitude](#sqrmagnitude)() | Returns the squared length of this vector. | [](/types) -vec:[string](#string)([](/types) prefix) | Return string describing self, optional string prefix. | [](/types) -vec:[normalized](#normalized)() | Return a new vector that is normalized (length 1) version of self. | [](/types) -vec:[orthoNormalize](#orthonormalize)() | Return three normalized vectors perpendicular to each other, first one being in the same dir as self. | [](/types) base, [](/types) normal, [](/types) binormal -vec:[orthoNormalize](#orthonormalize)([](/types) binormalPlanar) | Same as vec:orthoNormalize(), but second vector is guranteed to be on a self-binormalPlanar plane. | [](/types) base, [](/types) normal, [](/types) binormal -vec:[heading](#heading)([](/types) axis) | Returns an angle (In degrees) of rotation of Vector over a given `axis` (can be `'x'`, `'y'`, `'z'`). | [](/types) - --- +##Methods summary -##Methods details +!!!tip + Numerous methods of Vector will return the instance to allow easy "chaining". That way you can do more complex processing without saving an intermediate result in a variable, like e.g. `#!lua vec:setAt('y', 0):scale(0.5):rotateOver('y', 90)`. -###Static methods details -####Vector.equals(...) +###Methods modifying self -[](/types) Returns true if two vectors are approximately equal. -The `margin` argument is optional and defaults to tolerating a difference of `~0.03` in both vector magnitude. +Method Name | Description | Return |   +-- | -- | -- | --: +vec:add([](/types) otherVec) | Adds components of otherVec to self. | [](/types) | [](#add) +vec:sub([](/types) otherVec) | Subtracts components of otherVec from self. | [](/types) | [](#sub) +vec:scale([](/types) otherVec) | Multiplies self-components by corresponding components from otherVec. | [](/types) | [](#scale) +vec:scale([](/types) num) | Multiplies self-components by a numeric factor. | [](/types) | [](#scale) +vec:clamp([](/types) num) | If self-magnitude is higher than provided limit, scale self-down to match it. | [](/types) | [](#clamp) +vec:normalize() | Makes self-have a magnitude of 1. | [](/types) | [](#normalize) +vec:project([](/types) otherVec) | Make self into projection on another vector. | [](/types) | [](#project) +vec:projectOnPlane([](/types) otherVec) | Project self on a plane defined through a normal vector arg. | [](/types) | [](#projectonplane) +vec:reflect([](/types) otherVec) | Reflect self over a plane defined through a normal vector arg. | [](/types) | [](#reflect) +vec:inverse() | Multiply self-components by -1. | [](/types) | [](#inverse) +vec:moveTowards([](/types) otherVec, [](/types) num) | Move self towards another vector, but only up to a provided distance limit. | [](/types) | [](#movetowards) +vec:rotateTowards([](/types) target, [](/types) maxAngle) | Rotate self towards another vector, but only up to a provided angle limit. | [](/types) | [](#rotatetowards) +vec:rotateTowardsUnit([](/types) target, [](/types) maxAngle) | Same as rotateTowards, but only works correctly if `target` Vector is normalized. Less expensive than `rotateTowards`. | [](/types) | [](#rotatetowardsunit) +vec:rotateOver([](/types) axis, [](/types) angle) | Rotate a Vector `angle` degrees over given `axis` (can be `'x'`, `'y'`, `'z'`). | [](/types) | [](#rotateover) + +###Methods not modifying self -!!!info "Vector.equals(vec1, vec2, margin)" - * [](/types) **vec1**: First vector. - * [](/types) **vec2**: Second vector. - * [](/types) **margin**: (Optional) Numeric tolerance. +Method Name | Description | Return |   +-- | -- | -- | --: +vec1:dot([](/types) vec2) | Return a dot product of two vectors. | [](/types) | [](#dot) +vec:magnitude() | Returns the length of this vector. | [](/types) | [](#magnitude) +vec:sqrMagnitude() | Returns the squared length of this vector. | [](/types) | [](#sqrmagnitude) +p1:distance([](/types) p2) | Returns distance between two points. | [](/types) | [](#distance) +p1:sqrDistance([](/types) p2) | Returns squared distance between two points. | [](/types) | [](#sqrdistance) +vec1:equals([](/types) vec2, [](/types) margin) | Returns true if two vectors are approximately equal. The `margin` argument is optional and defaults to tolerating a difference of ~0.03 in both vector magnitude. | [](/types) | [](#equals) +vec:string([](/types) prefix) | Return string describing self, optional string prefix. | [](/types)
[](/types) | [](#string) +vec1:angle([](/types) vec2) | Return an angle between two vectors, in degrees [0, 180]. | [](/types) | [](#angle) +vec1:cross([](/types) vec2) | Return a cross-product vector of two vectors. | [](/types) | [](#cross) +p1:lerp([](/types) p2, [](/types) t) | Linearly interpolates between two points. Numeric arg [0, 1] is the fraction. | [](/types) | [](#lerp) +vec:normalized() | Return a new vector that is normalized (length 1) version of self. | [](/types) | [](#normalized) +vec:orthoNormalize() | Return three normalized vectors perpendicular to each other, first one being in the same dir as self. Return `base`, `normal`, `binormal` vectors. | [](/types)
[](/types)
[](/types)
| [](#orthonormalize) +vec:orthoNormalize([](/types) binormalPlanar) | Same as vec:orthoNormalize(), but second vector is guranteed to be on a self-binormalPlanar plane. | [](/types)
[](/types)
[](/types)
| [](#orthonormalize) +vec:heading() | Returns an angle (In degrees) of rotation of Vector over all axis (`'x'`, `'y'`, `'z'`). | [](/types)
[](/types)
[](/types) | [](#heading) +vec:heading([](/types) axis) | Returns an angle (In degrees) of rotation of Vector over a given `axis` (can be `'x'`, `'y'`, `'z'`). | [](/types) | [](#heading) -``` Lua -vec1 = Vector(1, 2, 3.10) -vec2 = Vector(1, 2, 3.15) -print(Vector.equals(vec1, vec2)) --> false -print(Vector.equals(vec1, vec2, 0.01)) --> true -``` +--- + +##Constructors details -####Vector.min(...) +###Vector.min(...) [](/types) Returns a vector that is made from the smallest components of two vectors. @@ -201,7 +169,7 @@ vec2 = Vector(4, 3, 2) print(Vector.min(vec1, vec2)) --> Vector: { 1, 2, 2 } ``` -####Vector.max(...) +###Vector.max(...) [](/types) Returns a vector that is made from the largest components of two vectors. @@ -215,7 +183,7 @@ vec2 = Vector(4, 3, 2) print(Vector.max(vec1, vec2)) --> Vector: { 4, 3, 3 } ``` -####Vector.between(...) +###Vector.between(...) [](/types) Return a vector pointing from vec1 to vec2. @@ -229,109 +197,11 @@ vec2 = Vector(4, 3, 2) print(Vector.between(vec1, vec2)) --> Vector: { 3, 1, -1 } ``` -####Vector.lerp(...) - -[](/types) Linearly interpolates between two points. - -Interpolates between the points a and b by the interpolant t. The parameter t is clamped to the range [0, 1]. This is most commonly used to find a point some fraction of the way along a line between two endpoints (e.g. to move an object gradually between those points). - -The value returned equals (b - a) * t. When t = 0 returns a. When t = 1 returns b. When t = 0.5 returns the point midway between a and b. - -!!!info "Vector.lerp(p1, p2)" - * [](/types) **p1**: First point. - * [](/types) **p2**: Second point. - * [](/types) **t**: Fraction. - -``` Lua -p1 = Vector(1, 2, - 4) -p2 = Vector(1, 2, 4) -print(Vector.lerp(p1, p2, 0.25)) --> Vector: { 1, 2, -2 } -``` - -####Vector.cross(...) - -[](/types) Return a cross-product vector of two vectors. - -The cross product of two vectors results in a third vector which is perpendicular to the two input vectors. The result's magnitude is equal to the magnitudes of the two inputs multiplied together and then multiplied by the sine of the angle between the inputs. You can determine the direction of the result vector using the "left hand rule". - -!!!info "Vector.cross(vec1, vec2)" - * [](/types) **vec1**: First vector. - * [](/types) **vec2**: Second vector. - -``` Lua -vec1 = Vector(1, 2, 3) -vec2 = Vector(4, 3, 2) -print(Vector.cross(vec1, vec2)) --> Vector: { -5, 10, -5 } -print(Vector.cross(vec2, vec1)) --> Vector: {-5, -10, 5 } -``` - -####Vector.dot(...) - -[](/types) Return the dot product of two vectors. - -The dot product is a float value equal to the magnitudes of the two vectors multiplied together and then multiplied by the cosine of the angle between them. - -For normalized vectors Dot returns 1 if they point in exactly the same direction, -1 if they point in completely opposite directions and zero if the vectors are perpendicular. - -!!!info "Vector.dot(vec1, vec2)" - * [](/types) **vec1**: First vector. - * [](/types) **vec2**: Second vector. - -``` Lua -vec1 = Vector(0, 1, 2) -vec2 = Vector(0, 2, 4) -print(Vector.dot(vec1, vec2)) --> 10 -print(Vector.dot(vec1:normalized(), vec2:normalized())) --> 1 -``` - -####Vector.angle(...) - -[](/types) Returns the angle in degrees between two vectors. - -The angle returned is the unsigned angle between the two vectors. This means the smaller of the two possible angles between the two vectors is used. The result is never greater than 180 degrees. - -!!!info "Vector.angle(vec1, vec2)" - * [](/types) **vec1**: First vector. - * [](/types) **vec2**: Second vector. - -``` Lua -vec1 = Vector(1, 2, 3) -vec2 = Vector(4, 3, 2) -print(Vector.angle(vec1, vec2)) --> 37.43 -``` - -####Vector.distance(...) - -[](/types) Returns distance between two points. - -!!!info "Vector.distance(p1, p2)" - * [](/types) **p1**: First point. - * [](/types) **p2**: Second point. - -``` Lua -p1 = Vector(1, 2, 3) -p2 = Vector(4, 3, 2) -print(Vector.distance(p1, p2)) --> 3.32 -print((p1 - p2):magnitude()) --> 3.32 -``` - -####Vector.sqrDistance(...) - -[](/types) Returns squared distance between two points. - -!!!info "Vector.sqrDistance(p1, p2)" - * [](/types) **p1**: First point. - * [](/types) **p2**: Second point. - -``` Lua -p1 = Vector(1, 2, 3) -p2 = Vector(4, 3, 2) -print(Vector.sqrDistance(p1, p2)) --> 11 -``` +--- -###Arithmetics methods details +##Element access details -####setAt(...) +###setAt(...) [](/types) Update one component of the vector and returning self. @@ -345,10 +215,12 @@ vec:setAt(1, 4):setAt('y', 3) print(vec) --> Vector: { 4, 3, 3 } ``` -####set(...) +###set(...) [](/types) Update all components of the vector and returning self. +Providing a nil value makes it ignore that argument. + !!!info "set(x, y, z)" * [](/types) **x**: New value of X component. * [](/types) **y**: New value of Y component. @@ -360,9 +232,39 @@ vec:set(4, 3, 2) print(vec) --> Vector: { 4, 3, 2 } ``` +###get() + +[](/types) +[](/types) +[](/types) Returns `x`, `y`, `z` components as three separate values. + +``` Lua +vec = Vector(1, 2, 3) +x, y, z = vec:get() +print(x + y + z) --> 6 +``` + +###copy() + +[](/types) Copy self into a new vector and return it. + +``` Lua +vec1 = Vector(1, 2, 3) +vec2 = vec1:copy() +vec1:set(4, 3, 2) +print(vec1) --> Vector { 4, 3, 2 } +print(vec2) --> Vector { 1, 2, 3 } +``` + +--- + +##Methods details + +###Methods modifying self details + ####add(...) -[](/types) Adds components of otherVec to self and returning self. +[](/types) Adds components of otherVec to self and returning self. !!!info "add(otherVec)" * [](/types) **otherVec**: The vector to add. @@ -382,7 +284,7 @@ print(vec) --> Vector: { 5, 7, 9 } ####sub(...) -[](/types) Subtracts components of otherVec from self and returning self. +[](/types) Subtracts components of otherVec from self and returning self. !!!info "sub(otherVec)" * [](/types) **otherVec**: The vector to subtracts. @@ -399,19 +301,10 @@ otherVec = Vector(6, 5, 4) vec = vec - otherVec print(vec) --> Vector: { -5, -3, -1 } ``` -####inverse() - -[](/types) Multiply self-components by -1. - -``` Lua -vec = Vector(1, 2, 3) -vec:inverse() -print(vec) --> Vector: { -1, -2, -3 } -``` ####scale(...) -[](/types) Multiplies self-components by corresponding components from otherVec. +[](/types) Multiplies self-components by corresponding components from otherVec and returning self. Every component in the result is a component of vec multiplied by the same component of otherVec or by a number factor. @@ -432,7 +325,7 @@ print(vec) --> Vector: { 4, 12, 24 } ####clamp(...) -[](/types) If self-magnitude is higher than provided limit, scale self-down to match it. +[](/types) If self-magnitude is higher than provided limit, scale self-down to match it and returning self. !!!info "clamp(num)" * [](/types) **num**: The numeric max magnitude. @@ -445,7 +338,7 @@ print(vec) --> Vector: { 0.53, 1.07, 1.60 } ####normalize() -[](/types) Makes this vector have a magnitude of 1. +[](/types) Makes this vector have a magnitude of 1 and returning self. When normalized, a vector keeps the same direction but its length is 1.0. @@ -459,7 +352,7 @@ print(vec) --> Vector: { 0.27, 0.53, 0.80 } ####project(...) -[](/types) Make self into projection on another vector. +[](/types) Make self into projection on another vector and return self. To understand vector projection, imagine that `otherVec` is resting on a line pointing in its direction. Somewhere along that line will be the nearest point to the tip of vector. The projection is just `otherVec` rescaled so that it reaches that point on the line. @@ -474,7 +367,7 @@ print(vec) --> Vector: { 0.67, -1.3, 0.67 } ####projectOnPlane(...) -[](/types) Projects a vector onto a plane defined by a normal orthogonal to the plane. +[](/types) Projects a vector onto a plane defined by a normal orthogonal to the plane and return self. A Vector stores the position of the given `vec` in 3d space. A second Vector is given by `otherVec` and defines a direction from a plane towards vector that passes through the origin. Vector.projectOnPlane uses the two Vector values to generate the position of vector in the `otherVec` direction, and return the location of the Vector on the plane. @@ -489,7 +382,7 @@ print(vec) --> Vector: { 1.33, 2.33, 3.33 } ####reflect(...) -[](/types) Make self into reflection on another vector. +[](/types) Make self into reflection on another vector and return self. The `otherVec` vector defines a plane (a plane's normal is the vector that is perpendicular to its surface). The `vec` vector is treated as a directional arrow coming in to the plane. The returned value is a vector of equal magnitude to `vec` but with its direction reflected. @@ -503,9 +396,19 @@ vec:reflect(Vector(4, 3, 2)) print(vec) --> Vector: { -3.41, -1.31, 0.79 } ``` +####inverse() + +[](/types) Multiply self-components by -1. + +``` Lua +vec = Vector(1, 2, 3) +vec:inverse() +print(vec) --> Vector: { -1, -2, -3 } +``` + ####moveTowards(...) -[](/types) Move self towards another vector, but only up to a provided distance limit. +[](/types) Move self towards another vector, but only up to a provided distance limit and return self. !!!info "moveTowards(otherVec, num)" * [](/types) **target**: The position to move towards. @@ -519,7 +422,7 @@ print(vec) --> Vector: { 1.45, 2.15, 2.85 } ####rotateTowards(...) -[](/types) Rotate self towards another vector, but only up to a provided angle limit. +[](/types) Rotate self towards another vector, but only up to a provided angle limit and return self. This function is similar to [moveTowards()](#movetowards) except that the vector is treated as a direction rather than a position. The current vector will be rotated round toward the target direction by an angle of `maxAngle`, although it will land exactly on the target rather than overshoot. If the magnitudes of current and target are different, then the magnitude of the result will be linearly interpolated during the rotation. If a negative value is used for `maxAngle`, the vector will rotate away from target until it is pointing in exactly the opposite direction, then stops. @@ -535,7 +438,7 @@ print(vec) --> Vector: { 2.78, 2.08, 1.39 } ####rotateTowardsUnit(...) -[](/types) Same as [rotateTowards()](#rotatetowards), but only works correctly if `target` Vector is normalized. Less expensive than `rotateTowards()`. +[](/types) Same as [rotateTowards()](#rotatetowards), but only works correctly if `target` Vector is normalized and return self. Less expensive than `rotateTowards()`. !!!info "rotateTowardsUnit(target, maxAngle)" * [](/types) **target**: The position to rotate towards. @@ -549,10 +452,10 @@ print(vec) --> Vector: { 3.29, 0.87, -1.55 } ####rotateOver(...) -[](/types) Rotate a Vector `angle` degrees over given `axis` (can be `'x'`, `'y'`, `'z'`) and return self. +[](/types) Rotate a Vector `angle` degrees over given `axis` (can be `'x'`, `'y'`, `'z'`) and return self. !!!info "rotateOver(axis, angle)" - * [](/types) **axis**: The axis to rotate around. + * [](/types) **axis**: The axis to rotate around. * [](/types) **angle**: The angle in **degree** for this rotation. ``` Lua @@ -561,29 +464,28 @@ vec:rotateOver('y', 45) print(vec) --> Vector: { 4.24, 2, 0 } ``` -###Property methods details -####get() +--- -[](/types) -[](/types) -[](/types) Returns `x`, `y`, `z` components as three separate values. +###Methods not modifying self details -``` Lua -vec = Vector(1, 2, 3) -x, y, z = vec:get() -print(x + y + z) --> 6 -``` -####copy() +####dot(...) -[](/types) Copy self into a new vector and return it. +[](/types) Return the dot product of two vectors. + +The dot product is a float value equal to the magnitudes of the two vectors multiplied together and then multiplied by the cosine of the angle between them. + +For normalized vectors Dot returns 1 if they point in exactly the same direction, -1 if they point in completely opposite directions and zero if the vectors are perpendicular. + +!!!info "vec1:dot(vec2)" + * [](/types) **vec1**: First vector. + * [](/types) **vec2**: Second vector. ``` Lua -vec1 = Vector(1, 2, 3) -vec2 = vec1:copy() -vec1:set(4, 3, 2) -print(vec1) --> Vector { 4, 3, 2 } -print(vec2) --> Vector { 1, 2, 3 } +vec1 = Vector(0, 1, 2) +vec2 = Vector(0, 2, 4) +print(vec1:dot(vec2)) --> 10 +print(Vector.dot(vec1:normalized(), vec2:normalized())) --> 1 ``` ####magnitude() @@ -593,6 +495,7 @@ print(vec2) --> Vector { 1, 2, 3 } ``` Lua vec = Vector(1, 2, 3) print(vec:magnitude()) --> 3.74 (sqrt of 14) +print(Vector.magnitude(vec)) --> 3.74 (sqrt of 14) ``` ####sqrMagnitude() @@ -602,11 +505,61 @@ print(vec:magnitude()) --> 3.74 (sqrt of 14) ``` Lua vec = Vector(1, 2, 3) print(vec:sqrMagnitude()) --> 14 +print(Vector.sqrMagnitude(vec)) --> 14 +``` + +####distance(...) + +[](/types) Returns distance between two points. + +!!!info "p1:distance(p2)" + * [](/types) **p1**: First point. + * [](/types) **p2**: Second point. + +``` Lua +p1 = Vector(1, 2, 3) +p2 = Vector(4, 3, 2) +print(p1:distance(p2)) --> 3.32 +print(Vector.distance(p1, p2)) --> 3.32 +print((p1 - p2):magnitude()) --> 3.32 +``` + +####sqrDistance(...) + +[](/types) Returns squared distance between two points. + +!!!info "p1:sqrDistance(p2)" + * [](/types) **p1**: First point. + * [](/types) **p2**: Second point. + +``` Lua +p1 = Vector(1, 2, 3) +p2 = Vector(4, 3, 2) +print(p1:sqrDistance(p2)) --> 11 +print(Vector.sqrDistance(p1, p2)) --> 11 +``` + +####equals(...) + +[](/types) Returns true if two vectors are approximately equal. +The `margin` argument is optional and defaults to tolerating a difference of `~0.03` in both vector magnitude. + +!!!info "vec1:equals(vec2, margin)" + * [](/types) **vec1**: First vector. + * [](/types) **vec2**: Second vector. + * [](/types) **margin**: (Optional) Numeric tolerance. + +``` Lua +vec1 = Vector(1, 2, 3.10) +vec2 = Vector(1, 2, 3.15) +print(vec1:equals(vec2)) --> false +print(Vector.equals(vec1, vec2, 0.01)) --> true ``` ####string(...) -[](/types) Return string describing self, optional string prefix. +[](/types) +[](/types) Return string describing self, optional string prefix. !!!info "string(prefix)" * [](/types) **prefix**: The prefix of return string. @@ -616,10 +569,67 @@ vec = Vector(1, 2, 3) str = vec:string('Prefix') print(str) --> Prefix: { 1, 2, 3 } print(vec:string('Prefix')) --> Prefix: { 1, 2, 3 }0 +print(Vector.string(vec, 'Prefix')) --> Prefix: { 1, 2, 3 }0 ``` !!!warning - This function returns one extra float that will be displayed in print function. + This function returns one extra float that will be displayed in print function. This value is returned by the last gsub used in internal function. + +####angle(...) + +[](/types) Returns the angle in degrees between two vectors. + +The angle returned is the unsigned angle between the two vectors. This means the smaller of the two possible angles between the two vectors is used. The result is never greater than 180 degrees. + +!!!info "vec1:angle(vec2)" + * [](/types) **vec1**: First vector. + * [](/types) **vec2**: Second vector. + +``` Lua +vec1 = Vector(1, 2, 3) +vec2 = Vector(4, 3, 2) +print(vec1:angle(vec2)) --> 37.43 +print(Vector.angle(vec1, vec2)) --> 37.43 +``` + +####cross(...) + +[](/types) Return a cross-product vector of two vectors. + +The cross product of two vectors results in a third vector which is perpendicular to the two input vectors. The result's magnitude is equal to the magnitudes of the two inputs multiplied together and then multiplied by the sine of the angle between the inputs. You can determine the direction of the result vector using the "left hand rule". + +!!!info "vec1:cross(vec2)" + * [](/types) **vec1**: First vector. + * [](/types) **vec2**: Second vector. + +``` Lua +vec1 = Vector(1, 2, 3) +vec2 = Vector(4, 3, 2) +print(vec1:cross(vec2)) --> Vector: { -5, 10, -5 } +print(vec2:cross(vec1)) --> Vector: { -5, -10, 5 } +print(Vector.cross(vec1, vec2)) --> Vector: { -5, 10, -5 } +print(Vector.cross(vec2, vec1)) --> Vector: { -5, -10, 5 } +``` + +####lerp(...) + +[](/types) Linearly interpolates between two points. + +Interpolates between the points a and b by the interpolant t. The parameter t is clamped to the range [0, 1]. This is most commonly used to find a point some fraction of the way along a line between two endpoints (e.g. to move an object gradually between those points). + +The value returned equals (b - a) * t. When t = 0 returns a. When t = 1 returns b. When t = 0.5 returns the point midway between a and b. + +!!!info "p1:lerp(p2, t)" + * [](/types) **p1**: First point. + * [](/types) **p2**: Second point. + * [](/types) **t**: Fraction. + +``` Lua +p1 = Vector(1, 2, - 4) +p2 = Vector(1, 2, 4) +print(p1:lerp(p2, 0.25)) --> Vector: { 1, 2, -2 } +print(Vector.lerp(p1, p2, 0.25)) --> Vector: { 1, 2, -2 } +``` ####normalized() @@ -628,6 +638,7 @@ print(vec:string('Prefix')) --> Prefix: { 1, 2, 3 }0 ``` Lua vec = Vector(1, 2, 3) print(vec:normalized()) --> Vector: { 0.27, 0.53, 0.80} +print(Vector.normalized(vec)) --> Vector: { 0.27, 0.53, 0.80} ``` ####orthoNormalize(...) @@ -639,7 +650,6 @@ print(vec:normalized()) --> Vector: { 0.27, 0.53, 0.80} !!!info "orthoNormalize(binormalPlanar)" * [](/types) **binormalPlanar**: (optional) The vector for binormal planar. - ``` Lua vec = Vector(0, 0, 2) base, normal, binormal = vec:orthoNormalize(Vector(0, 1, 0)) From d6e4999acaaa6e7e04c16b4cb89a0237a2571455 Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Sun, 26 Apr 2020 16:21:55 -0400 Subject: [PATCH 25/48] changed link format to be mkdocs-compliant also fixed some broken links --- docs/assetbundle.md | 16 +- docs/atom.md | 16 +- docs/base.md | 172 ++++----- docs/clock.md | 18 +- docs/component.md | 22 +- docs/counter.md | 10 +- docs/event.md | 202 +++++----- docs/externaleditorapi.md | 4 +- docs/index.md | 4 +- docs/intro.md | 34 +- docs/json.md | 20 +- docs/lighting.md | 28 +- docs/musicplayer.md | 58 +-- docs/notes.md | 44 +-- docs/object.md | 774 +++++++++++++++++++------------------- docs/overview.md | 6 +- docs/physics.md | 36 +- docs/player-color.md | 2 +- docs/player.md | 146 +++---- docs/rpgfigurine.md | 14 +- docs/spawnableobjects.md | 98 ++--- docs/texttool.md | 12 +- docs/time.md | 10 +- docs/timer.md | 24 +- docs/turns.md | 22 +- docs/types.md | 31 +- docs/ui.md | 126 +++---- docs/ui/attributes.md | 38 +- docs/ui/basicelements.md | 22 +- docs/ui/image_inprogress | 4 +- docs/ui/inputelements.md | 82 ++-- docs/ui/layoutgrouping.md | 60 +-- docs/vector.md | 254 ++++++------- docs/wait.md | 38 +- docs/webrequest.md | 38 +- 35 files changed, 1242 insertions(+), 1243 deletions(-) diff --git a/docs/assetbundle.md b/docs/assetbundle.md index df789a2e..22696229 100644 --- a/docs/assetbundle.md +++ b/docs/assetbundle.md @@ -1,4 +1,4 @@ -AssetBundle is a special [Object](object) type that has access to [custom AssetBundle](http://berserk-games.com/knowledgebase/assetbundles/) related functions like looping and trigger effects. +AssetBundle is a special [Object](object.md) type that has access to [custom AssetBundle](http://berserk-games.com/knowledgebase/assetbundles/) related functions like looping and trigger effects. Example Usage: `self.AssetBundle.getLoopingEffects()` @@ -8,11 +8,11 @@ Example Usage: `self.AssetBundle.getLoopingEffects()` Function Name | Description | Return |   -- | -- | -- | -- -getLoopingEffectIndex() | Index of the currently looping effect. Indexs starts at 0. | [](/types) -getLoopingEffects() | Returns a Table with the keys "index" and "name" for each looping effect. | [](/types) | [](#getloopingeffects) -getTriggerEffects() | Returns a Table with the keys "index" and "name" for each trigger effect. | [](/types) | [](#gettriggereffects) -playLoopingEffect([](/types) index) | Starts playing a looping effect. Indexs starts at 0. | [](/types) | -playTriggerEffect([](/types) index) | Starts playing a trigger effect. Indexs starts at 0. | [](/types) | +getLoopingEffectIndex() | Index of the currently looping effect. Indexs starts at 0. | [](types.md) +getLoopingEffects() | Returns a Table with the keys "index" and "name" for each looping effect. | [](types.md) | [](#getloopingeffects) +getTriggerEffects() | Returns a Table with the keys "index" and "name" for each trigger effect. | [](types.md) | [](#gettriggereffects) +playLoopingEffect([](types.md) index) | Starts playing a looping effect. Indexs starts at 0. | [](types.md) | +playTriggerEffect([](types.md) index) | Starts playing a trigger effect. Indexs starts at 0. | [](types.md) | --- @@ -20,7 +20,7 @@ getTriggerEffects() | Returns a Table with the keys "index" and "name" for eac ###getLoopingEffects() -[](/types) Returns a Table with the keys "index" and "name" for each looping effect. +[](types.md) Returns a Table with the keys "index" and "name" for each looping effect. ``` Lua -- Example usage @@ -39,7 +39,7 @@ getTriggerEffects() | Returns a Table with the keys "index" and "name" for eac ###getTriggerEffects() -[](/types) Returns a Table with the keys "index" and "name" for each trigger effect. +[](types.md) Returns a Table with the keys "index" and "name" for each trigger effect. ``` Lua -- Example usage diff --git a/docs/atom.md b/docs/atom.md index e8d49d4d..6e0f7a6d 100644 --- a/docs/atom.md +++ b/docs/atom.md @@ -1,5 +1,5 @@ -![Logo](/img/atom/logo.png) +![Logo](img/atom/logo.png) Atom is a free, open source, and cross-platform text editor created by [GitHub](http://www.github.com/): @@ -27,12 +27,12 @@ This is only a summarized list of features Atom offers. Check out a more complet ### Syntax Highlighting All standard Lua syntax is highlighted in multiple colors to help with readability. -![Syntax Highlighting](/img/atom/syntax.png) +![Syntax Highlighting](img/atom/syntax.png) ### Code Autocompletion The entire Tabletop Simulator Lua Scripting API (with the exception of the Player class) has been added to the native Atom autocomplete system. Easily see all of the member variables and functions available to you with their parameters, return type, short description, and a link directly to our Knowledge Base with more information for that variable or function. Functions belonging to the Lua standard library classes such as math, coroutine, or os link directly to the official Lua documentation. -![Code Autocompletion](/img/atom/autocomplete.png) +![Code Autocompletion](img/atom/autocomplete.png) ### Tabletop Simulator Interactivity The Atom plugin can directly connect to a running instance of Tabletop Simulator to get all of the existing Lua scripts on Objects and to call Save & Play. Both functions can be called directly from the Packages menu or the right click contextual menu. TTS must be running with the game loaded for these functions to work. @@ -42,8 +42,8 @@ Command | Action Taken Get Lua Scripts | Downloads all existing scripts in a loaded Tabletop Simulator game with Atom. You will need to call Get Lua Scripts every time you change to a different game in TTS. Save & Play | Saves all Lua files in Atom, uploads them to a loaded Tabletop Simulator game, and reloads the current game (same as Save & Play in the in-game editor). -![Logo](/img/atom/sap1.png) -![Logo](/img/atom/sap2.png) +![Logo](img/atom/sap1.png) +![Logo](img/atom/sap2.png) > Every time you start up Atom, the cached local `*.lua` files are deleted. @@ -57,7 +57,7 @@ Download and install Atom [from the official website](https://atom.io/). 3. Type in tabletopsimulator-lua into the search field and press the Enter key or click the Packages button 4. Click the blue Install button for the tabletopsimulator-lua package -![Installing Atom](/img/atom/install.png) +![Installing Atom](img/atom/install.png) ## Setting Up Atom @@ -69,7 +69,7 @@ By default, Tabletop Simulator scripts use a tab width of four spaces. You are n 3. Scroll down to Tab Length 4. Set the Tab Length to 4 -![Setup](/img/atom/setup.png) +![Setup](img/atom/setup.png) ### Tables as Pipe Operators To enable tabs showing up as pipe operators "|" as an indent guide: @@ -79,7 +79,7 @@ To enable tabs showing up as pipe operators "|" as an indent guide: 3. Scroll down to Show Indent Guide 4. Check Show Indent Guide -![Tables as Pope Operators](/img/atom/pipes.png) +![Tables as Pope Operators](img/atom/pipes.png) ##Updating Atom Plugin The plugin will automatically check for updates when Atom is started. If a new update is found, it will update itself. You will have to manually restart Atom for the new version of the plugin to be loaded. You can check Atom's console if it found an update (ctrl + alt + i). diff --git a/docs/base.md b/docs/base.md index 412e67ea..68f9804f 100644 --- a/docs/base.md +++ b/docs/base.md @@ -9,19 +9,19 @@ General functions which work within any script. Function Name | Description | Return |   -- | -- | -- | -- -copy([](/types) object_list) | Copy a list of Objects to the clipboard. Works with [paste(...)](#paste). | [](/types) | [](#copy) -destroyObject([](/types) obj) | Destory an Object. | [](/types) | [](#destroyobject) -flipTable() | Flip the table. | [](/types) | -getAllObjects() | Returns Table of all spawned [Objects](object) in the game. | [](/types) | -getObjectFromGUID([](/types) guid) | Returns Object by its GUID. Will return `nil` if this GUID doesn't currently exist. | [](/types) | [](#getobjectfromguid) -getSeatedPlayers() | Returns Table of the [Player Colors](player-color) strings of seated players. | [](/types) | -group([](/types) objects) | Groups objects together, like how the `G` key does for players. | [](/types) | [](#group) -paste([](/types) parameters) | Pastes Objects in-game that were copied to the in-game clipboard. Works with [copy(...)](#copy). | [](/types) | [](#paste) -setLookingForPlayers([](/types) lfp) | Enables/disables looking for group. This is visible in the server browsers, indicating if you are recruiting for a game. | [](/types) | -spawnObject([](/types) parameters) | Spawns an Object. View the [Spawnable Object](/spawnableobjects) page for Objects that can be spawned. | [](/types) | [](#spawnobject) -spawnObjectJSON([](/types) parameters) | Spawns an Object using a JSON string. Works with [getJSON()](object#getjson). | [](/types) | [](#spawnobjectjson) -startLuaCoroutine([](/types) function_owner, [](/types) function_name) | Start a coroutine. | [](/types) | [](#startluacoroutine) -stringColorToRGB([](/types) player_color) | Converts a [Player Color](player-color) string into a Color Table for tinting. | [](/types#color) | [](#stringcolortorgb) +copy([](types.md) object_list) | Copy a list of Objects to the clipboard. Works with [paste(...)](#paste). | [](types.md) | [](#copy) +destroyObject([](types.md) obj) | Destory an Object. | [](types.md) | [](#destroyobject) +flipTable() | Flip the table. | [](types.md) | +getAllObjects() | Returns Table of all spawned [Objects](object.md) in the game. | [](types.md) | +getObjectFromGUID([](types.md) guid) | Returns Object by its GUID. Will return `nil` if this GUID doesn't currently exist. | [](types.md) | [](#getobjectfromguid) +getSeatedPlayers() | Returns Table of the [Player Colors](player-color.md) strings of seated players. | [](types.md) | +group([](types.md) objects) | Groups objects together, like how the `G` key does for players. | [](types.md) | [](#group) +paste([](types.md) parameters) | Pastes Objects in-game that were copied to the in-game clipboard. Works with [copy(...)](#copy). | [](types.md) | [](#paste) +setLookingForPlayers([](types.md) lfp) | Enables/disables looking for group. This is visible in the server browsers, indicating if you are recruiting for a game. | [](types.md) | +spawnObject([](types.md) parameters) | Spawns an Object. View the [Spawnable Object](spawnableobjects.md) page for Objects that can be spawned. | [](types.md) | [](#spawnobject) +spawnObjectJSON([](types.md) parameters) | Spawns an Object using a JSON string. Works with [getJSON()](object.md#getjson). | [](types.md) | [](#spawnobjectjson) +startLuaCoroutine([](types.md) function_owner, [](types.md) function_name) | Start a coroutine. | [](types.md) | [](#startluacoroutine) +stringColorToRGB([](types.md) player_color) | Converts a [Player Color](player-color.md) string into a Color Table for tinting. | [](types.md#color) | [](#stringcolortorgb) ###Message Functions @@ -29,14 +29,14 @@ Functions which handle sending and displaying data. Function Name | Description | Return |   -- | -- | -- | -- -broadcastToAll([](/types) message, [](/types#color) message_tint) | Print an on-screen message to all Players, as well as their in-game chat. | [](/types) | [](#broadcasttoall) -broadcastToColor([](/types) message, [](/types) player_color, [](/types#color) message_tint) | Print an on-screen message to a specified Player, as well as their in-game chat. | [](/types) | [](#broadcasttocolor) -log([](/types) element, [](/types) label, [](/types) tag) | Print information to the log tab. (Shortcut: ~) | [](/types) | [](#log) -logStyle([](/types) tag, [](/types#color) tint, [](/types) prefix, [](/types) postfix) | Set style options for the specified tag type for the log. | [](/types) | [](#logstyle) -print([](/types) message) | Prints a string into chat that only the host is able to see. Used for debugging scripts. | [](/types) | [](#print) -printToAll([](/types) message, [](/types#color) message_tint) | Print a message into the chat of all connected players. | [](/types) | [](#printtoall) -printToColor([](/types) message, [](/types) player_color, [](/types#color) message_tint) | Print a message to a specific [Player Color](player-color). | [](/types) | [](#printtocolor) -sendExternalMessage([](/types) data) | Send a table to your external script editor, most likely Atom. This is for custom editor functionality. | [](/types) | +broadcastToAll([](types.md) message, [](types.md#color) message_tint) | Print an on-screen message to all Players, as well as their in-game chat. | [](types.md) | [](#broadcasttoall) +broadcastToColor([](types.md) message, [](types.md) player_color, [](types.md#color) message_tint) | Print an on-screen message to a specified Player, as well as their in-game chat. | [](types.md) | [](#broadcasttocolor) +log([](types.md) element, [](types.md) label, [](types.md) tag) | Print information to the log tab. (Shortcut: ~) | [](types.md) | [](#log) +logStyle([](types.md) tag, [](types.md#color) tint, [](types.md) prefix, [](types.md) postfix) | Set style options for the specified tag type for the log. | [](types.md) | [](#logstyle) +print([](types.md) message) | Prints a string into chat that only the host is able to see. Used for debugging scripts. | [](types.md) | [](#print) +printToAll([](types.md) message, [](types.md#color) message_tint) | Print a message into the chat of all connected players. | [](types.md) | [](#printtoall) +printToColor([](types.md) message, [](types.md) player_color, [](types.md#color) message_tint) | Print a message to a specific [Player Color](player-color.md). | [](types.md) | [](#printtocolor) +sendExternalMessage([](types.md) data) | Send a table to your external script editor, most likely Atom. This is for custom editor functionality. | [](types.md) | @@ -48,10 +48,10 @@ printToColor([](/types) message, [](/types) Copying a list of Objects the clipboard. Works with [paste(...)](#paste). +[](types.md) Copying a list of Objects the clipboard. Works with [paste(...)](#paste). !!!info "copy(object_list)" - * [](/types) **object_list**: A Table of in-game objects to be copied. + * [](types.md) **object_list**: A Table of in-game objects to be copied. * {>>This is similar to highlighting the objects in-game and copying them.<<} ``` Lua @@ -67,20 +67,20 @@ copy(object_list) ####destroyObject(...) -[](/types) Destroy an Object. +[](types.md) Destroy an Object. !!!info "destroyObject(obj)" - * [](/types) **obj**: The Object you wish to delete from the instance. + * [](types.md) **obj**: The Object you wish to delete from the instance. --- ####getObjectFromGUID(...) -[](/types) Returns Object by its GUID. Will return `nil` if this GUID doesn't currently exist. +[](types.md) Returns Object by its GUID. Will return `nil` if this GUID doesn't currently exist. !!!info "getObjectFromGUID(guid)" - * [](/types) **guid**: GUID of the Object to get a reference of. + * [](types.md) **guid**: GUID of the Object to get a reference of. * {>>GUID can be obtained by right clicking an object and going to Scripting.<<} * {>>In a script, it can be obtained from any Object by using .getGUID().<<} @@ -89,13 +89,13 @@ copy(object_list) ####group(...) -[](/types) Groups objects together, like how the `G` key does for players. It returns an object reference to the deck/stack formed. +[](types.md) Groups objects together, like how the `G` key does for players. It returns an object reference to the deck/stack formed. Not all objects CAN be grouped. If the G key won't work on them, neither will this function. !!!info "group(objects)" - * [](/types) **objects**: A list of objects to be grouped together. + * [](types.md) **objects**: A list of objects to be grouped together. ``` Lua function onLoad() @@ -115,13 +115,13 @@ end ####paste(...) -[](/types) Pastes Objects in-game that were copied to the in-game clipboard. Works with [copy(...)](#copy). +[](types.md) Pastes Objects in-game that were copied to the in-game clipboard. Works with [copy(...)](#copy). !!!info "paste(parameters)" - * [](/types) **parameters**: A Table containing instructions of where to spawn the Objects. - * [](/types#vector) **parameters.position**: Position of the first object to paste. + * [](types.md) **parameters**: A Table containing instructions of where to spawn the Objects. + * [](types.md#vector) **parameters.position**: Position of the first object to paste. * {>>Optional, defaults to {0, 3, 0}.<<} - * [](/types) **parameters.snap_to_grid**: If snap-to-grid is active on the spawned item/s. + * [](types.md) **parameters.snap_to_grid**: If snap-to-grid is active on the spawned item/s. * {>>Optional, defaults to false (off).<<} @@ -130,27 +130,27 @@ end ####spawnObject(...) -[](/types) Spawn an Object. View the [Spawnable Objects](/spawnableobjects) page for Objects that can be spawned. +[](types.md) Spawn an Object. View the [Spawnable Objects](spawnableobjects.md) page for Objects that can be spawned. -If you are spawning a **custom Object**, you should call [setCustomObject](object#setcustomobject) immediately after spawnObject to set its custom properties. +If you are spawning a **custom Object**, you should call [setCustomObject](object.md#setcustomobject) immediately after spawnObject to set its custom properties. !!!tip - Spawned Objects take a moment to be physically spawned into the game. The purpose of the callback functionality is to allow you to run additional actions after the Object has been initiated fully into the instance. You can also add a delay after spawning using a [Wait](wait) function. + Spawned Objects take a moment to be physically spawned into the game. The purpose of the callback functionality is to allow you to run additional actions after the Object has been initiated fully into the instance. You can also add a delay after spawning using a [Wait](wait.md) function. !!!info "spawnObject(parameters)" - * [](/types) **parameters**: A Table of parameters used to determine how spawnObject will act. - * [](/types) **parameters.type**: [Spawnable Object](/spawnableobjects) type. - * [](/types#vector) **parameters.position**: Position to place Object. + * [](types.md) **parameters**: A Table of parameters used to determine how spawnObject will act. + * [](types.md) **parameters.type**: [Spawnable Object](spawnableobjects.md) type. + * [](types.md#vector) **parameters.position**: Position to place Object. * {>>Optional, defaults to {x=0, y=3, z=0}.<<} - * [](/types#vector) **parameters.rotation**: Rotation of the Object. + * [](types.md#vector) **parameters.rotation**: Rotation of the Object. * {>>Optional, defaults to {x=0, y=0, z=0}<<} - * [](/types#vector) **parameters.scale**: Scale of the Object. + * [](types.md#vector) **parameters.scale**: Scale of the Object. * {>>Optional, defaults to {x=1, y=1, z=1}<<} - * [](/types) **parameters.sound**: If the spawned Object noise is played. + * [](types.md) **parameters.sound**: If the spawned Object noise is played. * {>>Optional, defaults to true.<<} - * [](/types) **parameters.snap_to_grid**: If snap-to-grid is active on the Object. + * [](types.md) **parameters.snap_to_grid**: If snap-to-grid is active on the Object. * {>>Optional, defaults to false.<<} - * [](/types#function) **parameters.callback_function**: The function to activate after the Object has finished spawning into the scene. + * [](types.md#function) **parameters.callback_function**: The function to activate after the Object has finished spawning into the scene. * {>>Optional, defaults to not being used.<<} * {>>A reference to the object spawned is always passed to callback_function. See the example for how to access it.<<} @@ -183,25 +183,25 @@ end ####spawnObjectJSON(...) -Spawns an Object using a JSON string. Works with [getJSON()](object#getjson). It works just like spawnObject, but instead of a `type`, you supply a `json` string. The other parameters will overwrite those in the JSON. +Spawns an Object using a JSON string. Works with [getJSON()](object.md#getjson). It works just like spawnObject, but instead of a `type`, you supply a `json` string. The other parameters will overwrite those in the JSON. !!!tip - Spawned Objects take a moment to be physically spawned into the game. The purpose of the callback functionality is to allow you to run additional actions after the Object has been initiated fully into the instance. You can also add a delay after spawning using a [Wait](wait) function. + Spawned Objects take a moment to be physically spawned into the game. The purpose of the callback functionality is to allow you to run additional actions after the Object has been initiated fully into the instance. You can also add a delay after spawning using a [Wait](wait.md) function. !!!info "spawnObjectJSON(parameters)" - * [](/types) **parameters**: A Table of parameters used to determine how spawnObjectJSON will act. - * [](/types) **parameters.json**: [getJSON()](object#getjson) string. - * [](/types#vector) **parameters.position**: Position to place Object. + * [](types.md) **parameters**: A Table of parameters used to determine how spawnObjectJSON will act. + * [](types.md) **parameters.json**: [getJSON()](object.md#getjson) string. + * [](types.md#vector) **parameters.position**: Position to place Object. * {>>Optional, defaults to JSON's value.<<} - * [](/types#vector) **parameters.rotation**: Rotation of the Object. + * [](types.md#vector) **parameters.rotation**: Rotation of the Object. * {>>Optional, defaults to JSON's value.<<} - * [](/types#vector) **parameters.scale**: Scale of the Object. + * [](types.md#vector) **parameters.scale**: Scale of the Object. * {>>Optional, defaults to JSON's value.<<} - * [](/types) **parameters.sound**: If the spawned Object noise is played. + * [](types.md) **parameters.sound**: If the spawned Object noise is played. * {>>Optional, defaults to JSON's value.<<} - * [](/types) **parameters.snap_to_grid**: If snap-to-grid is active on the Object. + * [](types.md) **parameters.snap_to_grid**: If snap-to-grid is active on the Object. * {>>Optional, defaults to JSON's value.<<} - * [](/types#function) **parameters.callback_function**: The function to activate after the Object has finished spawning into the scene. + * [](types.md#function) **parameters.callback_function**: The function to activate after the Object has finished spawning into the scene. * {>>Optional, defaults to not being used.<<} * {>>A reference to the object spawned is always passed to callback_function. See the example for how to access it.<<} @@ -235,14 +235,14 @@ end ####startLuaCoroutine(...) -[](/types) Start a coroutine. A coroutine is similar to a function, but has the unique ability to have its run paused until the next frame of the game using `coroutine.yield(0)`. +[](types.md) Start a coroutine. A coroutine is similar to a function, but has the unique ability to have its run paused until the next frame of the game using `coroutine.yield(0)`. !!!Attention You MUST return a 1 at the end of any coroutine or it will throw an error. !!!info "startLuaCoroutine(function_owner, function_name)" - * [](/types) **function_owner**: The Object that the function being called is on. Global is a valid target. - * [](/types) **function_name**: Name of the function being called as a coroutine. + * [](types.md) **function_owner**: The Object that the function being called is on. Global is a valid target. + * [](types.md) **function_name**: Name of the function being called as a coroutine. ``` Lua function onLoad() @@ -269,10 +269,10 @@ end ####stringColorToRGB(...) -[](/types) Converts a [Player Color](player-color) string into a Color Table for tinting. +[](types.md) Converts a [Player Color](player-color.md) string into a Color Table for tinting. !!!info "stringColorToRGB(player_color)" - * [](/types) **player_color** A String of a [Player Color](player-color). + * [](types.md) **player_color** A String of a [Player Color](player-color.md). ``` Lua printToAll("Blue message", stringColorToRGB("Blue")) @@ -304,11 +304,11 @@ printToAll("Blue message", stringColorToRGB("Blue")) ####broadcastToAll(...) -[](/types) Print an on-screen message to all Players. +[](types.md) Print an on-screen message to all Players. !!!info "broadcastToAll(message, message_tint)" - * [](/types) **message**: Message to display on-screen. - * [](/types#color) **message_tint**: A Table containing the RGB color tint for the text. + * [](types.md) **message**: Message to display on-screen. + * [](types.md#color) **message_tint**: A Table containing the RGB color tint for the text. ``` Lua msg = "Hello all." @@ -321,12 +321,12 @@ broadcastToAll(msg, rgb) ####broadcastToColor(...) -[](/types) Print an on-screen message to a specified Player and their in-game chat. +[](types.md) Print an on-screen message to a specified Player and their in-game chat. -!!!info "broadcastToColor(message, [player_color](player), message_tint)" - * [](/types) **message**: Message to display on-screen. - * [](/types) **player_color**: [Player Color](player-color) to receive the message. - * [](/types#color) **message_tint**: RGB color tint for the text. +!!!info "broadcastToColor(message, [player_color](player.md), message_tint)" + * [](types.md) **message**: Message to display on-screen. + * [](types.md) **player_color**: [Player Color](player-color.md) to receive the message. + * [](types.md#color) **message_tint**: RGB color tint for the text. ``` Lua msg = "Hello White." @@ -340,15 +340,15 @@ broadcastToColor(msg, color, rgb) ####log(...) -[](/types) Print information to the log. The log is a separate chat window in which you can also enter console commands. It is only visible to the host. +[](types.md) Print information to the log. The log is a separate chat window in which you can also enter console commands. It is only visible to the host. If a table is used for "element", the log will automatically display the key/value contents of it. !!!info "log(element, label, tag)" - * [](/types) **element**: The information you want placed into the log. - * [](/types) **label**: Text to be placed before the Var element is printed to the log. + * [](types.md) **element**: The information you want placed into the log. + * [](types.md) **label**: Text to be placed before the Var element is printed to the log. * {>>Optional, defaults to an empty String. Empty Strings are not displayed.<<} - * [](/types) **tag**: Name that is usable to categorize log entries. (See: [logStyle](logstyle)) + * [](types.md) **tag**: Name that is usable to categorize log entries. (See: [logStyle](#logstyle)) * {>>Optional, defaults to an empty String. Empty Strings are not displayed.<<} @@ -361,15 +361,15 @@ log(getAllObjects(), "All Objects:", "table") ####logStyle(...) -[](/types) Set style options for the specified tag type for the log. This can also be set in the system console with the "log_style_tag" command. +[](types.md) Set style options for the specified tag type for the log. This can also be set in the system console with the "log_style_tag" command. !!!info "logStyle(tag, tint, prefix, postfix)" - * [](/types) **tag**: A String of the log's tag. - * [](/types#color) **tint**: RGB value to tint the log entry's text. + * [](types.md) **tag**: A String of the log's tag. + * [](types.md#color) **tint**: RGB value to tint the log entry's text. * {>>String color will also work. Example: "Red"<<} - * [](/types) **prefix**: Text to place before this type of log entry. + * [](types.md) **prefix**: Text to place before this type of log entry. * {>>Optional, defaults to an empty String. Empty Strings are not displayed.<<} - * [](/types) **postfix**: Text to place after this type of log entry. + * [](types.md) **postfix**: Text to place after this type of log entry. * {>>Optional, defaults to an empty String. Empty Strings are not displayed.<<} ``` Lua @@ -384,10 +384,10 @@ end ####print(...) -[](/types) Print a string into chat that only the host is able to see. Used for debugging scripts. +[](types.md) Print a string into chat that only the host is able to see. Used for debugging scripts. !!!info "print(message)" - * [](/types) **message**: Text to print into the chat log. + * [](types.md) **message**: Text to print into the chat log. --- @@ -395,11 +395,11 @@ end ####printToAll(...) -[](/types) Print a message into the in-game chat of all connected players. +[](types.md) Print a message into the in-game chat of all connected players. !!!info "printToAll(message, message_tint)" - * [](/types) **message**: Message to place into players' in-game chats. - * [](/types#color) **message_tint**: RGB values for the text's color tint. + * [](types.md) **message**: Message to place into players' in-game chats. + * [](types.md#color) **message_tint**: RGB values for the text's color tint. ``` Lua printToAll("Hello World!", {r=1,g=0,b=0}) @@ -410,12 +410,12 @@ printToAll("Hello World!", {r=1,g=0,b=0}) ####printToColor(...) -[](/types) Print a message to the in-game chat of a specific player. +[](types.md) Print a message to the in-game chat of a specific player. -!!!info "printToColor(message, [player_color](player-color), message_tint)" - * [](/types) **message**: Message to place into the player's in-game chat. - * [](/types) **player_color**: [Player Color](player-color) of the player that will receive the message. - * [](/types#color) **message_tint**: RGB values for the text's color tint. +!!!info "printToColor(message, [player_color](player-color.md), message_tint)" + * [](types.md) **message**: Message to place into the player's in-game chat. + * [](types.md) **player_color**: [Player Color](player-color.md) of the player that will receive the message. + * [](types.md#color) **message_tint**: RGB values for the text's color tint. ``` Lua printToColor("Hello Red.", "Red", {r=1,g=0,b=0}) diff --git a/docs/clock.md b/docs/clock.md index 35dcad88..f72ebe43 100644 --- a/docs/clock.md +++ b/docs/clock.md @@ -9,11 +9,11 @@ Example Usage: `self.Clock.pauseStart()` ##Member Variables -Like [Object member variables](object#member-variables), Clocks have their own member variable. +Like [Object member variables](object.md#member-variables), Clocks have their own member variable. Variable | Description | Type -- | -- | :-- -paused | If the clock timer is paused. | [](/types) +paused | If the clock timer is paused. | [](types.md) --- @@ -23,11 +23,11 @@ Variable | Description | Type Function Name | Description | Return |   -- | -- | -- | --: -getValue() | Current time in stopwatch or timer mode. Clock mode returns 0. This function acts the same as [Object's getValue()](object#getvalue). | [](/types) -pauseStart() | Pauses/resumes a Clock in stopwatch or timer mode. | [](/types) -setValue(Int seconds) | Switches clock to timer and sets countdown time. This function acts the same as [Object's setValue()](object#setvalue). | [](/types) | [](#setvalue) -showCurrentTime() | Switches clock to display current time. It will clear any stopwatch or timer. | [](/types) -startStopwatch() | Switches clock to stopwatch, setting time to 0. It will reset time if already in stopwatch mode. | [](/types) +getValue() | Current time in stopwatch or timer mode. Clock mode returns 0. This function acts the same as [Object's getValue()](object.md#getvalue). | [](types.md) +pauseStart() | Pauses/resumes a Clock in stopwatch or timer mode. | [](types.md) +setValue(Int seconds) | Switches clock to timer and sets countdown time. This function acts the same as [Object's setValue()](object.md#setvalue). | [](types.md) | [](#setvalue) +showCurrentTime() | Switches clock to display current time. It will clear any stopwatch or timer. | [](types.md) +startStopwatch() | Switches clock to stopwatch, setting time to 0. It will reset time if already in stopwatch mode. | [](types.md) --- @@ -35,11 +35,11 @@ setValue(Int seconds) | Switches clock to timer and sets countdown time. This fu ###setValue(...) -[](/types) Set the timer to display a number of seconds. This function acts the same as [Object's setValue()](object#setvalue). If the Clock is not in timer mode, it will be switched. If it is in timer mode, it will be paused and the remaining time will be changed. This will not start the countdown on its own. +[](types.md) Set the timer to display a number of seconds. This function acts the same as [Object's setValue()](object.md#setvalue). If the Clock is not in timer mode, it will be switched. If it is in timer mode, it will be paused and the remaining time will be changed. This will not start the countdown on its own. !!!info "setValue(seconds)" - * [](/types) **seconds**: How many seconds will be counted down. + * [](types.md) **seconds**: How many seconds will be counted down. ``` Lua self.Clock.setValue(30) diff --git a/docs/component.md b/docs/component.md index c316f465..05886248 100644 --- a/docs/component.md +++ b/docs/component.md @@ -57,9 +57,9 @@ These can be used on either a regular in-game Object or an in-game Objects `Game Command Name | Description | Return               -- | -- | -- -getComponent([](/types) name) | Obtains a component reference from an Object, by name. | **Component** -getComponents([](/types) optional_name) | Returns all components on a game object. The name is an optional component name to narrow results with. | **Component** in [](/types) -name | Returns the name of the given Object or GameObject. | [](/types) +getComponent([](types.md) name) | Obtains a component reference from an Object, by name. | **Component** +getComponents([](types.md) optional_name) | Returns all components on a game object. The name is an optional component name to narrow results with. | **Component** in [](types.md) +name | Returns the name of the given Object or GameObject. | [](types.md) ###GameObject Children Commands @@ -67,10 +67,10 @@ When you access an in-game Object normally with Lua, it is always the "parent" o Command Name | Description | Return                 -- | -- | -- -getComponentInChildren([](/types) name) | Obtains a component reference from a child GameObject, by name. | **Component** -getComponentsInChildren([](/types) optional_name) | Returns all components of all child GameObjects attached to this parent Object. The name is an optional component name to narrow results with. | **Component** in [](/types) -getChild([](/types) name) | Obtains a reference to the GameObject of a child object. The name is the name of the GameObject. | **GameObject** -getChildren() | Returns a list of all GameObjects attached under the parent GameObject. | **GameObject** in [](/types) +getComponentInChildren([](types.md) name) | Obtains a component reference from a child GameObject, by name. | **Component** +getComponentsInChildren([](types.md) optional_name) | Returns all components of all child GameObjects attached to this parent Object. The name is an optional component name to narrow results with. | **Component** in [](types.md) +getChild([](types.md) name) | Obtains a reference to the GameObject of a child object. The name is the name of the GameObject. | **GameObject** +getChildren() | Returns a list of all GameObjects attached under the parent GameObject. | **GameObject** in [](types.md) ###Component Commands These commands are used on the Components of objects to find or modify the values of their variables. The values will depend on which variable is being changed. They are usually System.Int32 (an Integer), System.Boolean (a Bool) or UnityEngine.Vector3 (a Vector). These are all used on Components. @@ -78,7 +78,7 @@ These commands are used on the Components of objects to find or modify the value Command Name | Description | Return               -- | -- | -- game_object | Returns the GameObject the component is on. | **GameObject** -get([](/types) varName) | Obtains the value of a given Variable on a Component. | [](/types) -getVars() | Obtains a table containing Variable names along with the type of value they take. | [](/types) -set([](/types) varName, [](/types) value) | Sets a value to a Variable on the Component | [](/types) -name | Returns the name of the given Object or GameObject. | [](/types) +get([](types.md) varName) | Obtains the value of a given Variable on a Component. | [](types.md) +getVars() | Obtains a table containing Variable names along with the type of value they take. | [](types.md) +set([](types.md) varName, [](types.md) value) | Sets a value to a Variable on the Component | [](types.md) +name | Returns the name of the given Object or GameObject. | [](types.md) diff --git a/docs/counter.md b/docs/counter.md index b62b1198..e70c4b12 100644 --- a/docs/counter.md +++ b/docs/counter.md @@ -6,8 +6,8 @@ The Counter is an in-game Object of a digital counter. It has its own class, Cou Function Name | Description | Return -- | -- | --: -clear() | Resets Counter to 0. | [](/types) -decrement() | Reduces Counter's value by 1. | [](/types) -getValue() | Returns Int of the current value displayed by the Counter. This function acts the same as [Object's getValue()](object#getvalue). | [](/types) -increment() | Increases Counter's value by 1. | [](/types) -setValue() | Sets the current value of the Counter. This function acts the same as [Object's setValue()](object#setvalue). | [](/types) +clear() | Resets Counter to 0. | [](types.md) +decrement() | Reduces Counter's value by 1. | [](types.md) +getValue() | Returns Int of the current value displayed by the Counter. This function acts the same as [Object's getValue()](object.md#getvalue). | [](types.md) +increment() | Increases Counter's value by 1. | [](types.md) +setValue() | Sets the current value of the Counter. This function acts the same as [Object's setValue()](object.md#setvalue). | [](types.md) diff --git a/docs/event.md b/docs/event.md index 211c5e28..2f125f65 100644 --- a/docs/event.md +++ b/docs/event.md @@ -9,32 +9,32 @@ These are functions which are triggered by an event taking place in-game. They w Function Name | Description |   -- | -- | -- -filterObjectEnterContainer([](/types) container, [](/types) enter_object) | Called when an object attempts to enter any container. The object is prevented from entering unless "true" is returned. | [](#filterobjectentercontainer) -onChat([](/types) message, [](/types) sender) | Called when a chat message is sent in game chat. | [](#onchat) -onExternalMessage([](/types) data) | Called when an external script editor (like [Atom](atom)) sends a message back to the game. Used for custom editor functionality. | [](#onexternalmessage) +filterObjectEnterContainer([](types.md) container, [](types.md) enter_object) | Called when an object attempts to enter any container. The object is prevented from entering unless "true" is returned. | [](#filterobjectentercontainer) +onChat([](types.md) message, [](types.md) sender) | Called when a chat message is sent in game chat. | [](#onchat) +onExternalMessage([](types.md) data) | Called when an external script editor (like [Atom](atom.md)) sends a message back to the game. Used for custom editor functionality. | [](#onexternalmessage) onFixedUpdate() | Called **every physics tick** (90 times a second). This is a frame independent onUpdate(). | [](#onfixedupdate) -onLoad([](/types) save_state) | Called when a game save is finished loading every Object. It is where most setup code will go. | [](#onload) -onObjectDestroy([](/types) dying_object) | Called whenever any object is destroyed. | [](#onobjectdestroy) -onObjectDrop([](/types) player_color, [](/types) dropped_object) | Called whenever any object is dropped by a player. | [](#onobjectdrop) -onObjectEnterScriptingZone([](/types) zone, [](/types) enter_object) | Called when any object enters any scripting zone. | [](#onobjectenterscriptingzone) -onObjectEnterContainer([](/types) container, [](/types) enter_object) | Called when any object enters any container. Includes decks | [](#onobjectentercontainer) -onObjectLeaveScriptingZone([](/types) zone, [](/types) enter_object) | Called when any object leaves any scripting zone. | [](#onobjectleavescriptingzone) -onObjectLeaveContainer([](/types) container, [](/types) leave_object) | Called when any object leaves any container. | [](#onobjectleavecontainer) -onObjectLoopingEffect([](/types) loop_object, [](/types) index) | Called whenever the looping effect of an [AssetBundle](assetbundle) is activated. | [](#onobjectloopingeffect) -onObjectPeek([](/types) object, [](/types) player) | Called when a player using peek to look under an Object. | [](#onobjectpeek) -onObjectPickUp([](/types) player_color, [](/types) picked_up_object) | Called whenever a Player picks up an Object. | [](#onobjectpickup) -onObjectRandomize([](/types) randomize_object, [](/types) player_color) | Called when an Object is randomized. Like when shuffling a deck or shaking dice. | [](#onobjectrandomize) -onObjectSearchEnd([](/types) obj, [](/types) player_color) | Called when a search is finished on any container. | [](#onobjectsearchend) -onObjectSearchStart([](/types) obj, [](/types) player_color) | Called when a search is started on any container. | [](#onobjectsearchstart) -onObjectSpawn([](/types) spawn_object) | Called when any Object is spawned/created. | [](#onobjectspawn) -onObjectTriggerEffect([](/types) trigger_object, [](/types) index) | Called whenever the trigger effect of an [AssetBundle](assetbundle) is activated. | [](#onobjecttriggereffect) -onPlayerChangeColor([](/types) player_color) | Called when a player changes color or selects it for the first time. It also returns `"Grey"` if they disconnect. | [](#onplayerchangecolor) -onPlayerConnect([](/types) person) | Called when a [Player](player) connects to a game. | [](#onplayerconnect) -onPlayerDisconnect([](/types) person) | Called when a [Player](player) disconnects from a game. | [](#onplayerdisconnect) -onPlayerTurn([](/types) player_color) | Called at the start of a player's turn when using the in-game turn system. | [](#onplayerturn) +onLoad([](types.md) save_state) | Called when a game save is finished loading every Object. It is where most setup code will go. | [](#onload) +onObjectDestroy([](types.md) dying_object) | Called whenever any object is destroyed. | [](#onobjectdestroy) +onObjectDrop([](types.md) player_color, [](types.md) dropped_object) | Called whenever any object is dropped by a player. | [](#onobjectdrop) +onObjectEnterScriptingZone([](types.md) zone, [](types.md) enter_object) | Called when any object enters any scripting zone. | [](#onobjectenterscriptingzone) +onObjectEnterContainer([](types.md) container, [](types.md) enter_object) | Called when any object enters any container. Includes decks | [](#onobjectentercontainer) +onObjectLeaveScriptingZone([](types.md) zone, [](types.md) enter_object) | Called when any object leaves any scripting zone. | [](#onobjectleavescriptingzone) +onObjectLeaveContainer([](types.md) container, [](types.md) leave_object) | Called when any object leaves any container. | [](#onobjectleavecontainer) +onObjectLoopingEffect([](types.md) loop_object, [](types.md) index) | Called whenever the looping effect of an [AssetBundle](assetbundle.md) is activated. | [](#onobjectloopingeffect) +onObjectPeek([](types.md) object, [](types.md) player) | Called when a player using peek to look under an Object. | [](#onobjectpeek) +onObjectPickUp([](types.md) player_color, [](types.md) picked_up_object) | Called whenever a Player picks up an Object. | [](#onobjectpickup) +onObjectRandomize([](types.md) randomize_object, [](types.md) player_color) | Called when an Object is randomized. Like when shuffling a deck or shaking dice. | [](#onobjectrandomize) +onObjectSearchEnd([](types.md) obj, [](types.md) player_color) | Called when a search is finished on any container. | [](#onobjectsearchend) +onObjectSearchStart([](types.md) obj, [](types.md) player_color) | Called when a search is started on any container. | [](#onobjectsearchstart) +onObjectSpawn([](types.md) spawn_object) | Called when any Object is spawned/created. | [](#onobjectspawn) +onObjectTriggerEffect([](types.md) trigger_object, [](types.md) index) | Called whenever the trigger effect of an [AssetBundle](assetbundle.md) is activated. | [](#onobjecttriggereffect) +onPlayerChangeColor([](types.md) player_color) | Called when a player changes color or selects it for the first time. It also returns `"Grey"` if they disconnect. | [](#onplayerchangecolor) +onPlayerConnect([](types.md) person) | Called when a [Player](player.md) connects to a game. | [](#onplayerconnect) +onPlayerDisconnect([](types.md) person) | Called when a [Player](player.md) disconnects from a game. | [](#onplayerdisconnect) +onPlayerTurn([](types.md) player_color) | Called at the start of a player's turn when using the in-game turn system. | [](#onplayerturn) onSave() | Called whenever your game is saved. | [](#onsave) -onScriptingButtonDown([](/types) index, [](/types) player_color) | Called when a scripting button (numpad by default) is pressed. The index range that is returned is 1-10. | [](#onscriptingbuttondown) -onScriptingButtonUp([](/types) index, [](/types) player_color) | Called when a scripting button (numpad by default) is released. The index range that is returned is 1-10. | [](#onscriptingbuttonup) +onScriptingButtonDown([](types.md) index, [](types.md) player_color) | Called when a scripting button (numpad by default) is pressed. The index range that is returned is 1-10. | [](#onscriptingbuttondown) +onScriptingButtonUp([](types.md) index, [](types.md) player_color) | Called when a scripting button (numpad by default) is released. The index range that is returned is 1-10. | [](#onscriptingbuttonup) onUpdate() | Called **every frame**. | [](#onupdate) @@ -51,17 +51,17 @@ These are functions which are triggered by an event taking place in-game. They o Function Name | Description |   -- | -- | -- -filterObjectEnter([](/types) obj) | Called when an object attempts to enter this object. The object is prevented from entering unless "true" is returned. | [](#filterobjectenter) -onCollisionEnter([](/types) collision_info) | Called when an Object starts colliding with the Object the function is on. | [](#oncollisionenter) -onCollisionExit([](/types) collision_info) | Called when an Object stops colliding with the Object the function is on. | [](#oncollisionexit) -onCollisionStay([](/types) collision_info) | Called **every frame** that an Object is colliding with the Object this function is on. | [](#oncollisionstay) +filterObjectEnter([](types.md) obj) | Called when an object attempts to enter this object. The object is prevented from entering unless "true" is returned. | [](#filterobjectenter) +onCollisionEnter([](types.md) collision_info) | Called when an Object starts colliding with the Object the function is on. | [](#oncollisionenter) +onCollisionExit([](types.md) collision_info) | Called when an Object stops colliding with the Object the function is on. | [](#oncollisionexit) +onCollisionStay([](types.md) collision_info) | Called **every frame** that an Object is colliding with the Object this function is on. | [](#oncollisionstay) onDestroy() | Called when an Object it is on is destroyed. | [](#ondestroy) -onDrop([](/types) player_color) | Called when a player releases an Object after picking it up. | [](#ondrop) -onPeek([](/types) player) | Called when a player using peek to look under this Object. | [](#onpeek) -onPickUp([](/types) player_color) | Called when a player picks up an Object. | [](#onpickup) -onRandomize([](/types) player_color) | Called when this Object is randomized. Like when shuffling a deck or shaking dice. | [](#onrandomize) -onSearchEnd([](/types) player_color) | Called when a player finishes searches this Object. | [](#onsearchend) -onSearchStart([](/types) player_color) | Called when a player starts searching this Object. | [](#onsearchstart) +onDrop([](types.md) player_color) | Called when a player releases an Object after picking it up. | [](#ondrop) +onPeek([](types.md) player) | Called when a player using peek to look under this Object. | [](#onpeek) +onPickUp([](types.md) player_color) | Called when a player picks up an Object. | [](#onpickup) +onRandomize([](types.md) player_color) | Called when this Object is randomized. Like when shuffling a deck or shaking dice. | [](#onrandomize) +onSearchEnd([](types.md) player_color) | Called when a player finishes searches this Object. | [](#onsearchend) +onSearchStart([](types.md) player_color) | Called when a player starts searching this Object. | [](#onsearchstart) @@ -84,8 +84,8 @@ onSearchStart([](/types) player_color) | Calle This function is called when a message is sent through the in-game chat. It does not trigger when global chat messages are sent. Using `#!lua return false` inside of this function prevents the chat message which triggered it to be suppressed. !!!info "onChat(message, sender)" - * [](/types) **message**: Chat message which triggered the function. - * [](/types) **sender**: Player which sent the chat message. + * [](types.md) **message**: Chat message which triggered the function. + * [](types.md) **sender**: Player which sent the chat message. ``` Lua function onChat(message, player) @@ -99,10 +99,10 @@ end ###onExternalMessage(...) -This function is called when an external script editor (like [Atom](atom)) sends a message back to the game. Used for custom editor functionality. +This function is called when an external script editor (like [Atom](atom.md)) sends a message back to the game. Used for custom editor functionality. !!!info "onExternalMessage(data)" - * [](/types) **data**: The data returned by the external editor into the game. + * [](types.md) **data**: The data returned by the external editor into the game. ``` Lua function onExternalMessage(data) @@ -132,7 +132,7 @@ end This function is called when a game save is finished loading every Object. This is where most setup code will go. The fast-forward and rewind feature will also cause this function to activate. If this function is in an Object's script and that Object is spawned, like by removing it from a container, it too will trigger onLoad(). !!!info "onLoad(save_state)" - * [](/types) **save_state**: The encoded string containing any save_state (saved) data. + * [](types.md) **save_state**: The encoded string containing any save_state (saved) data. * {>>If there is no data saved, this returns an empty String.<<} ``` Lua @@ -170,7 +170,7 @@ end Called whenever any object is destroyed. The dying Object has 1 frame left to live. This event fires immediately before the dying Object’s `onDestroy()` but their lifetime is the same final frame. !!!info "onObjectDestroy(dying_object)" - * [](/types) **dying_object**: The object that was destroyed. + * [](types.md) **dying_object**: The object that was destroyed. ``` Lua function onObjectDestroy(destroyedObj) @@ -186,8 +186,8 @@ end Called whenever any object is dropped by a player. !!!info "onObjectDrop(player_color, dropped_object)" - * [](/types) **dropped_object**: The Object in game which was dropped. - * [](/types) **player_color**: [Player Color](player-color) of the Player who dropped the Object. + * [](types.md) **player_color**: [Player Color](player-color) of the Player who dropped the Object. + * [](types.md) **dropped_object**: The Object in game which was dropped. ``` Lua function onObjectDrop(colorName, obj) @@ -203,8 +203,8 @@ end Called when any object enters any scripting zone. !!!info "onObjectEnterScriptingZone(zone, enter_object)" - * [](/types) **zone**: The Object of the scripting zone. - * [](/types) **enter_object**: The Object triggering the function. + * [](types.md) **zone**: The Object of the scripting zone. + * [](types.md) **enter_object**: The Object triggering the function. ``` Lua function onObjectEnterScriptingZone(zone, obj) @@ -220,8 +220,8 @@ end Called when any object enters any container. Includes Objects entering decks. !!!info "onObjectEnterContainer(container, enter_object)" - * [](/types) **container**: Container the Object entered. - * [](/types) **enter_object**: Object that entered the container. + * [](types.md) **container**: Container the Object entered. + * [](types.md) **enter_object**: Object that entered the container. ``` Lua function onObjectEnterContainer(bag, obj) @@ -239,8 +239,8 @@ end Called when any object leaves any scripting zone. !!!info "onObjectLeaveScriptingZone(zone, enter_object)" - * [](/types) **zone**: The Object of the scripting zone. - * [](/types) **enter_object**: The Object triggering the function. + * [](types.md) **zone**: The Object of the scripting zone. + * [](types.md) **enter_object**: The Object triggering the function. ``` Lua function onObjectLeaveScriptingZone(zone, obj) @@ -256,8 +256,8 @@ end Called when any object leaves any container. !!!info "onObjectLeaveContainer(container, leave_object)" - * [](/types) **container**: Container the object left. - * [](/types) **leave_object**: Object that left the container. + * [](types.md) **container**: Container the object left. + * [](types.md) **leave_object**: Object that left the container. ``` Lua function onObjectLeaveContainer(bag, obj) @@ -271,11 +271,11 @@ end ###onObjectLoopingEffect(...) -Called whenever the looping effect of an [AssetBundle](assetbundle) is activated. +Called whenever the looping effect of an [AssetBundle](assetbundle.md) is activated. !!!info "onObjectLoopingEffect(loop_object, index)" - * [](/types) **loop_object**: AssetBundle which had its loop activated. - * [](/types) **index**: Index number for the loop activated. + * [](types.md) **loop_object**: AssetBundle which had its loop activated. + * [](types.md) **index**: Index number for the loop activated. ``` Lua function onObjectLoopingEffect(obj, index) @@ -292,8 +292,8 @@ end Called when a player using peek to look under an Object. !!!info "onObjectPeek(object, player)" - * [](/types) **object**: A reference to the Object which was peeked at. - * [](/types) **player**: Name of the [Player Color](player-color) that peeked. + * [](types.md) **object**: A reference to the Object which was peeked at. + * [](types.md) **player**: Name of the [Player Color](player-color.md) that peeked. @@ -314,8 +314,8 @@ end Called whenever a Player picks up an Object. !!!info "onObjectPickUp(player_color, picked_up_object)" - * [](/types) **player_color**: [Player Color](player-color) of the Player who picked up the object. - * [](/types) **picked_up_object**: The Object in game which was picked up. + * [](types.md) **player_color**: [Player Color](player-color.md) of the Player who picked up the object. + * [](types.md) **picked_up_object**: The Object in game which was picked up. ``` Lua function onObjectPickUp(colorName, obj) @@ -331,8 +331,8 @@ end Called when an Object is randomized. Like when shuffling a deck or shaking dice. !!!info "onObjectRandomize(randomize_object, player_color)" - * [](/types) **spawn_object**: The Object which triggered this function. - * [](/types) **player_color**: [Player Color](player-color) of the player who triggered the function. + * [](types.md) **spawn_object**: The Object which triggered this function. + * [](types.md) **player_color**: [Player Color](player-color.md) of the player who triggered the function. @@ -350,8 +350,8 @@ end Called when a search is finished on any container. !!!info "onObjectSearchEnd(obj, player_color)" -* [](/types) **obj**: The Object which was searched. -* [](/types) **player_color**: [Player Color](player-color) of the player who triggered the function. +* [](types.md) **obj**: The Object which was searched. +* [](types.md) **player_color**: [Player Color](player-color.md) of the player who triggered the function. --- @@ -361,8 +361,8 @@ Called when a search is finished on any container. Called when a search is started on any container. !!!info "onObjectSearchStart(obj, player_color)" -* [](/types) **obj**: The Object which was searched. -* [](/types) **player_color**: [Player Color](player-color) of the player who triggered the function. +* [](types.md) **obj**: The Object which was searched. +* [](types.md) **player_color**: [Player Color](player-color.md) of the player who triggered the function. --- @@ -372,7 +372,7 @@ Called when a search is started on any container. Called when any Object is spawned/created. !!!info "onObjectSpawn(spawn_object)" - * [](/types) **spawn_object**: The Object which triggered this function. + * [](types.md) **spawn_object**: The Object which triggered this function. ``` Lua function onObjectSpawn(obj) @@ -385,11 +385,11 @@ end ###onObjectTriggerEffect(...) -Called whenever the trigger effect of an [AssetBundle](assetbundle) is activated. +Called whenever the trigger effect of an [AssetBundle](assetbundle.md) is activated. !!!info "onObjectTriggerEffect(loop_object, index)" - * [](/types) **loop_object**: AssetBundle which had its trigger activated. - * [](/types) **index**: Index number for the trigger activated. + * [](types.md) **loop_object**: AssetBundle which had its trigger activated. + * [](types.md) **index**: Index number for the trigger activated. ``` Lua function onObjectTriggerEffect(obj, index) @@ -407,7 +407,7 @@ end Called when a player changes color or selects it for the first time. It also returns `"Grey"` if they disconnect. !!!info "onPlayerChangeColor(player_color)" - * [](/types) **player_color**: [Player Color](player-color) of the player who triggered the function. + * [](types.md) **player_color**: [Player Color](player-color.md) of the player who triggered the function. ``` Lua function onPlayerChangeColor(color) @@ -420,20 +420,20 @@ end ###onPlayerConnect(...) -Called when a [Player](player) connects to a game. +Called when a [Player](player.md) connects to a game. !!!info "onPlayerConnect(person)"" - * [](/types) **person**: Player reference to who connected. + * [](types.md) **person**: Player reference to who connected. --- ###onPlayerDisconnect(...) -Called when a [Player](player) disconnects from a game. +Called when a [Player](player.md) disconnects from a game. !!!info "onPlayerDisconnect(person)"" - * [](/types) **person**: Player reference to who disconnected. + * [](types.md) **person**: Player reference to who disconnected. --- @@ -442,7 +442,7 @@ Called when a [Player](player) disconnects from a game. Called at the start of a player's turn when using the in-game turn system. !!!info "onPlayerTurn(player_color)" - * [](/types) **player_color**: [Player Color](player-color) of the player who's turn is starting. + * [](types.md) **player_color**: [Player Color](player-color.md) of the player who's turn is starting. ``` Lua function onPlayerTurn(color) @@ -455,7 +455,7 @@ end ###onSave() -This is called whenever the game saves, either manually or by auto-save. This will work in both a Global script, and an Object script. It is used to allow information to persist through saving/loading, for example, to let your script remember its data previously after hitting the Undo or Redo button. By placing script information into a Lua table, then encoding that data into [JSON](event#json), you are able to save information about the script's current state onto the script's parent, in the form of a string. You can also return a string value in this function to stash it. +This is called whenever the game saves, either manually or by auto-save. This will work in both a Global script, and an Object script. It is used to allow information to persist through saving/loading, for example, to let your script remember its data previously after hitting the Undo or Redo button. By placing script information into a Lua table, then encoding that data into [JSON](#json), you are able to save information about the script's current state onto the script's parent, in the form of a string. You can also return a string value in this function to stash it. !!!important When using `onSave()`, information is saved into the save file you are using. Using *Save & Apply* does NOT cause it to record data, only overwriting your save will update what information `onSave()` is trying to record. @@ -482,8 +482,8 @@ Check the [`onLoad()`](#onload) section for how to load that stored JSON informa Called when a scripting button (numpad by default) is pressed. The index range that is returned is 1-10. !!!info "onScriptingButtonDown(index, player_color)" - * [](/types) **index**: Index number, representing which key was pressed. - * [](/types) **player_color**: [Player Color](player-color) of the player who triggered the function. + * [](types.md) **index**: Index number, representing which key was pressed. + * [](types.md) **player_color**: [Player Color](player-color.md) of the player who triggered the function. ``` Lua function onScriptingButtonDown(index, color) @@ -498,8 +498,8 @@ end Called when a scripting button (numpad by default) is released. The index range that is returned is 1-10. !!!info "onScriptingButtonUp(index, player_color)" - * [](/types) **index**: Index number, representing which key was released. - * [](/types) **player_color**: [Player Color](player-color) of the player who triggered the function. + * [](types.md) **index**: Index number, representing which key was released. + * [](types.md) **player_color**: [Player Color](player-color.md) of the player who triggered the function. ``` Lua function onScriptingButtonUp(index, color) @@ -538,10 +538,10 @@ end This function is called when an Object starts colliding with the Object the function is on. Does not work in Global. !!!info "onCollisionEnter(collision_info)" - * [](/types) **collision_info**: A Table containing data on colliding object. - * [](/types) **collision_info.*collision_object***: Object coming into contact with `self`. - * [](/types) **collision_info.*contact_points***: Sub-table full of the Vectors where contact took place. - * [](/types#vector) **collision_info.*relative_velocity***: Direction and magnitude at the time of collision. + * [](types.md) **collision_info**: A Table containing data on colliding object. + * [](types.md) **collision_info.*collision_object***: Object coming into contact with `self`. + * [](types.md) **collision_info.*contact_points***: Sub-table full of the Vectors where contact took place. + * [](types.md#vector) **collision_info.*relative_velocity***: Direction and magnitude at the time of collision. ``` Lua -- Example Usage @@ -568,10 +568,10 @@ end This function is called when an Object stops colliding with the Object the function is on. Does not work in Global. !!!info "onCollisionExit(collision_info)" - * [](/types) **collision_info**: A Table containing data on colliding object. - * [](/types) **collision_info.*collision_object***: Object leaving contact with `self`. - * [](/types) **collision_info.*contact_points***: Sub-table full of the Vectors where contact last broke off. - * [](/types#vector) **collision_info.*relative_velocity***: Direction and magnitude of the departing Object. + * [](types.md) **collision_info**: A Table containing data on colliding object. + * [](types.md) **collision_info.*collision_object***: Object leaving contact with `self`. + * [](types.md) **collision_info.*contact_points***: Sub-table full of the Vectors where contact last broke off. + * [](types.md#vector) **collision_info.*relative_velocity***: Direction and magnitude of the departing Object. ``` Lua -- Example Usage @@ -601,10 +601,10 @@ This function is called **every frame** that an Object is colliding with the Obj This is a very expensive function and can easily slow/crash your game if misused. Use with caution. !!!info "onCollisionExit(collision_info)" - * [](/types) **collision_info**: A Table containing data on colliding object. - * [](/types) **collision_info.*collision_object***: Object coming into contact with `self`. - * [](/types) **collision_info.*contact_points***: Sub-table full of the Vectors where contact is taking place. - * [](/types#vector) **collision_info.*relative_velocity***: Direction and magnitude of the Object, currently. + * [](types.md) **collision_info**: A Table containing data on colliding object. + * [](types.md) **collision_info.*collision_object***: Object coming into contact with `self`. + * [](types.md) **collision_info.*contact_points***: Sub-table full of the Vectors where contact is taking place. + * [](types.md#vector) **collision_info.*relative_velocity***: Direction and magnitude of the Object, currently. ``` Lua -- Example Usage @@ -628,7 +628,7 @@ end ###onDestroy() -This function is called when an [Object](object) it is on is destroyed. When `onDestroy()` is called, the Object has one frame left to live but its recommended to avoid using it as a reference here. This event fires immediately after [onObjectDestroy()](#onobjectdestroy) but their lifetime is the same final frame. Does not work in Global. +This function is called when an [Object](object.md) it is on is destroyed. When `onDestroy()` is called, the Object has one frame left to live but its recommended to avoid using it as a reference here. This event fires immediately after [onObjectDestroy()](#onobjectdestroy) but their lifetime is the same final frame. Does not work in Global. ``` Lua function onDestroy() @@ -640,10 +640,10 @@ end ###onDrop(...) -This function is called when this [Object](object) is dropped. Does not work in Global. +This function is called when this [Object](object.md) is dropped. Does not work in Global. !!!info "onDrop(player_color)" - * [](/types) **player_color**: [Player Color](player-color) of the Player. + * [](types.md) **player_color**: [Player Color](player-color.md) of the Player. ``` Lua function onDrop(color) @@ -659,7 +659,7 @@ end Called when an object attempts to enter this object. The object is prevented from entering unless "true" is returned. !!!info "filterObjectEnter(obj)" - * [](/types) **obj**: The object that has tried to enter the object this script is attached to. + * [](types.md) **obj**: The object that has tried to enter the object this script is attached to. ``` Lua function filterObjectEnter(obj) @@ -676,7 +676,7 @@ end Called when a player using peek to look under an Object. !!!info "onPeek(player)" - * [](/types) **player**: Name of the [Player Color](player-color) that peeked. + * [](types.md) **player**: Name of the [Player Color](player-color.md) that peeked. ``` Lua @@ -694,7 +694,7 @@ end Called when a player picks up an Object. !!!info "onPickUp(player_color)" - * [](/types) **player_color**: [Player Color](player-color) of the Player. + * [](types.md) **player_color**: [Player Color](player-color.md) of the Player. ``` Lua function onPickUp(color) @@ -711,7 +711,7 @@ end Called when an Object is randomized. Like when shuffling a deck or shaking dice. !!!info "onRandomize(player_color)" - * [](/types) **player_color**: [Player Color](player-color) of the player who triggered the function. + * [](types.md) **player_color**: [Player Color](player-color.md) of the player who triggered the function. ``` Lua @@ -731,8 +731,8 @@ end Called when a player first searches this Object. -!!!info "onSearchEnd([](/types) player_color)" - * [](/types) **player_color**: [Player Color](player-color) of the Player. +!!!info "onSearchEnd([](types.md) player_color)" + * [](types.md) **player_color**: [Player Color](player-color.md) of the Player. --- @@ -741,7 +741,7 @@ Called when a player first searches this Object. Called when a player finishes searching this Object. -!!!info "onSearchStart([](/types) player_color)" - * [](/types) **player_color**: [Player Color](player-color) of the Player. +!!!info "onSearchStart([](types.md) player_color)" + * [](types.md) **player_color**: [Player Color](player-color.md) of the Player. --- diff --git a/docs/externaleditorapi.md b/docs/externaleditorapi.md index 346303ae..78fa5c89 100644 --- a/docs/externaleditorapi.md +++ b/docs/externaleditorapi.md @@ -1,4 +1,4 @@ -This page describes how our [Official Atom Plugin](atom) API works so that you can write your own plugin for your text editor of choice if Atom does not suit your needs. +This page describes how our [Official Atom Plugin](atom.md) API works so that you can write your own plugin for your text editor of choice if Atom does not suit your needs. Communication between the editor and TTS occurs via two localhost TCP connections: one where TTS listens for messages and one where the editor listens for messages. All communication messages are JSON. @@ -173,7 +173,7 @@ After TTS reloads the game, it then also sends a message with an ID of 1 back to ###Custom Message -TTS listens for a JSON message with an ID of 2 containing a custom message to be forwarded to the [`onExternalMessage`](event#onexternalmessage) event handler in the currently loaded game. +TTS listens for a JSON message with an ID of 2 containing a custom message to be forwarded to the [`onExternalMessage`](event.md#onexternalmessage) event handler in the currently loaded game. ```JSON { diff --git a/docs/index.md b/docs/index.md index 2b5345b4..a8e274d5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,7 +2,7 @@ Welcome to **Lua Scripting** in Tabletop Simulator! Scripting is an advanced feature and it’s expected you already know something about it. However, for complete novices, check out this [beginners scripting guide to Lua](http://steamcommunity.com/sharedfiles/filedetails/?id=714904631) created by MrStump, to help you along the way. -![Demonstration Of Game](/img/intro.gif) +![Demonstration Of Game](img/intro.gif) A game is composed of one Global Script and zero to many Object Scripts. The Global Script is a script that lives in your game that can run background tasks and do general game management type functions. Object scripts are attached to an individual object. Objects are anything with a physical model in the game - chess piece, dice, decks, cards, bags, custom models, boards, etc. Both types of scripts can call the same functions, but Object scripts have access to a reference of the Object it is attached to with the `self` keyword. @@ -13,4 +13,4 @@ You are able to follow the links on the left side of the page for available tool ## Writing Lua Scripts -The Lua code is written via our in-game code editor or via our [Official Plugin for the Atom Text Editor](atom). Lua scripts are stored in the .json file of the save game as a plain text string. There is no need for an external internet host for Lua scripts, everything is self-contained in your game’s save file. Workshop uploads work the same way. +The Lua code is written via our in-game code editor or via our [Official Plugin for the Atom Text Editor](atom.md). Lua scripts are stored in the .json file of the save game as a plain text string. There is no need for an external internet host for Lua scripts, everything is self-contained in your game’s save file. Workshop uploads work the same way. diff --git a/docs/intro.md b/docs/intro.md index 110fc8ab..ff303464 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -32,7 +32,7 @@ The Global script, which is a script that is not attached to any particular Obje A script that is attached to an in-game Object, and is saved as part of it. This is similar to any other property like its scale or tint. Some functions ask for an Object reference in order to attempt to run a function on it. In these cases, Global (exactly as written here) is also a valid Object reference. ###GUID -In Tabletop Simulator, a GUID is a unique 6-character [string](types) which can be used to identify in-game [Objects](object). GUIDs are automatically assigned when objects exist within the scene. +In Tabletop Simulator, a GUID is a unique 6-character [string](types.md) which can be used to identify in-game [Objects](object.md). GUIDs are automatically assigned when objects exist within the scene. If an object is duplicated, it will sometimes have the same GUID for 1 frame before the engine assigns a new GUID to the newer Object. Objects in containers (bags/decks/etc) do not automatically get new GUIDs assigned to them in this way. Only once their contents are moved out into the scene. @@ -52,26 +52,26 @@ Defining classes requires further knowledge of object-oriented programming to re ####Object Classes Associated with in-game Objects. -* [Clock](../clock) -* [Counter](../counter) -* [Object](../object) -* [AssetBundle](../assetbundle) -* [RPGFigurine](../rpgfigurine) -* [TextTool](../texttool) +* [Clock](clock.md) +* [Counter](counter.md) +* [Object](object.md) +* [AssetBundle](assetbundle.md) +* [RPGFigurine](rpgfigurine.md) +* [TextTool](texttool.md) ####Static Classes Associated with in-game properties and systems. -* [JSON](../json) -* [Player](../player) -* [WebRequest](../webrequest) -* [Physics](../physics) -* [Lighting](../lighting) -* [Turns](../turns) -* [Notes](../notes) -* [UI](../ui) -* [Wait](../wait) -* [Web Request](../webrequest) +* [JSON](json.md) +* [Player](player.md) +* [WebRequest](webrequest.md) +* [Physics](physics.md) +* [Lighting](lighting.md) +* [Turns](turns.md) +* [Notes](notes.md) +* [UI](ui.md) +* [Wait](wait.md) +* [Web Request](webrequest.md) For more information on what a class is, you can refer to the relevant [Lua Documentation](https://www.lua.org/pil/16.1.html). diff --git a/docs/json.md b/docs/json.md index fc63b784..2f3b5026 100644 --- a/docs/json.md +++ b/docs/json.md @@ -1,4 +1,4 @@ -The static global JSON class provides the ability to encode/decode data into JSON strings. This is largely used by the [onSave()](event#onsave) event function, but has other potential applications as well. The JSON class can be used on any String, Int, Float or Table. You call these functions like this: `JSON.encode(...)`. +The static global JSON class provides the ability to encode/decode data into JSON strings. This is largely used by the [onSave()](event.md#onsave) event function, but has other potential applications as well. The JSON class can be used on any String, Int, Float or Table. You call these functions like this: `JSON.encode(...)`. !!!warning This class **does not** work with Object references. Use the Object's GUID instead. @@ -11,9 +11,9 @@ The static global JSON class provides the ability to encode/decode data into JSO Function Name | Description | Return |   -- | -- | -- | --: -decode([](/types) json_string) | Value obtained from the encoded string. Can return a number, string or Table. | [](/types) | [](#decode) -encode([](/types) data) | Encodes data from a number, string or Table into a JSON string. | [](/types) | [](#encode) -encode_pretty([](/types) data) | Same as encode(...) but this version is slightly less efficient but is easier to read. | [](/types) | [](#encode_pretty) +decode([](types.md) json_string) | Value obtained from the encoded string. Can return a number, string or Table. | [](types.md) | [](#decode) +encode([](types.md) data) | Encodes data from a number, string or Table into a JSON string. | [](types.md) | [](#encode) +encode_pretty([](types.md) data) | Same as encode(...) but this version is slightly less efficient but is easier to read. | [](types.md) | [](#encode_pretty) --- @@ -22,10 +22,10 @@ encode_pretty([](/types) data) | Same as encod ###decode(...) -[](/types) Value obtained from the encoded string. Can return a number, string or Table. +[](types.md) Value obtained from the encoded string. Can return a number, string or Table. !!!info "decode(json_string)" - * [](/types) **json_string**: A String that is decoded, generally created by encode(...) or encode_pretty(...). + * [](types.md) **json_string**: A String that is decoded, generally created by encode(...) or encode_pretty(...). ``` Lua coded = JSON.encode("Test") @@ -39,17 +39,17 @@ print(decoded) --Prints Test ###encode(...) -[](/types) Encodes data from a number, string or Table into a JSON string. +[](types.md) Encodes data from a number, string or Table into a JSON string. !!!info "encode(data)" - * [](/types) **data**: A Var, either String, Int, Float or Table, to encode as a string. + * [](types.md) **data**: A Var, either String, Int, Float or Table, to encode as a string. --- ###encode_pretty(...) -[](/types) Encodes data from a number, string or Table into a JSON string. This version is slightly less efficient but is easier to read. +[](types.md) Encodes data from a number, string or Table into a JSON string. This version is slightly less efficient but is easier to read. !!!info "encode_pretty(data)" - * [](/types) **data**: A Var, either String, Int, Float or Table, to encode as a string. + * [](types.md) **data**: A Var, either String, Int, Float or Table, to encode as a string. diff --git a/docs/lighting.md b/docs/lighting.md index 2a8c276f..83bd9fd9 100644 --- a/docs/lighting.md +++ b/docs/lighting.md @@ -4,14 +4,14 @@ For more information on lighting in Unity, [refer to the Unity documentation](ht ##Member Variables -Like [Object member variables](object#member-variables), Lighting has its own member variables. They are all numbers, and have specific valid ranges. +Like [Object member variables](object.md#member-variables), Lighting has its own member variables. They are all numbers, and have specific valid ranges. Variable | Description | Type -- | -- | :-- -ambient_type | The source of ambient light. 1 = background, 2 = gradient. | [](/types) -ambient_intensity | The strength of the ambient light. Range = 0 to 4. | [](/types) -light_intensity | The strength of the directional light shining down in the scene. Range = 0 to 4. | [](/types) -reflection_intensity | The strength of the reflections from the background. Range = 0 to 1. | [](/types) +ambient_type | The source of ambient light. 1 = background, 2 = gradient. | [](types.md) +ambient_intensity | The strength of the ambient light. Range = 0 to 4. | [](types.md) +light_intensity | The strength of the directional light shining down in the scene. Range = 0 to 4. | [](types.md) +reflection_intensity | The strength of the reflections from the background. Range = 0 to 1. | [](types.md) ##Function Summary @@ -19,15 +19,15 @@ Variable | Description | Type Function Name | Description | Return -- | -- | --: -apply() | Applies changes made to the lighting Class using these functions or member variables. | [](/types) -getAmbientEquatorColor() | Returns Color Table of the gradient equator. Not used if `ambient_type = 1`. | [](/types#color) -getAmbientGroundColor() | Returns Color Table of the gradient ground. Not used if `ambient_type = 1`. | [](/types#color) -getAmbientSkyColor() | Returns Color Table of the gradient sky. Not used if `ambient_type = 1`. | [](/types#color) -getLightColor() | Returns Color Table of the directional light, which shines straight down on the table. | [](/types#color) -setAmbientEquatorColor([](/types#color) tint) | Sets the color of the gradient equator. Not used if `ambient_type = 1`. | [](/types) -setAmbientGroundColor([](/types#color) tint) | Sets the color of the gradient ground. Not used if `ambient_type = 1`. | [](/types) -setAmbientSkyColor([](/types#color) tint) | Sets the color of the gradient sky. Not used if `ambient_type = 1`. | [](/types) -setLightColor([](/types#color) tint) | Sets the color of the directional light, which shines straight down on the table. | [](/types) +apply() | Applies changes made to the lighting Class using these functions or member variables. | [](types.md) +getAmbientEquatorColor() | Returns Color Table of the gradient equator. Not used if `ambient_type = 1`. | [](types.md#color) +getAmbientGroundColor() | Returns Color Table of the gradient ground. Not used if `ambient_type = 1`. | [](types.md#color) +getAmbientSkyColor() | Returns Color Table of the gradient sky. Not used if `ambient_type = 1`. | [](types.md#color) +getLightColor() | Returns Color Table of the directional light, which shines straight down on the table. | [](types.md#color) +setAmbientEquatorColor([](types.md#color) tint) | Sets the color of the gradient equator. Not used if `ambient_type = 1`. | [](types.md) +setAmbientGroundColor([](types.md#color) tint) | Sets the color of the gradient ground. Not used if `ambient_type = 1`. | [](types.md) +setAmbientSkyColor([](types.md#color) tint) | Sets the color of the gradient sky. Not used if `ambient_type = 1`. | [](types.md) +setLightColor([](types.md#color) tint) | Sets the color of the directional light, which shines straight down on the table. | [](types.md) --- diff --git a/docs/musicplayer.md b/docs/musicplayer.md index 50d30a9c..55111f89 100644 --- a/docs/musicplayer.md +++ b/docs/musicplayer.md @@ -4,15 +4,15 @@ Example usage: `MusicPlayer.repeat_track = true`. ##Member Variables -Like [Object member variables](../object/#member-variables), MusicPlayer has its own member variables. They allow for direct access to the MusicPlayer's property information without a helping function. Some are read-only. +Like [Object member variables](object.md#member-variables), MusicPlayer has its own member variables. They allow for direct access to the MusicPlayer's property information without a helping function. Some are read-only. Variable | Description | Type -- | -- | :-- -repeat_track | If the current audioclip should be repeated. | [](/types) -shuffle | If the playlist should play shuffled. | [](/types) -playlistIndex | Current index of the playlist. -1 if no playlist audioclip is playing. | [](/types) -loaded | If all players loaded the current audioclip. Read only. | [](/types) -player_status | The current state of the music player. Read only.
Options: "Stop", "Play", "Loading", "Ready". | [](/types) +repeat_track | If the current audioclip should be repeated. | [](types.md) +shuffle | If the playlist should play shuffled. | [](types.md) +playlistIndex | Current index of the playlist. -1 if no playlist audioclip is playing. | [](types.md) +loaded | If all players loaded the current audioclip. Read only. | [](types.md) +player_status | The current state of the music player. Read only.
Options: "Stop", "Play", "Loading", "Ready". | [](types.md) ##Function Summary @@ -22,14 +22,14 @@ Functions that interact with the in-game music player. Function Name | Description | Return -- | -- | --: -play() | Plays currently loaded audioclip. Returns true if the music player is playing, otherwise returns false. | [](/types)(#play) -pause() | Pauses currently playing audioclip. Returns true if the music player is paused, otherwise returns false. | [](/types)(#pause) -skipForward() | Skips to the next audioclip in playlist if possible. Returns true if skip was successful, otherwise returns false. | [](/types)(#skipForward) -skipBack() | Skips to the beginning of the audioclip or if the play time is less than 3 seconds to the previous audioclip in playlist if possible. Returns true if skip was successful, otherwise returns false. | [](/types)(#skipBack) -getCurrentAudioclip() | Gets the currently loaded audioclip. | [](/types)(#getCurrentAudioclip) -setCurrentAudioclip() | Sets the audioclip to be loaded. | [](/types)(#setCurrentAudioclip) -getPlaylist() | Gets the current playlist. | [](/types)(#getPlaylist) -setPlaylist() | Sets the current playlist. | [](/types)(#setPlaylist) +play() | Plays currently loaded audioclip. Returns true if the music player is playing, otherwise returns false. | [](types.md)(#play) +pause() | Pauses currently playing audioclip. Returns true if the music player is paused, otherwise returns false. | [](types.md)(#pause) +skipForward() | Skips to the next audioclip in playlist if possible. Returns true if skip was successful, otherwise returns false. | [](types.md)(#skipForward) +skipBack() | Skips to the beginning of the audioclip or if the play time is less than 3 seconds to the previous audioclip in playlist if possible. Returns true if skip was successful, otherwise returns false. | [](types.md)(#skipBack) +getCurrentAudioclip() | Gets the currently loaded audioclip. | [](types.md)(#getCurrentAudioclip) +setCurrentAudioclip() | Sets the audioclip to be loaded. | [](types.md)(#setCurrentAudioclip) +getPlaylist() | Gets the current playlist. | [](types.md)(#getPlaylist) +setPlaylist() | Sets the current playlist. | [](types.md)(#setPlaylist) --- @@ -38,7 +38,7 @@ Function Name | Description | Return ####play() -[](/types) Plays currently loaded audioclip. Returns true if the music player is playing, otherwise returns false. +[](types.md) Plays currently loaded audioclip. Returns true if the music player is playing, otherwise returns false. ``` Lua --Example Usage @@ -62,7 +62,7 @@ end ####pause() -[](/types) Pauses currently playing audioclip. Returns true if the music player is paused, otherwise returns false. +[](types.md) Pauses currently playing audioclip. Returns true if the music player is paused, otherwise returns false. ``` Lua --Example Usage @@ -86,7 +86,7 @@ end ####skipForward() -[](/types) Skips to the next audioclip in playlist if possible. Returns true if skip was successful, otherwise returns false. +[](types.md) Skips to the next audioclip in playlist if possible. Returns true if skip was successful, otherwise returns false. ``` Lua --Example Usage @@ -97,7 +97,7 @@ MusicPlayer.skipForward() ####skipBack() -[](/types) Skips to the beginning of the audioclip or if the play time is less than 3 seconds to the previous audioclip in playlist if possible. Returns true if skip was successful, otherwise returns false. +[](types.md) Skips to the beginning of the audioclip or if the play time is less than 3 seconds to the previous audioclip in playlist if possible. Returns true if skip was successful, otherwise returns false. ``` Lua --Example Usage @@ -108,7 +108,7 @@ MusicPlayer.skipBack() ####getCurrentAudioclip() -[](/types) Gets the currently loaded audioclip. +[](types.md) Gets the currently loaded audioclip. ``` Lua --Example Usage @@ -123,12 +123,12 @@ currentAudioclip = MusicPlayer.getCurrentAudioclip() ####setCurrentAudioclip(...) -[](/types) .Sets the audioclip to be loaded. +[](types.md) .Sets the audioclip to be loaded. !!!info "setCurrentAudioclip(parameters)" - * [](/types) **parameters**: A Table containing the audioclip parameters. - * [](/types) **parameters.url**: Url for the new audioclip. - * [](/types) **parameters.title**: Title for the new audioclip. + * [](types.md) **parameters**: A Table containing the audioclip parameters. + * [](types.md) **parameters.url**: Url for the new audioclip. + * [](types.md) **parameters.title**: Title for the new audioclip. ``` Lua --Example Usage @@ -144,7 +144,7 @@ MusicPlayer.setCurrentAudioclip(parameters) ####getPlaylist() -[](/types) Gets the current playlist. +[](types.md) Gets the current playlist. ``` Lua --Example Usage @@ -163,13 +163,13 @@ playlist = MusicPlayer.getPlaylist() ####setPlaylist(...) -[](/types) .Sets the current playlist. +[](types.md) .Sets the current playlist. !!!info "setPlaylist(parameters)" - * [](/types) **parameters**: A Table containing the playlist parameters. - * [](/types) **parameters**: A Table containing the audioclip parameters. - * [](/types) **parameters.url**: Url for the new audioclip. - * [](/types) **parameters.title**: Title for the new audioclip. + * [](types.md) **parameters**: A Table containing the playlist parameters. + * [](types.md) **parameters**: A Table containing the audioclip parameters. + * [](types.md) **parameters.url**: Url for the new audioclip. + * [](types.md) **parameters.title**: Title for the new audioclip. ``` Lua --Example Usage diff --git a/docs/notes.md b/docs/notes.md index dd2e3bb9..36f47c93 100644 --- a/docs/notes.md +++ b/docs/notes.md @@ -9,18 +9,18 @@ Functions that interact with the in-game notebook tabs. Function Name | Description | Return |   -- | -- | -- | -- -addNotebookTab([](/types) parameters) | Adds a notebook tab, returning its index. | [](/types) | [](#addnotebooktab) -editNotebookTab([](/types) parameters) | Edit an existing Tab in the notebook. | [](/types) | [](#editnotebooktab) -getNotebookTabs() | Returns Table containing data on all tabs in the notebook. | [](/types) | [](#getnotebooktabs) -removeNotebookTab([](/types) index) | Remove a notebook tab. | [](/types) | [](#removenotebooktab) +addNotebookTab([](types.md) parameters) | Adds a notebook tab, returning its index. | [](types.md) | [](#addnotebooktab) +editNotebookTab([](types.md) parameters) | Edit an existing Tab in the notebook. | [](types.md) | [](#editnotebooktab) +getNotebookTabs() | Returns Table containing data on all tabs in the notebook. | [](types.md) | [](#getnotebooktabs) +removeNotebookTab([](types.md) index) | Remove a notebook tab. | [](types.md) | [](#removenotebooktab) ###Notes Functions Functions that interact with the on-screen notes (lower right corner of screen). Function Name | Description | Return |   -- | -- | -- | -- -getNotes() | Returns the contents of the on-screen notes section. | [](/types) | -setNotes([](/types) notes) | Replace the text in the notes window with the string. | [](/types) | [](#setnotes) +getNotes() | Returns the contents of the on-screen notes section. | [](types.md) | +setNotes([](types.md) notes) | Replace the text in the notes window with the string. | [](types.md) | [](#setnotes) --- @@ -32,14 +32,14 @@ setNotes([](/types) notes) | Replace the text ####addNotebookTab(...) -[](/types) Add a new notebook tab. If it failed to create a new tab, a -1 is returned instead. Indexes for notebook tabs begin at 0. +[](types.md) Add a new notebook tab. If it failed to create a new tab, a -1 is returned instead. Indexes for notebook tabs begin at 0. !!!info "addNotebookTab(parameters)" - * [](/types) **parameters**: A Table containing spawning parameters. - * [](/types) **parameters.title**: Title for the new tab. - * [](/types) **parameters.body**: Text to place into the body of the new tab. + * [](types.md) **parameters**: A Table containing spawning parameters. + * [](types.md) **parameters.title**: Title for the new tab. + * [](types.md) **parameters.body**: Text to place into the body of the new tab. * {>>Optional, defaults to an empty string<<} - * [](/types) **parameters.color**: [Player Color](player) for the new tab's color. + * [](types.md) **parameters.color**: [Player Color](player.md) for the new tab's color. * {>>Optional, defaults to "Grey"<<} ``` Lua @@ -56,16 +56,16 @@ Notes.addNotebookTab(parameters) ####editNotebookTab(...) -[](/types) Edit an existing Tab in the notebook. Indexes for notebook tabs begin at 0. +[](types.md) Edit an existing Tab in the notebook. Indexes for notebook tabs begin at 0. !!!info "editNotebookTab(parameters)" - * [](/types) **parameters**: A Table containing instructions for the notebook edit. - * [](/types) **parameters.index**: Index number for the tab. - * [](/types) **parameters.title**: Title for the tab. + * [](types.md) **parameters**: A Table containing instructions for the notebook edit. + * [](types.md) **parameters.index**: Index number for the tab. + * [](types.md) **parameters.title**: Title for the tab. * {>>Optional, defaults to the current title of the tab begin edited.<<} - * [](/types) **parameters.body**: Text for the body for the tab. + * [](types.md) **parameters.body**: Text for the body for the tab. * {>>Optional, defaults to the current body of the tab begin edited.<<} - * [](/types) **parameters.color**: [Player Color](player-color) for who the tab belongs to. + * [](types.md) **parameters.color**: [Player Color](player-color.md) for who the tab belongs to. * {>>Optional, defaults to the current color of the tab begin edited.<<} ``` Lua @@ -83,7 +83,7 @@ Notes.editNotebookTab(params) ####getNotebookTabs() -[](/types) Returns a Table containing data on all tabs in the notebook. Indexes for notebook tabs begin at 0. +[](types.md) Returns a Table containing data on all tabs in the notebook. Indexes for notebook tabs begin at 0. ``` Lua --Example Usage @@ -103,10 +103,10 @@ tabInfo = Notes.getNotebookTabs() ####removeNotebookTab(...) -[](/types) Remove a notebook tab. Notebook tab indexes begin at 0. +[](types.md) Remove a notebook tab. Notebook tab indexes begin at 0. !!!info "removeNotebookTab(index)" - * [](/types) **index**: Index for the tab to remove. + * [](types.md) **index**: Index for the tab to remove. ``` Lua Notes.removeNotebookTab(0) @@ -123,10 +123,10 @@ Notes.removeNotebookTab(0) ####setNotes(...) -[](/types) Replace the text in the notes window with the string. The notes is an area which displays text in the lower-left corner of the screen. +[](types.md) Replace the text in the notes window with the string. The notes is an area which displays text in the lower-left corner of the screen. !!!info "setNotes(notes)" - * [](/types) **notes**: What to place into the notes area. + * [](types.md) **notes**: What to place into the notes area. ``` Lua Notes.setNotes("This appears in the notes section") diff --git a/docs/object.md b/docs/object.md index 05427232..1ec1c0eb 100644 --- a/docs/object.md +++ b/docs/object.md @@ -1,8 +1,8 @@ The Object class represents any entity within tabletop simulator. Once you have a reference to an object in you're script you can call functions on it directly. Example: `obj.getPosition(...)`. You can get a reference to an object multiple ways; * Using the `self` property if your script is on an Object and referring to that Object. -* Using [`getObjectFromGUID(...)`](/base#getobjectfromguid) with the object's GUID (found by right clicking it with the pointer). -* Getting it as a return from another function, like with [`spawnObject(...)`](/base#spawnobject). +* Using [`getObjectFromGUID(...)`](base.md#getobjectfromguid) with the object's GUID (found by right clicking it with the pointer). +* Getting it as a return from another function, like with [`spawnObject(...)`](base.md#spawnobject). ##Member Variable Summary @@ -13,44 +13,44 @@ Read Example = `isResting = self.resting` Write Example = `self.resting = true` Variable | Description | Type -- | -- | :-- -angular_drag | Angular drag. [Unity rigidbody property](https://docs.unity3d.com/Manual/class-Rigidbody.html). | [](/types) -auto_raise | If an object should be lifted above other objects to avoid collision when held by a player. | [](/types) -bounciness | Bounciness, value of 0-1. [Unity physics material](https://docs.unity3d.com/Manual/class-PhysicMaterial.html). | [](/types) -drag | Drag. [Unity rigidbody property](https://docs.unity3d.com/Manual/class-Rigidbody.html). | [](/types) -dynamic_friction | Dynamic friction, value of 0-1. [Unity physics material](https://docs.unity3d.com/Manual/class-PhysicMaterial.html). | [](/types) -grid_projection | If grid lines can appear on the Object if visible grids are turned on. | [](/types) -guid | The 6 character unique Object identifier within Tabletop Simulator. It is assigned correctly once the `spawning` member variable becomes false. | [](/types) -held_by_color | The Color of the Player that is holding the object. | [](/types) -hide_when_face_down | Hide the Object when face-down as if it were in a hand zone. The face is the "top" of the Object, the direction of its positive Y coordinate. Cards/decks default to `true`. | [](/types) -ignore_fog_of_war | Makes the object not be hidden by [Fog of War](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone). | [](/types) -interactable | If an object can be interacted with by Players. Other object will still be able to interact with it. | [](/types) -is_face_down | If an Object is roughly face-down (like with cards). The face is the "top" of the Object, the direction of its positive Y coordinate. Read only. | [](/types) -loading_custom | If the Object's custom elements (images/models/etc) are loading. Read only. | [](/types) -mass | Mass. [Unity rigidbody property](https://docs.unity3d.com/Manual/class-Rigidbody.html). | [](/types) -name | The Object's name. Read only, use `setName("")` to write to it. | [](/types) -resting | If an Object is at rest. [Unity rigidbody property](https://docs.unity3d.com/412/Documentation/Components/RigidbodySleeping.html). | [](/types) -script_code | The Lua Script on the Object. | [](/types) -script_state | The saved data on the object. See [onSave()](/event#onsave). | [](/types) -spawning | If the Object is finished spawning. Read only. | [](/types) -static_friction | Static friction, value of 0-1. [Unity physics material](https://docs.unity3d.com/Manual/class-PhysicMaterial.html). | [](/types) -sticky | If other Objects on top of this one are also picked up when this Object is. | [](/types) -tag | This object's type. Read only. | [](/types) -tooltip | If the tooltip opens when a pointer hovers over the object. Tooltips display name and description. | [](/types) -use_gravity | If gravity affects this object. | [](/types) -use_grid | If snapping to grid is enabled or not. | [](/types) -use_hands | If this object can be held in a hand zone. | [](/types) -use_rotation_value_flip | Switches the axis an Object rotates around when flipped. | [](/types) -use_snap_points | If snap points are used or ignored. | [](/types) +angular_drag | Angular drag. [Unity rigidbody property](https://docs.unity3d.com/Manual/class-Rigidbody.html). | [](types.md) +auto_raise | If an object should be lifted above other objects to avoid collision when held by a player. | [](types.md) +bounciness | Bounciness, value of 0-1. [Unity physics material](https://docs.unity3d.com/Manual/class-PhysicMaterial.html). | [](types.md) +drag | Drag. [Unity rigidbody property](https://docs.unity3d.com/Manual/class-Rigidbody.html). | [](types.md) +dynamic_friction | Dynamic friction, value of 0-1. [Unity physics material](https://docs.unity3d.com/Manual/class-PhysicMaterial.html). | [](types.md) +grid_projection | If grid lines can appear on the Object if visible grids are turned on. | [](types.md) +guid | The 6 character unique Object identifier within Tabletop Simulator. It is assigned correctly once the `spawning` member variable becomes false. | [](types.md) +held_by_color | The Color of the Player that is holding the object. | [](types.md) +hide_when_face_down | Hide the Object when face-down as if it were in a hand zone. The face is the "top" of the Object, the direction of its positive Y coordinate. Cards/decks default to `true`. | [](types.md) +ignore_fog_of_war | Makes the object not be hidden by [Fog of War](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone). | [](types.md) +interactable | If an object can be interacted with by Players. Other object will still be able to interact with it. | [](types.md) +is_face_down | If an Object is roughly face-down (like with cards). The face is the "top" of the Object, the direction of its positive Y coordinate. Read only. | [](types.md) +loading_custom | If the Object's custom elements (images/models/etc) are loading. Read only. | [](types.md) +mass | Mass. [Unity rigidbody property](https://docs.unity3d.com/Manual/class-Rigidbody.html). | [](types.md) +name | The Object's name. Read only, use `setName("")` to write to it. | [](types.md) +resting | If an Object is at rest. [Unity rigidbody property](https://docs.unity3d.com/412/Documentation/Components/RigidbodySleeping.html). | [](types.md) +script_code | The Lua Script on the Object. | [](types.md) +script_state | The saved data on the object. See [onSave()](event.md#onsave). | [](types.md) +spawning | If the Object is finished spawning. Read only. | [](types.md) +static_friction | Static friction, value of 0-1. [Unity physics material](https://docs.unity3d.com/Manual/class-PhysicMaterial.html). | [](types.md) +sticky | If other Objects on top of this one are also picked up when this Object is. | [](types.md) +tag | This object's type. Read only. | [](types.md) +tooltip | If the tooltip opens when a pointer hovers over the object. Tooltips display name and description. | [](types.md) +use_gravity | If gravity affects this object. | [](types.md) +use_grid | If snapping to grid is enabled or not. | [](types.md) +use_hands | If this object can be held in a hand zone. | [](types.md) +use_rotation_value_flip | Switches the axis an Object rotates around when flipped. | [](types.md) +use_snap_points | If snap points are used or ignored. | [](types.md) These member variables are classes of their own, and have their own member variables. Each one is for a special type of Object. Variable Name | Description -- | -- -AssetBundle | An [AssetBundle](/assetbundle), which is a type of custom object made in Unity. -Clock | A [Clock](/clock), which is the in-game digital clock. -Counter | A [Counter](/counter), which is the in-game digital counter. -RPGFigurine | An [RPGFigurine](/rpgfigurine), which is an in-game animated figurine. -TextTool | A [TextTool](/texttool), which is an in-game text display system. +AssetBundle | An [AssetBundle](assetbundle.md), which is a type of custom object made in Unity. +Clock | A [Clock](clock.md), which is the in-game digital clock. +Counter | A [Counter](counter.md), which is the in-game digital counter. +RPGFigurine | An [RPGFigurine](rpgfigurine.md), which is an in-game animated figurine. +TextTool | A [TextTool](texttool.md), which is an in-game text display system. --- @@ -68,31 +68,31 @@ These functions handle the physical attributes of an Object: Position, Rotation, Function Name | Description | Return |   -- | -- | -- | -- -addForce([](/types#vector) vector, [](/types) force_type) | Adds force to an object in a directional Vector. | [](/types) | [](#addforce) -addTorque([](/types#vector) vector, [](/types) force_type) | Adds torque to an object in a rotational Vector. | [](/types) | [](#addtorque) -getAngularVelocity() | Returns a Vector of the current angular velocity. | [](/types#vector) -getBounds() | Returns a Vector describing the size of an object in Global terms. | [](/types#vector) | [](#getbounds) -getBoundsNormalized() | Returns a Vector describing the size of an object in Global terms, as if it was rotated to {0,0,0}. | [](/types#vector) | [](#getboundsnormalized) -getPosition() | Returns a Vector of the current world position. | [](/types#vector) -getRotation() | Returns a Vector of the current rotation. | [](/types#vector) -getScale() | Returns a Vector of the current scale. | [](/types#vector) | [](#getscale) -getTransformForward() | Returns a Vector of the forward direction of this object. | [](/types#vector) | [](#gettransformforward) -getTransformRight() | Returns a Vector of the right direction of this object. | [](/types#vector) | [](#gettransformright) -getTransformUp() | Returns a Vector of the up direction of this object. | [](/types#vector) | [](#gettransformup) -getVelocity() | Returns a Vector of the current velocity. | [](/types#vector) | -isSmoothMoving() | Indicates if an object is traveling as part of a Smooth move. Smooth moving is performed by setPositionSmooth and setRotationSmooth. | [](/types) | -positionToLocal([](/types#vector) vector) | Returns a Vector after converting a world Vector to a local Vector. | [](/types#vector) | [](#positiontolocal) -positionToWorld([](/types#vector) vector) | Returns a Vector after converting a local Vector to a world Vector. | [](/types#vector) | [](#positiontoworld) -rotate([](/types#vector) vector) | Rotates Object smoothly in the direction of the given Vector. | [](/types) | [](#rotate) -scale([](/types#vector) vector or [](/types)) | Scales Object by a multiple. | [](/types) | [](#scale) -setAngularVelocity([](/types#vector) vector) | Sets a Vector as the current angular velocity. | [](/types) | -setPosition([](/types#vector) vector) | Instantly moves an Object to the given Vector. | [](/types) | -setPositionSmooth([](/types#vector) vector, [](/types) collide, [](/types) fast) | Moves the Object smoothly to the given Vector. | [](/types) | [](#setpositionsmooth) -setRotation([](/types#vector) vector) | Instantly rotates an Object to the given Vector. | [](/types) | -setRotationSmooth([](/types#vector) vector, [](/types) collide, [](/types) fast) | Rotates the Object smoothly to the given Vector. | [](/types) | [](#setrotationsmooth) -setScale([](/types#vector) vector) | Sets a Vector as the current scale. | [](/types) | -setVelocity([](/types#vector) vector) | Sets a Vector as the current velocity. | [](/types) | -translate([](/types#vector) vector) | Smoothly moves Object by the given Vector offset. | [](/types) | +addForce([](types.md#vector) vector, [](types.md) force_type) | Adds force to an object in a directional Vector. | [](types.md) | [](#addforce) +addTorque([](types.md#vector) vector, [](types.md) force_type) | Adds torque to an object in a rotational Vector. | [](types.md) | [](#addtorque) +getAngularVelocity() | Returns a Vector of the current angular velocity. | [](types.md#vector) +getBounds() | Returns a Vector describing the size of an object in Global terms. | [](types.md#vector) | [](#getbounds) +getBoundsNormalized() | Returns a Vector describing the size of an object in Global terms, as if it was rotated to {0,0,0}. | [](types.md#vector) | [](#getboundsnormalized) +getPosition() | Returns a Vector of the current world position. | [](types.md#vector) +getRotation() | Returns a Vector of the current rotation. | [](types.md#vector) +getScale() | Returns a Vector of the current scale. | [](types.md#vector) | [](#getscale) +getTransformForward() | Returns a Vector of the forward direction of this object. | [](types.md#vector) | [](#gettransformforward) +getTransformRight() | Returns a Vector of the right direction of this object. | [](types.md#vector) | [](#gettransformright) +getTransformUp() | Returns a Vector of the up direction of this object. | [](types.md#vector) | [](#gettransformup) +getVelocity() | Returns a Vector of the current velocity. | [](types.md#vector) | +isSmoothMoving() | Indicates if an object is traveling as part of a Smooth move. Smooth moving is performed by setPositionSmooth and setRotationSmooth. | [](types.md) | +positionToLocal([](types.md#vector) vector) | Returns a Vector after converting a world Vector to a local Vector. | [](types.md#vector) | [](#positiontolocal) +positionToWorld([](types.md#vector) vector) | Returns a Vector after converting a local Vector to a world Vector. | [](types.md#vector) | [](#positiontoworld) +rotate([](types.md#vector) vector) | Rotates Object smoothly in the direction of the given Vector. | [](types.md) | [](#rotate) +scale([](types.md#vector) vector or [](types.md)) | Scales Object by a multiple. | [](types.md) | [](#scale) +setAngularVelocity([](types.md#vector) vector) | Sets a Vector as the current angular velocity. | [](types.md) | +setPosition([](types.md#vector) vector) | Instantly moves an Object to the given Vector. | [](types.md) | +setPositionSmooth([](types.md#vector) vector, [](types.md) collide, [](types.md) fast) | Moves the Object smoothly to the given Vector. | [](types.md) | [](#setpositionsmooth) +setRotation([](types.md#vector) vector) | Instantly rotates an Object to the given Vector. | [](types.md) | +setRotationSmooth([](types.md#vector) vector, [](types.md) collide, [](types.md) fast) | Rotates the Object smoothly to the given Vector. | [](types.md) | [](#setrotationsmooth) +setScale([](types.md#vector) vector) | Sets a Vector as the current scale. | [](types.md) | +setVelocity([](types.md#vector) vector) | Sets a Vector as the current velocity. | [](types.md) | +translate([](types.md#vector) vector) | Smoothly moves Object by the given Vector offset. | [](types.md) | @@ -105,19 +105,19 @@ These functions allow for the creation/editing/removal of functional buttons and Function Name | Description | Return |   -- | -- | -- | -- -clearButtons() | Removes all scripted buttons. | [](/types) | -clearInputs() | Removes all scripted inputs. | [](/types) | -createButton([](/types) parameters) | Creates a scripted button attached to the Object. | [](/types) | [](#createbutton) -createInput([](/types) parameters) | Creates a scripted input attached to the Object. | [](/types) | [](#createinput) -editButton([](/types) parameters) | Modify an existing button. | [](/types) | [](#editbutton) -editInput([](/types) parameters) | Modify an existing input. | [](/types) | [](#editinput) -getButtons() | Returns a Table of all buttons on this Object. | [](/types) | [](#getbuttons) -getInputs() | Returns a Table of all inputs on this Object. | [](/types) | [](#getinputs) -removeButton([](/types) index) | Removes a specific button. | [](/types) | [](#removebutton) -removeInput([](/types) index) | Removes a specific button. | [](/types) | [](#removeinput) +clearButtons() | Removes all scripted buttons. | [](types.md) | +clearInputs() | Removes all scripted inputs. | [](types.md) | +createButton([](types.md) parameters) | Creates a scripted button attached to the Object. | [](types.md) | [](#createbutton) +createInput([](types.md) parameters) | Creates a scripted input attached to the Object. | [](types.md) | [](#createinput) +editButton([](types.md) parameters) | Modify an existing button. | [](types.md) | [](#editbutton) +editInput([](types.md) parameters) | Modify an existing input. | [](types.md) | [](#editinput) +getButtons() | Returns a Table of all buttons on this Object. | [](types.md) | [](#getbuttons) +getInputs() | Returns a Table of all inputs on this Object. | [](types.md) | [](#getinputs) +removeButton([](types.md) index) | Removes a specific button. | [](types.md) | [](#removebutton) +removeInput([](types.md) index) | Removes a specific button. | [](types.md) | [](#removeinput) ####Custom UI -Custom UI gives you a wide variety of element types, not just buttons and inputs, to place onto an Object. It is an extension of the UI class, and details on its use can be found [on the UI page](/ui). +Custom UI gives you a wide variety of element types, not just buttons and inputs, to place onto an Object. It is an extension of the UI class, and details on its use can be found [on the UI page](ui.md). ###Get Functions @@ -125,22 +125,22 @@ These functions obtain information from an object. Function Name | Description | Return |   -- | -- | -- | -- -getColorTint() | Color tint. | [](/types#color) | -getCustomObject() | Returns a Table with the Custom Object information of a Custom Object. | [](/types) | [](#getcustomobject) -getDescription() | Description, also shows as part of Object's tooltip. | [](/types) -getFogOfWarReveal() | Settings impacting [Fog of War](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone) being revealed. | [](/types) | [](#getfogofwarreveal) -getGUID() | String of the Object's unique identifier. | [](/types) | -getJSON() | Returns a serialization of the JSON string which represents this item. Works with [spawnObjectJSON()](/base#spawnobjectjson). | [](/types) | -getJoints() | Returns information on any joints attached to this object. | [](/types) | [](#getjoints) -getLock() | If the Object is locked. | [](/types) | -getName() | Name, also shows as part of Object's tooltip. | [](/types) | -getObjects() | Returns a Table of Objects in the script zone/bag/deck. | [](/types) | [](#getobjects) -getQuantity() | How many objects are in the stack. Returns -1 if the Object is not a stack. | [](/types) | -getRotationValue() | Returns the current rotationValue. Rotation values are used to give value to different rotations (like dice). | [](/types) | [](#getrotationvalue) -getRotationValues() | Returns a Table of rotation values. Rotation values are used to give value to different rotations (like dice). | [](/types) | [](#getrotationvalues) -getStateId() | Current [state](https://kb.tabletopsimulator.com/host-guides/creating-states/) ID (index) an object is in. Returns -1 if there are no other states. State ids (indexes) start at 1. | [](/types) | -getStates() | Returns a Table of information on the [states](https://kb.tabletopsimulator.com/host-guides/creating-states/) of an Object. | [](/types) | [](#getstates) -getValue() | Object value. What the value represents depends on what type of Object this function is used on. | [](/types) | [](#getvalue) +getColorTint() | Color tint. | [](types.md#color) | +getCustomObject() | Returns a Table with the Custom Object information of a Custom Object. | [](types.md) | [](#getcustomobject) +getDescription() | Description, also shows as part of Object's tooltip. | [](types.md) +getFogOfWarReveal() | Settings impacting [Fog of War](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone) being revealed. | [](types.md) | [](#getfogofwarreveal) +getGUID() | String of the Object's unique identifier. | [](types.md) | +getJSON() | Returns a serialization of the JSON string which represents this item. Works with [spawnObjectJSON()](base.md#spawnobjectjson). | [](types.md) | +getJoints() | Returns information on any joints attached to this object. | [](types.md) | [](#getjoints) +getLock() | If the Object is locked. | [](types.md) | +getName() | Name, also shows as part of Object's tooltip. | [](types.md) | +getObjects() | Returns a Table of Objects in the script zone/bag/deck. | [](types.md) | [](#getobjects) +getQuantity() | How many objects are in the stack. Returns -1 if the Object is not a stack. | [](types.md) | +getRotationValue() | Returns the current rotationValue. Rotation values are used to give value to different rotations (like dice). | [](types.md) | [](#getrotationvalue) +getRotationValues() | Returns a Table of rotation values. Rotation values are used to give value to different rotations (like dice). | [](types.md) | [](#getrotationvalues) +getStateId() | Current [state](https://kb.tabletopsimulator.com/host-guides/creating-states/) ID (index) an object is in. Returns -1 if there are no other states. State ids (indexes) start at 1. | [](types.md) | +getStates() | Returns a Table of information on the [states](https://kb.tabletopsimulator.com/host-guides/creating-states/) of an Object. | [](types.md) | [](#getstates) +getValue() | Object value. What the value represents depends on what type of Object this function is used on. | [](types.md) | [](#getvalue) @@ -151,15 +151,15 @@ These functions apply action to an object. They take some property in order to w Function Name | Description | Return |   -- | -- | -- | -- -setColorTint([](/types#color) Color) | Sets the Color tint. | [](/types) | -setCustomObject([](/types) parameters) | Sets a custom Object's properties. | [](/types) | [](#setcustomobject) -setDescription([](/types) description) | Sets a description for an Object. Shows in tooltip after delay. | [](/types) -setFogOfWarReveal([](/types) fog_settings) | Establish the settings and enable/disable an Object's revealing of [Fog of War](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone). | [](/types) | [](#setfogofwarreveal) -setLock([](/types) lock) | Sets if an object is locked in place. | [](/types) | -setName([](/types) name) | Sets a name for an Object. Shows in tooltip. | [](/types) -setRotationValues([](/types) rotation_values) | Sets rotation values of an object. Rotation values are used to give value to different rotations (like dice). | [](/types) | [](#setrotationvalues) -setState([](/types) state_id) | Sets [state](https://kb.tabletopsimulator.com/host-guides/creating-states/) of an Object. State ids (indexes) start at 1. | [](/types) | -setValue([](/types) value) | Sets an Int as the value. What the value represents depends on what type of Object it is. | [](/types) | [](#setvalue) +setColorTint([](types.md#color) Color) | Sets the Color tint. | [](types.md) | +setCustomObject([](types.md) parameters) | Sets a custom Object's properties. | [](types.md) | [](#setcustomobject) +setDescription([](types.md) description) | Sets a description for an Object. Shows in tooltip after delay. | [](types.md) +setFogOfWarReveal([](types.md) fog_settings) | Establish the settings and enable/disable an Object's revealing of [Fog of War](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone). | [](types.md) | [](#setfogofwarreveal) +setLock([](types.md) lock) | Sets if an object is locked in place. | [](types.md) | +setName([](types.md) name) | Sets a name for an Object. Shows in tooltip. | [](types.md) +setRotationValues([](types.md) rotation_values) | Sets rotation values of an object. Rotation values are used to give value to different rotations (like dice). | [](types.md) | [](#setrotationvalues) +setState([](types.md) state_id) | Sets [state](https://kb.tabletopsimulator.com/host-guides/creating-states/) of an Object. State ids (indexes) start at 1. | [](types.md) | +setValue([](types.md) value) | Sets an Int as the value. What the value represents depends on what type of Object it is. | [](types.md) | [](#setvalue) @@ -170,25 +170,25 @@ These functions perform general actions on objects. Function Name | Description | Return |   -- | -- | -- | -- -flip() | Flip Object over. | [](/types) | -clone([](/types) parameters) | Copy/Paste this Object, returning a reference to the new Object. | [](/types) | [](#clone) -cut([](/types) count) | Cuts (splits) a deck at the given card count. | [](/types) | [](#cut) -deal([](/types) number, [](/types) player_color, [](/types) index) | Deals Objects. Will deal from decks/bags/stacks/individual items. | [](/types) | [](#deal) -dealToColorWithOffset([](/types#vector) offset, [](/types) flip, [](/types) player_color) | Deals from a deck to a position relative to the hand zone. | [](/types) | [](#dealtocolorwithoffset) -destruct() | Destroys Object. Allows for `self.destruct()`. | [](/types) | -drop() | Forces an Object, if held by a player, to be dropped. | [](/types) | -highlightOn([](/types#color) color, [](/types) duration) | Creates a highlight around an Object. | [](/types) | -highlightOff([](/types#color) color) | Removes a highlight from around an Object. | [](/types) | -jointTo([](/types) object, [](/types) parameters) | Joints objects together, in the same way the Joint tool does. | [](/types) | [](#jointto) -putObject([](/types) put_object) | Places an object into a container (chip stacks/bags/decks). | [](/types) | [](#putobject) -randomize([](/types) color) | Shuffles deck/bag, rolls dice/coin, lifts other objects into the air. Same as pressing `R` by default. If the optional parameter `color` is used, this function will trigger `onObjectRandomized()`, passing that player color. | [](/types) | -reload() | Returns Object reference of itself after it respawns itself. | [](/types) | [](#reload) -reset() | Resets this Object. Resetting a Deck brings all the Cards back into it. Resetting a Bag clears its contents (works for both Loot and Infinite Bags). | [](/types) | -roll() | Rolls dice/coins. | [](/types) | -shuffle() | Shuffles/shakes up contents of a deck or bag. | [](/types) | -shuffleStates() | Returns an Object reference to a new [state](http://berserk-games.com/knowledgebase/creating-states/) after randomly selecting and changing to one. | [](/types) | -split([](/types) piles) | Splits a deck, as evenly as possible, into a number of piles. | [](/types) | [](#split) -takeObject([](/types) parameters) | Returns an Object reference of Object taken from a container (bag/deck/chip stack) and placed into the world. | [](/types) | [](#takeobject) +flip() | Flip Object over. | [](types.md) | +clone([](types.md) parameters) | Copy/Paste this Object, returning a reference to the new Object. | [](types.md) | [](#clone) +cut([](types.md) count) | Cuts (splits) a deck at the given card count. | [](types.md) | [](#cut) +deal([](types.md) number, [](types.md) player_color, [](types.md) index) | Deals Objects. Will deal from decks/bags/stacks/individual items. | [](types.md) | [](#deal) +dealToColorWithOffset([](types.md#vector) offset, [](types.md) flip, [](types.md) player_color) | Deals from a deck to a position relative to the hand zone. | [](types.md) | [](#dealtocolorwithoffset) +destruct() | Destroys Object. Allows for `self.destruct()`. | [](types.md) | +drop() | Forces an Object, if held by a player, to be dropped. | [](types.md) | +highlightOn([](types.md#color) color, [](types.md) duration) | Creates a highlight around an Object. | [](types.md) | +highlightOff([](types.md#color) color) | Removes a highlight from around an Object. | [](types.md) | +jointTo([](types.md) object, [](types.md) parameters) | Joints objects together, in the same way the Joint tool does. | [](types.md) | [](#jointto) +putObject([](types.md) put_object) | Places an object into a container (chip stacks/bags/decks). | [](types.md) | [](#putobject) +randomize([](types.md) color) | Shuffles deck/bag, rolls dice/coin, lifts other objects into the air. Same as pressing `R` by default. If the optional parameter `color` is used, this function will trigger `onObjectRandomized()`, passing that player color. | [](types.md) | +reload() | Returns Object reference of itself after it respawns itself. | [](types.md) | [](#reload) +reset() | Resets this Object. Resetting a Deck brings all the Cards back into it. Resetting a Bag clears its contents (works for both Loot and Infinite Bags). | [](types.md) | +roll() | Rolls dice/coins. | [](types.md) | +shuffle() | Shuffles/shakes up contents of a deck or bag. | [](types.md) | +shuffleStates() | Returns an Object reference to a new [state](http://berserk-games.com/knowledgebase/creating-states/) after randomly selecting and changing to one. | [](types.md) | +split([](types.md) piles) | Splits a deck, as evenly as possible, into a number of piles. | [](types.md) | [](#split) +takeObject([](types.md) parameters) | Returns an Object reference of Object taken from a container (bag/deck/chip stack) and placed into the world. | [](types.md) | [](#takeobject) @@ -207,10 +207,10 @@ These functions can hide Objects, similar to how hand zones or hidden zones do. Function Name | Description | Return |   -- | -- | -- | -- -setHiddenFrom([](/types) players) | Hides the Object from the specified players, as if it were in a hand zone. | [](/types) | [](#sethiddenfrom) -setInvisibleTo([](/types) players) | Hides the Object from the specified players, as if it were in a hidden zone. | [](/types) | [](#setinvisibleto) -attachHider([](/types) id, [](/types) hidden, [](/types) players) | A more advanced version of `setHiddenFrom(...)`. | [](/types) | [](#attachhider) -attachInvisibleHider([](/types) id, [](/types) hidden, [](/types) players) | A more advanced version of `setInvisibleTo(...)`. | [](/types) | [](#attachinvisiblehider) +setHiddenFrom([](types.md) players) | Hides the Object from the specified players, as if it were in a hand zone. | [](types.md) | [](#sethiddenfrom) +setInvisibleTo([](types.md) players) | Hides the Object from the specified players, as if it were in a hidden zone. | [](types.md) | [](#setinvisibleto) +attachHider([](types.md) id, [](types.md) hidden, [](types.md) players) | A more advanced version of `setHiddenFrom(...)`. | [](types.md) | [](#attachhider) +attachInvisibleHider([](types.md) id, [](types.md) hidden, [](types.md) players) | A more advanced version of `setInvisibleTo(...)`. | [](types.md) | [](#attachinvisiblehider) @@ -226,20 +226,20 @@ The functions can be used on Objects, but can also be used on the game world usi Function Name | Description | Return |   -- | -- | -- | -- -addDecal([](/types) parameters) | Add a Decal onto an object or the game world. | [](/types) | [](#adddecal) -call([](/types) func_name, [](/types) func_params) | Used to call a Lua function on another entity. | [](/types) | [](#call) -getDecals() | Returns information on all decals attached to this object or the world. | [](/types) | [](#getdecals) -getLuaScript() | Get a Lua script as a string from the entity. | [](/types) | -getSnapPoints() | Returns a table of sub-tables, each sub-table representing one snap point. | [](/types) | [](#getsnappoints) -getTable([](/types) func_name) | Data value of a variable in another Object's script. Can only return a table. | [](/types) | -getVar([](/types) func_name) | Data value of a variable in another entity's script. Cannot return a table. | [](/types) | -getVectorLines() | Returns Table of data representing the current Vector Lines on this entity. See [setVectorLines](#setvectorlines) for table format.| [](/types) | -setDecals([](/types) parameters) | Sets which decals are on an object. This removes other decals already present, and can remove all decals as well. | [](/types) | [](#setdecals) -setLuaScript([](/types) script) | Input a string as an entity's Lua script. Generally only used after spawning a new Object. | [](/types) | -setSnapPoints([](/types) parameters) | Spawns snap points from a list of parameters. | [](/types) | [](#setsnappoints) -setTable([](/types) func_name, [](/types) data) | Creates/updates a variable in another entity's script. Only used for tables. | [](/types) | -setVar([](/types) func_name, [](/types) data) | Creates/updates a variable in another entity's script. Cannot set a table. | [](/types) | -setVectorLines([](/types) parameters) | Spawns Vector Lines from a list of parameters on this entity. | [](/types) | [](#setvectorlines) +addDecal([](types.md) parameters) | Add a Decal onto an object or the game world. | [](types.md) | [](#adddecal) +call([](types.md) func_name, [](types.md) func_params) | Used to call a Lua function on another entity. | [](types.md) | [](#call) +getDecals() | Returns information on all decals attached to this object or the world. | [](types.md) | [](#getdecals) +getLuaScript() | Get a Lua script as a string from the entity. | [](types.md) | +getSnapPoints() | Returns a table of sub-tables, each sub-table representing one snap point. | [](types.md) | [](#getsnappoints) +getTable([](types.md) func_name) | Data value of a variable in another Object's script. Can only return a table. | [](types.md) | +getVar([](types.md) func_name) | Data value of a variable in another entity's script. Cannot return a table. | [](types.md) | +getVectorLines() | Returns Table of data representing the current Vector Lines on this entity. See [setVectorLines](#setvectorlines) for table format.| [](types.md) | +setDecals([](types.md) parameters) | Sets which decals are on an object. This removes other decals already present, and can remove all decals as well. | [](types.md) | [](#setdecals) +setLuaScript([](types.md) script) | Input a string as an entity's Lua script. Generally only used after spawning a new Object. | [](types.md) | +setSnapPoints([](types.md) parameters) | Spawns snap points from a list of parameters. | [](types.md) | [](#setsnappoints) +setTable([](types.md) func_name, [](types.md) data) | Creates/updates a variable in another entity's script. Only used for tables. | [](types.md) | +setVar([](types.md) func_name, [](types.md) data) | Creates/updates a variable in another entity's script. Cannot set a table. | [](types.md) | +setVectorLines([](types.md) parameters) | Spawns Vector Lines from a list of parameters on this entity. | [](types.md) | [](#setvectorlines) --- @@ -254,11 +254,11 @@ setVectorLines([](/types) parameters) | Spawns ####addForce(...) -[](/types) Adds force to an object in a directional Vector. +[](types.md) Adds force to an object in a directional Vector. !!!info "addForce(vector, force_type)" - * [](/types) **Vector**: A Vector of the direction and magnitude of force. - * [](/types) **force_type**: An Int representing the force type to apply. Options below. + * [](types.md) **Vector**: A Vector of the direction and magnitude of force. + * [](types.md) **force_type**: An Int representing the force type to apply. Options below. * {>>Optional, defaults to 3.<<} * **1**: Continuous force, uses mass. *(Force)* * **2**: Continuous acceleration, ignores mass. *(Acceleration)* @@ -270,11 +270,11 @@ setVectorLines([](/types) parameters) | Spawns ####addTorque(...) -[](/types) Adds torque to an object in a rotational Vector. +[](types.md) Adds torque to an object in a rotational Vector. !!!info "addTorque(vector, force_type)" - * [](/types) **Vector**: A Vector of the direction and magnitude of rotational force. - * [](/types) **Force Type**: An Int representing the force type to apply. Options below. + * [](types.md) **Vector**: A Vector of the direction and magnitude of rotational force. + * [](types.md) **Force Type**: An Int representing the force type to apply. Options below. * {>>Optional, defaults to 3.<<} * **1**: Continuous force, uses mass. *(Force)* * **2**: Continuous acceleration, ignores mass. *(Acceleration)* @@ -287,12 +287,12 @@ setVectorLines([](/types) parameters) | Spawns ####getBounds() -[](/types) Returns a Table of Vector information describing the size of an object in Global terms. [Bounds](https://docs.unity3d.com/ScriptReference/Bounds.html) are part of Unity, and represent an imaginary square box that can be drawn around an object. Unlike scale, it can help indicate the size of an object in in-game units, not just relative model size. +[](types.md) Returns a Table of Vector information describing the size of an object in Global terms. [Bounds](https://docs.unity3d.com/ScriptReference/Bounds.html) are part of Unity, and represent an imaginary square box that can be drawn around an object. Unlike scale, it can help indicate the size of an object in in-game units, not just relative model size. !!!info "Return Table" - * [](/types) **center**: The Vector of the center of the bounding box. - * [](/types) **size**: The Vector of the size of the bounding box. - * [](/types) **offset**: The Vector of the offset of the center of the bounding box from the middle of the Object model. + * [](types.md) **center**: The Vector of the center of the bounding box. + * [](types.md) **size**: The Vector of the size of the bounding box. + * [](types.md) **offset**: The Vector of the offset of the center of the bounding box from the middle of the Object model. ``` Lua -- Example returned Table @@ -308,12 +308,12 @@ setVectorLines([](/types) parameters) | Spawns ####getBoundsNormalized() -[](/types) Returns a Table of Vector information describing the size of an object in Global terms, as if it was rotated to {0,0,0}. [Bounds](https://docs.unity3d.com/ScriptReference/Bounds.html) are part of Unity, and represent an imaginary square box that can be drawn around an object. Unlike scale, it can help indicate the size of an object in in-game units, not just relative model size. +[](types.md) Returns a Table of Vector information describing the size of an object in Global terms, as if it was rotated to {0,0,0}. [Bounds](https://docs.unity3d.com/ScriptReference/Bounds.html) are part of Unity, and represent an imaginary square box that can be drawn around an object. Unlike scale, it can help indicate the size of an object in in-game units, not just relative model size. !!!info "Return Table" - * [](/types) **center**: The Vector of the center of the bounding box. - * [](/types) **size**: The Vector of the size of the bounding box. - * [](/types) **offset**: The Vector of the offset of the center of the bounding box from the middle of the Object model. + * [](types.md) **center**: The Vector of the center of the bounding box. + * [](types.md) **size**: The Vector of the size of the bounding box. + * [](types.md) **offset**: The Vector of the offset of the center of the bounding box from the middle of the Object model. ``` Lua -- Example returned Table @@ -329,14 +329,14 @@ setVectorLines([](/types) parameters) | Spawns ####getScale() -[](/types) Returns a Vector of the current scale. Scale is not an absolute measurement, it is a multiple of the Object's default model size. So {x=2, y=2, z=2} would be a model twice its default size, not 2 units large. +[](types.md) Returns a Vector of the current scale. Scale is not an absolute measurement, it is a multiple of the Object's default model size. So {x=2, y=2, z=2} would be a model twice its default size, not 2 units large. --- ####getTransformForward() -[](/types) Returns a Vector of the forward direction of this Object. The direction is relative to how the object is facing. +[](types.md) Returns a Vector of the forward direction of this Object. The direction is relative to how the object is facing. ``` Lua -- Example of moving forward 5 units @@ -358,7 +358,7 @@ end ####getTransformRight() -[](/types) Returns a Vector of the forward direction of this object. The direction is relative to how the object is facing. +[](types.md) Returns a Vector of the forward direction of this object. The direction is relative to how the object is facing. ``` Lua -- Example of moving right 5 units @@ -380,7 +380,7 @@ end ####getTransformUp() -[](/types) Returns a Vector of the up direction of this Object. The direction is relative to how the object is facing. +[](types.md) Returns a Vector of the up direction of this Object. The direction is relative to how the object is facing. ``` Lua -- Example of moving up 5 units @@ -402,36 +402,36 @@ end ####positionToLocal(...) -[](/types) Returns a Vector after converting a world vector to a local Vector. A world Vector is a positional Vector using the world's coordinate system. A Local Vector is a positional Vector that is relative to the position of the given object. +[](types.md) Returns a Vector after converting a world vector to a local Vector. A world Vector is a positional Vector using the world's coordinate system. A Local Vector is a positional Vector that is relative to the position of the given object. !!!tip "Object Scale" This function takes the Object's scale into account, as the Object is the key relative point. !!!info "positionToLocal(vector)" - * [](/types) **vector**: The world position to convert into a local position. + * [](types.md) **vector**: The world position to convert into a local position. --- ####positionToWorld(...) -[](/types) Returns a Vector after converting a local Vector to a world Vector. A world Vector is a positional Vector using the world's coordinate system. A Local Vector is a positional Vector that is relative to the position of the given object. +[](types.md) Returns a Vector after converting a local Vector to a world Vector. A world Vector is a positional Vector using the world's coordinate system. A Local Vector is a positional Vector that is relative to the position of the given object. !!!tip "Object Scale" This function takes the Object's scale into account, as the Object is the key relative point. !!!info "positionToLocal(vector)" - * [](/types) **vector**: The local position to convert into a world position. + * [](types.md) **vector**: The local position to convert into a world position. --- ####rotate(...) -[](/types) Rotates Object smoothly in the direction of the given Vector. This does not set the Object to face a specific rotation, it rotates the Object around by the number of degrees given for x/y/z. +[](types.md) Rotates Object smoothly in the direction of the given Vector. This does not set the Object to face a specific rotation, it rotates the Object around by the number of degrees given for x/y/z. !!!info "rotate(vector)" - * [](/types) **vector**: The amount of x/y/z to rotate by. + * [](types.md) **vector**: The amount of x/y/z to rotate by. ``` Lua --Rotates object 90 degrees around its Y axis @@ -443,13 +443,13 @@ self.rotate({x=0, y=90, z=0}) ####scale(...) -[](/types) Scales Object by a multiple. This does not set the Object to a specific scale, it scales the Object by the given multiple. +[](types.md) Scales Object by a multiple. This does not set the Object to a specific scale, it scales the Object by the given multiple. !!!info "scale(scale)" - * [](/types#vector) **scale**: Multiplier for scale. + * [](types.md#vector) **scale**: Multiplier for scale. * {>>{x=1, y=1, z=1} would not change the scale.<<} !!!info "scale(scale)" - * [](/types) **scale**: Multiplier for scale which is applied to the X/Y/Z. + * [](types.md) **scale**: Multiplier for scale which is applied to the X/Y/Z. * {>>1 would not change the scale.<<} ``` Lua @@ -463,24 +463,24 @@ self.scale(2) ####setPositionSmooth(...) -[](/types) Moves the Object smoothly to the given Vector. +[](types.md) Moves the Object smoothly to the given Vector. !!!info "setPositionSmooth(vector, collide, fast)" - * [](/types) **Vector**: A positional Vector. - * [](/types) **collide**: If the Object will collide with other Objects while moving. - * [](/types) **fast**: If the Object is moved quickly. + * [](types.md) **Vector**: A positional Vector. + * [](types.md) **collide**: If the Object will collide with other Objects while moving. + * [](types.md) **fast**: If the Object is moved quickly. --- ####setRotationSmooth(...) -[](/types) Rotates the Object smoothly to the given Vector. +[](types.md) Rotates the Object smoothly to the given Vector. !!!info "setRotationSmooth(vector, collide, fast)" - * [](/types) **Vector**: A rotational Vector. - * [](/types) **collide**: If the Object will collide with other Objects while rotating. - * [](/types) **fast**: If the Object is rotated quickly. + * [](types.md) **Vector**: A rotational Vector. + * [](types.md) **collide**: If the Object will collide with other Objects while rotating. + * [](types.md) **fast**: If the Object is rotated quickly. --- @@ -505,7 +505,7 @@ self.scale(2) ####createButton(...) -[](/types) Creates a scripted button attached to the Object. Scripted buttons are buttons that can be clicked while in-game that trigger a function in a script. +[](types.md) Creates a scripted button attached to the Object. Scripted buttons are buttons that can be clicked while in-game that trigger a function in a script. ???tip "Button Tips" * Buttons can not be clicked from their back side. @@ -517,41 +517,41 @@ self.scale(2) * You cannot assign an index to a button. It is given one automatically. !!!info "createButton(parameters)" - * [](/types) **parameters**: A Table containing the information used to spawn the button. - * [](/types) **parameters.click_function**: A String of the function's name that will be run when button is clicked. - * [](/types) **parameters.function_owner**: The Object which contains the click_function function. + * [](types.md) **parameters**: A Table containing the information used to spawn the button. + * [](types.md) **parameters.click_function**: A String of the function's name that will be run when button is clicked. + * [](types.md) **parameters.function_owner**: The Object which contains the click_function function. * {>>Optional, Defaults to Global.<<} - * [](/types) **parameters.label**: Text that appears on the button. + * [](types.md) **parameters.label**: Text that appears on the button. * {>>Optional, defaults to an empty string.<<} - * [](/types#vector) **parameters.position**: Where the button appears, relative to the Object's center. + * [](types.md#vector) **parameters.position**: Where the button appears, relative to the Object's center. * {>>Optional, defaults to {x=0, y=0, z=0}.<<} - * [](/types#vector) **parameters.rotation**: How the button is rotated, relative to the Object's rotation. + * [](types.md#vector) **parameters.rotation**: How the button is rotated, relative to the Object's rotation. * {>>Optional, defaults to {x=0, y=0, z=0}.<<} - * [](/types#vector) **parameters.scale**: Scale of the button, relative to the Object's scale. + * [](types.md#vector) **parameters.scale**: Scale of the button, relative to the Object's scale. * {>>Optional, defaults to {x=1, y=1, z=1}.<<} - * [](/types) **parameters.width**: How wide the button will be, relative to the Object. + * [](types.md) **parameters.width**: How wide the button will be, relative to the Object. * {>>Optional, defaults to 100.<<} - * [](/types) **parameters.height**: How tall the button will be, relative to the Object. + * [](types.md) **parameters.height**: How tall the button will be, relative to the Object. * {>>Optional, defaults to 100.<<} - * [](/types) **parameters.font_size**: Size the label font will be, relative to the Object. + * [](types.md) **parameters.font_size**: Size the label font will be, relative to the Object. * {>>Optional, defaults to 100.<<} - * [](/types#color) **parameters.color**: A Color for the clickable button. + * [](types.md#color) **parameters.color**: A Color for the clickable button. * {>>Optional, defaults to {r=1, g=1, b=1}.<<} - * [](/types#color) **parameters.font_color**: A Color for the label text. + * [](types.md#color) **parameters.font_color**: A Color for the label text. * {>>Optional, defaults to {r=0, g=0, b=0}.<<} - * [](/types#color) **parameters.hover_color**: A Color for the background during mouse-over. + * [](types.md#color) **parameters.hover_color**: A Color for the background during mouse-over. * {>>Optional.<<} - * [](/types#color) **parameters.press_color**: A Color for the background when clicked. + * [](types.md#color) **parameters.press_color**: A Color for the background when clicked. * {>>Optional.<<} - * [](/types) **parameters.tooltip**: Popup of text, similar to how an Object's name is displayed on mouseover. + * [](types.md) **parameters.tooltip**: Popup of text, similar to how an Object's name is displayed on mouseover. * {>>Optional, defaults to an empty string.<<} !!!info "click_function(obj, player_clicker_color, alt_click)" *The click function which is activated by clicking this button has its own parameters it is passed automatically.* - * [](/types) **obj**: The Object the button is attached to. - * [](/types) **player_clicker_color**: [Player Color](/player-color) of the player that pressed the button. - * [](/types) **alt_click**: True if a button other than left-click was used to click the button. + * [](types.md) **obj**: The Object the button is attached to. + * [](types.md) **player_clicker_color**: [Player Color](player-color.md) of the player that pressed the button. + * [](types.md) **alt_click**: True if a button other than left-click was used to click the button. ``` Lua function onLoad() @@ -586,7 +586,7 @@ end ####createInput(...) -[](/types) Creates a scripted input attached to the Object. Scripted inputs are boxes you can click inside of in-game to input/edit text. Every letter typed triggers the function. The bool that is returned as part of the input_function allows you to determine when a player has finished editing the input. +[](types.md) Creates a scripted input attached to the Object. Scripted inputs are boxes you can click inside of in-game to input/edit text. Every letter typed triggers the function. The bool that is returned as part of the input_function allows you to determine when a player has finished editing the input. ???tip "Input Tips" * Inputs can not be clicked from their back side. @@ -598,40 +598,40 @@ end * You cannot assign an index to an input. It is given one automatically. !!!info "createInput(parameters)" - * [](/types) **parameters**: A Table containing the information used to spawn the input. - * [](/types) **parameters.input_function**: A String of the function's name that will be run when a key is used or when it is deselected. - * [](/types) **parameters.function_owner**: The Object which contains the input_function function. + * [](types.md) **parameters**: A Table containing the information used to spawn the input. + * [](types.md) **parameters.input_function**: A String of the function's name that will be run when a key is used or when it is deselected. + * [](types.md) **parameters.function_owner**: The Object which contains the input_function function. * {>>Optional, Defaults to Global.<<} - * [](/types) **parameters.label**: Text that appears as greyed out text when there is no value in the input. + * [](types.md) **parameters.label**: Text that appears as greyed out text when there is no value in the input. * {>>Optional, defaults to an empty string.<<} - * [](/types#vector) **parameters.position**: Where the input appears, relative to the Object's center. + * [](types.md#vector) **parameters.position**: Where the input appears, relative to the Object's center. * {>>Optional, defaults to {x=0, y=0, z=0}.<<} - * [](/types#vector) **parameters.rotation**: How the input is rotated, relative to the Object's rotation. + * [](types.md#vector) **parameters.rotation**: How the input is rotated, relative to the Object's rotation. * {>>Optional, defaults to {x=0, y=0, z=0}.<<} - * [](/types#vector) **parameters.scale**: Scale of the input, relative to the Object's scale. + * [](types.md#vector) **parameters.scale**: Scale of the input, relative to the Object's scale. * {>>Optional, defaults to {x=1, y=1, z=1}.<<} - * [](/types) **parameters.width**: How wide the input will be, relative to the Object. + * [](types.md) **parameters.width**: How wide the input will be, relative to the Object. * {>>Optional, defaults to 100.<<} - * [](/types) **parameters.height**: How tall the input will be, relative to the Object. + * [](types.md) **parameters.height**: How tall the input will be, relative to the Object. * {>>Optional, defaults to 100.<<} - * [](/types) **parameters.font_size**: Size the label/value font will be, relative to the Object. + * [](types.md) **parameters.font_size**: Size the label/value font will be, relative to the Object. * {>>Optional, defaults to 100.<<} - * [](/types#color) **parameters.color**: A Color for the input's background. + * [](types.md#color) **parameters.color**: A Color for the input's background. * {>>Optional, defaults to {r=1, g=1, b=1}.<<} - * [](/types#color) **parameters.font_color**: A Color for the value text. + * [](types.md#color) **parameters.font_color**: A Color for the value text. * {>>Optional, defaults to {r=0, g=0, b=0}.<<} - * [](/types) **parameters.tooltip**: A popup of text, similar to how an Object's name is displayed on mouseover. + * [](types.md) **parameters.tooltip**: A popup of text, similar to how an Object's name is displayed on mouseover. * {>>Optional, defaults to an empty string.<<} - * [](/types) **parameters.alignment**: How text is aligned in the input box. + * [](types.md) **parameters.alignment**: How text is aligned in the input box. * {>>Optional, defaults to 1.<<} * **1**: Automatic * **2**: Left * **3**: Center * **4**: Right * **5**: Justified - * [](/types) **parameters.value**: Text entered into the input. + * [](types.md) **parameters.value**: Text entered into the input. * {>>Optional, defaults to an empty string.<<} - * [](/types) **parameters.validation**: What characters can be input into the input value field. + * [](types.md) **parameters.validation**: What characters can be input into the input value field. * {>>Optional, defaults to 1.<<} * **1**: None * **2**: Integer @@ -639,7 +639,7 @@ end * **4**: Alphanumeric * **5**: Username * **6**: Name - * [](/types) **parameters.tab**: How the pressing of "tab" is handled when inputting. + * [](types.md) **parameters.tab**: How the pressing of "tab" is handled when inputting. * {>>Optional, defaults to 1.<<} * **1**: None * **2**: Select Next Input @@ -648,10 +648,10 @@ end !!!info "input_function(obj, player_clicker_color, input_value, selected)" *The click function which is activated by editing the text in this input has its own parameters it is passed automatically.* - * [](/types) **obj**: The Object the input is attached to. - * [](/types) **player_clicker_color**: [Player Color](/player-color) of the player that has selected/edited the input. - * [](/types) **input_value**: Text currently in the input. - * [](/types) **selected**: If the value box is still being edited or not. + * [](types.md) **obj**: The Object the input is attached to. + * [](types.md) **player_clicker_color**: [Player Color](player-color.md) of the player that has selected/edited the input. + * [](types.md) **input_value**: Text currently in the input. + * [](types.md) **selected**: If the value box is still being edited or not. ``` Lua function onLoad() @@ -681,25 +681,25 @@ end ####editButton(...) -[](/types) Modify an existing button. The only parameter that is required is the index. The rest are optional, and not using them will cause the edited button's element to remain. Indexes start at 0. The first button on any given Object has an index of 0, the next button on it has an index of 1, etc. Each Object has its own indexes. +[](types.md) Modify an existing button. The only parameter that is required is the index. The rest are optional, and not using them will cause the edited button's element to remain. Indexes start at 0. The first button on any given Object has an index of 0, the next button on it has an index of 1, etc. Each Object has its own indexes. !!!info "editButton(parameters)" - * [](/types) **parameters**: A Table containing the information used to spawn the button. - * [](/types) **parameters.index**: Index of the button you want to edit. - * [](/types) **parameters.click_function**: Function's name that will be run when button is clicked. - * [](/types) **parameters.function_owner**: The Object which contains the click_function function. - * [](/types) **parameters.label**: Text that appears on the button. - * [](/types#vector) **parameters.position**: Where the button appears, relative to the Object's center. - * [](/types#vector) **parameters.rotation**: How the button is rotated, relative to the Object's rotation. - * [](/types#vector) **parameters.scale**: Scale of the button, relative to the Object's scale. - * [](/types) **parameters.width**: How wide the button will be, relative to the Object. - * [](/types) **parameters.height**: How tall the button will be, relative to the Object. - * [](/types) **parameters.font_size**: Size the label font will be, relative to the Object. - * [](/types#color) **parameters.color**: A Color for the clickable button. - * [](/types#color) **parameters.font_color**: A Color for the label text. - * [](/types#color) **parameters.hover_color**: A Color for the background during mouse-over. - * [](/types#color) **parameters.press_color**: A Color for the background when clicked. - * [](/types) **parameters.tooltip**: Text of a popup of text, similar to how an Object's name is displayed on mouseover. + * [](types.md) **parameters**: A Table containing the information used to spawn the button. + * [](types.md) **parameters.index**: Index of the button you want to edit. + * [](types.md) **parameters.click_function**: Function's name that will be run when button is clicked. + * [](types.md) **parameters.function_owner**: The Object which contains the click_function function. + * [](types.md) **parameters.label**: Text that appears on the button. + * [](types.md#vector) **parameters.position**: Where the button appears, relative to the Object's center. + * [](types.md#vector) **parameters.rotation**: How the button is rotated, relative to the Object's rotation. + * [](types.md#vector) **parameters.scale**: Scale of the button, relative to the Object's scale. + * [](types.md) **parameters.width**: How wide the button will be, relative to the Object. + * [](types.md) **parameters.height**: How tall the button will be, relative to the Object. + * [](types.md) **parameters.font_size**: Size the label font will be, relative to the Object. + * [](types.md#color) **parameters.color**: A Color for the clickable button. + * [](types.md#color) **parameters.font_color**: A Color for the label text. + * [](types.md#color) **parameters.hover_color**: A Color for the background during mouse-over. + * [](types.md#color) **parameters.press_color**: A Color for the background when clicked. + * [](types.md) **parameters.tooltip**: Text of a popup of text, similar to how an Object's name is displayed on mouseover. ``` Lua self.editButton({index=0, label="New Label"}) @@ -710,40 +710,40 @@ self.editButton({index=0, label="New Label"}) ####editInput(...) -[](/types) Modify an existing input. The only parameter that is required is the index. The rest are optional, and not using them will cause the edited input's element to remain. Indexes start at 0. The first input on any given Object has an index of 0, the next input on it has an index of 1, etc. Each Object has its own indexes. +[](types.md) Modify an existing input. The only parameter that is required is the index. The rest are optional, and not using them will cause the edited input's element to remain. Indexes start at 0. The first input on any given Object has an index of 0, the next input on it has an index of 1, etc. Each Object has its own indexes. !!!info "editInput(parameters)" *All fields besides `index` are optional. If not used, the element will default to the element's current setting.* - * [](/types) **parameters**: A Table containing the information used to spawn the input. - * [](/types) **parameters.index**: Index of the input you want to edit. - * [](/types) **parameters.input_function**: The function's name that will be run when the input is selected. - * [](/types) **parameters.function_owner**: The Object which contains the input_function function. - * [](/types) **parameters.label**: Text that appears as greyed out text when there is no value in the input. - * [](/types#vector) **parameters.position**: Where the input appears, relative to the Object's center. - * [](/types#vector) **parameters.rotation**: How the input is rotated, relative to the Object's rotation. - * [](/types#vector) **parameters.scale**: Scale of the input, relative to the Object's scale. - * [](/types) **parameters.width**: How wide the input will be, relative to the Object. - * [](/types) **parameters.height**: How tall the input will be, relative to the Object. - * [](/types) **parameters.font_size**: Size the label/value font will be, relative to the Object. - * [](/types#color) **parameters.color**: A Color for the input's background. - * [](/types#color) **parameters.font_color**: A Color for the value text. - * [](/types) **parameters.tooltip**: A popup of text, similar to how an Object's name is displayed on mouseover. - * [](/types) **parameters.alignment**: How text is aligned in the input box. + * [](types.md) **parameters**: A Table containing the information used to spawn the input. + * [](types.md) **parameters.index**: Index of the input you want to edit. + * [](types.md) **parameters.input_function**: The function's name that will be run when the input is selected. + * [](types.md) **parameters.function_owner**: The Object which contains the input_function function. + * [](types.md) **parameters.label**: Text that appears as greyed out text when there is no value in the input. + * [](types.md#vector) **parameters.position**: Where the input appears, relative to the Object's center. + * [](types.md#vector) **parameters.rotation**: How the input is rotated, relative to the Object's rotation. + * [](types.md#vector) **parameters.scale**: Scale of the input, relative to the Object's scale. + * [](types.md) **parameters.width**: How wide the input will be, relative to the Object. + * [](types.md) **parameters.height**: How tall the input will be, relative to the Object. + * [](types.md) **parameters.font_size**: Size the label/value font will be, relative to the Object. + * [](types.md#color) **parameters.color**: A Color for the input's background. + * [](types.md#color) **parameters.font_color**: A Color for the value text. + * [](types.md) **parameters.tooltip**: A popup of text, similar to how an Object's name is displayed on mouseover. + * [](types.md) **parameters.alignment**: How text is aligned in the input box. * **1**: Automatic * **2**: Left * **3**: Center * **4**: Right * **5**: Justified - * [](/types) **parameters.value**: A String of the text entered into the input. - * [](/types) **parameters.validation**: An Int which determines what characters can be input into the value. + * [](types.md) **parameters.value**: A String of the text entered into the input. + * [](types.md) **parameters.validation**: An Int which determines what characters can be input into the value. * **1**: None * **2**: Integer * **3**: Float * **4**: Alphanumeric * **5**: Username * **6**: Name - * [](/types) **parameters.tab**: An Int which determines how pressing tab is handled when inputting. + * [](types.md) **parameters.tab**: An Int which determines how pressing tab is handled when inputting. * **1**: None * **2**: Select Next Input * **3**: Indent @@ -757,7 +757,7 @@ self.editInput({index=0, value="New Value"}) ####getButtons() -[](/types) Returns a Table of all buttons on this Object. The Table contains parameters tables with the same keys as seen in the [createButton](#createbutton) section, except each Table of parameters also contains an __index__ entry. This is used to identify each button, used by [editButton](#editbutton) and [removeButton](#removebutton). +[](types.md) Returns a Table of all buttons on this Object. The Table contains parameters tables with the same keys as seen in the [createButton](#createbutton) section, except each Table of parameters also contains an __index__ entry. This is used to identify each button, used by [editButton](#editbutton) and [removeButton](#removebutton). Indexes start at 0. @@ -766,7 +766,7 @@ Indexes start at 0. ####getInputs() -[](/types) Returns a Table of all inputs on this Object. The Table contains parameters tables with the same keys as seen in the [createInput](#createinput) section, except each Table of parameters also contains an __index__ entry. This is used to identify each input, used by [editInput](#editinput) and [removeInput](#removeinput). +[](types.md) Returns a Table of all inputs on this Object. The Table contains parameters tables with the same keys as seen in the [createInput](#createinput) section, except each Table of parameters also contains an __index__ entry. This is used to identify each input, used by [editInput](#editinput) and [removeInput](#removeinput). Indexes start at 0. @@ -775,24 +775,24 @@ Indexes start at 0. ####removeButton(...) -[](/types) Removes a specific button. Indexes start at 0. The first button on any given Object has an index of 0, the next button on it has an index of 1, etc. Each Object has its own indexes. +[](types.md) Removes a specific button. Indexes start at 0. The first button on any given Object has an index of 0, the next button on it has an index of 1, etc. Each Object has its own indexes. Removing an index instantly causes all other higher indexes to shift down 1. !!!info "removeButton(index)" - * [](/types) **index**: Button index to remove. + * [](types.md) **index**: Button index to remove. --- ####removeInput(...) -[](/types) Removes a specific input. Indexes start at 0. The first input on any given Object has an index of 0, the next input on it has an index of 1, etc. Each Object has its own indexes. +[](types.md) Removes a specific input. Indexes start at 0. The first input on any given Object has an index of 0, the next input on it has an index of 1, etc. Each Object has its own indexes. Removing an index instantly causes all other higher indexes to shift down 1. !!!info "removeInput(index)" - * [](/types) **index**: Input index to remove. + * [](types.md) **index**: Input index to remove. --- @@ -824,7 +824,7 @@ Removing an index instantly causes all other higher indexes to shift down 1. ####getCustomObject() -[](/types) Returns a Table with the Custom Object information of a Custom Object. See the [Spawnable Objects](/spawnableobjects) page for the kind of information returned. +[](types.md) Returns a Table with the Custom Object information of a Custom Object. See the [Spawnable Objects](spawnableobjects.md) page for the kind of information returned. ``` Lua -- Example returned Table for a custom token @@ -844,7 +844,7 @@ Removing an index instantly causes all other higher indexes to shift down 1. ####getFogOfWarReveal() -[](/types) Settings impacting [Fog of War](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone) being revealed. In the example returned table, these are the default values of any object. +[](types.md) Settings impacting [Fog of War](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone) being revealed. In the example returned table, these are the default values of any object. !!!note "Color Selection" "Black" and "All" are synonymous for Fog of War. Either means that all players can see the revealed area when `reveal = true`. @@ -863,7 +863,7 @@ Removing an index instantly causes all other higher indexes to shift down 1. ####getJoints() -[](/types) Returns information on any joints attached to this object. This information included the GUID of the other objects attached via the joints. +[](types.md) Returns information on any joints attached to this object. This information included the GUID of the other objects attached via the joints. This function returns a table of sub-tables, each sub-table representing one joint. @@ -921,7 +921,7 @@ end ####getObjects() -[](/types) Returns a Table of objects in the script zone/bag/deck. What it returns varies depending on the type of Object it is used on. +[](types.md) Returns a Table of objects in the script zone/bag/deck. What it returns varies depending on the type of Object it is used on. If an Object is inside of a container, it does not exist in-game. As a result, you only get data on each Object, not an Object reference. @@ -939,12 +939,12 @@ If an Object is inside of a container, it does not exist in-game. As a result, y !!!info "Bag or Deck" Returns a Table of sub-Tables, each sub-Table containing data on 1 bagged item. Indexes start at 0. - * [](/types) **name**: Name of the item. - * [](/types) **description**: Description of the item. - * [](/types) **guid**: GUID of the item. - * [](/types) **index**: Index of the item, represents the item's order in the container. - * [](/types) **lua_script**: Any Lua scripting saved on the item. - * [](/types) **lua_script_state**: Any JSON save data on this item. + * [](types.md) **name**: Name of the item. + * [](types.md) **description**: Description of the item. + * [](types.md) **guid**: GUID of the item. + * [](types.md) **index**: Index of the item, represents the item's order in the container. + * [](types.md) **lua_script**: Any Lua scripting saved on the item. + * [](types.md) **lua_script_state**: Any JSON save data on this item. * {>>nickname: A duplicate of the "name" field.<<} * {>>This is for backwards compatibility purposes only.<<} @@ -970,7 +970,7 @@ This function is often used with [takeObject(...)](#takeobject) to remove object ####getRotationValue() -[](/types) Returns the current rotationValue. Rotation values are used to give value to different rotations (like dice) and are set using scripting or the Gizmo tool. The value returned is for the rotation that is closest to being pointed "up". +[](types.md) Returns the current rotationValue. Rotation values are used to give value to different rotations (like dice) and are set using scripting or the Gizmo tool. The value returned is for the rotation that is closest to being pointed "up". The returned value will either be a number or a string, depending on the value that was given to that rotation. @@ -985,16 +985,16 @@ print(value) ####getRotationValues() -[](/types) Returns a Table of rotation values. Rotation values are used to give value to different rotations (like dice) based on which side is pointed "up". It works by checking all of the rotation values assigned to an object and determining which one of them is closest to pointing up, and then displaying the value associated with that rotation. +[](types.md) Returns a Table of rotation values. Rotation values are used to give value to different rotations (like dice) based on which side is pointed "up". It works by checking all of the rotation values assigned to an object and determining which one of them is closest to pointing up, and then displaying the value associated with that rotation. You can manually assign rotation values to objects using the Rotation Value Gizmo tool (in the left side Gizmo menu) or using [setRotationValues(...)](#setrotationvalues). !!!info "Return Table" The returned Table contains sub-Tables, each sub-Table containing these 2 key/value pairs. - * [](/types) **value**: What value is associated with a given rotation. Often a String or Int. + * [](types.md) **value**: What value is associated with a given rotation. Often a String or Int. * {>>Starting a value with a # will cause it not to show in the Object's tooltip.<<} - * [](/types#vector) **rotation**: Rotation of the Object that best represents the given value pointing up. + * [](types.md#vector) **rotation**: Rotation of the Object that best represents the given value pointing up. ``` Lua -- Example returned Table for a coin @@ -1011,19 +1011,19 @@ You can manually assign rotation values to objects using the Rotation Value Gizm ####getStates() -[](/types) Returns a Table of information on the [states](https://kb.tabletopsimulator.com/host-guides/creating-states/) of an Object. Stated Objects have ids (indexes) starting with 1. +[](types.md) Returns a Table of information on the [states](https://kb.tabletopsimulator.com/host-guides/creating-states/) of an Object. Stated Objects have ids (indexes) starting with 1. !!!tip "The returned table will **NOT** include data on the current state." !!!info "Return Table" Returns a table of sub-tables. Each sub-table represents one other state. - * [](/types) **name**: Name of the item. - * [](/types) **description**: Description of the item. - * [](/types) **guid**: GUID of the item. - * [](/types) **id**: Index of the item, represents the item's order in the states. - * [](/types) **lua_script**: Any Lua scripting saved on the item. - * [](/types) **lua_script_state**: Any JSON save data on this item. + * [](types.md) **name**: Name of the item. + * [](types.md) **description**: Description of the item. + * [](types.md) **guid**: GUID of the item. + * [](types.md) **id**: Index of the item, represents the item's order in the states. + * [](types.md) **lua_script**: Any Lua scripting saved on the item. + * [](types.md) **lua_script_state**: Any JSON save data on this item. * {>>nickname: A duplicate of the "name" field.<<} * {>>This is for backwards compatibility purposes only.<<} @@ -1054,14 +1054,14 @@ You can manually assign rotation values to objects using the Rotation Value Gizm ####getValue() -[](/types) Gets a value. What the value represents depends on what type of Object this function is used on. +[](types.md) Gets a value. What the value represents depends on what type of Object this function is used on. Object | Value -- | -- -[Clock](clock) | Returns Int of stopwatch/timer current time *(in seconds)*. -[Counter](clock) | Returns Int of counter value. +[Clock](clock.md) | Returns Int of stopwatch/timer current time *(in seconds)*. +[Counter](clock.md) | Returns Int of counter value. Rotation Value | Returns Int of the face-up value. For objects with rotation values set using [setRotationValues](#setrotationvalues) this is an index into the table of rotation values. -Hidden Zone | Returns String of the Player [Color](/player-color) of the zone. +Hidden Zone | Returns String of the Player [Color](player-color.md) of the zone. Poker Chip | Returns Int of the face value. {>>Does not work on custom chips.<<} Tablet | Returns String of the current URL. @@ -1096,10 +1096,10 @@ Tablet | Returns String of the current URL. ####setCustomObject(...) -[](/types) Sets a custom Object's properties. It can be used after [spawnObject](/base#spawnobject) or on an already existing custom Object. If used on an already existing custom Object, you must use [reload](#reload) on the object after setCustomObject for the changes to be displayed. +[](types.md) Sets a custom Object's properties. It can be used after [spawnObject](base.md#spawnobject) or on an already existing custom Object. If used on an already existing custom Object, you must use [reload](#reload) on the object after setCustomObject for the changes to be displayed. !!!info "setCustomObject(parameters)" - The Table of parameters varies, depending on which type of custom Object it is. See the [Spawnable Object](/spawnableobjects) page for the parameters needed. + The Table of parameters varies, depending on which type of custom Object it is. See the [Spawnable Object](spawnableobjects.md) page for the parameters needed. ``` Lua -- Example of a custom token @@ -1118,17 +1118,17 @@ obj.setCustomObject(params) ####setFogOfWarReveal(...) -[](/types) Establish the settings and enable/disable an Object's revealing of [Fog of War](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone). +[](types.md) Establish the settings and enable/disable an Object's revealing of [Fog of War](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone). !!!info "setFogOfWarReveal(fog_setting)" - * [](/types) **fog_setting**: A Table containing information on if/how this Object should reveal Fog of War. - * [](/types) **reveal**: Can the Object currently + * [](types.md) **fog_setting**: A Table containing information on if/how this Object should reveal Fog of War. + * [](types.md) **reveal**: Can the Object currently * {>>If this is not used, the current setting for this Object is kept.<<} - * [](/types#vector) **color**: The rotation Vector of the Object that best represents the given value pointing up. + * [](types.md#vector) **color**: The rotation Vector of the Object that best represents the given value pointing up. * {>>If this is not used, the current setting for this Object is kept.<<} * {>>"Black" means "visible to all players."<<} * {>>"All" means "visible to all players."<<} - * [](/types#vector) **range**: How far from the Object the reveal effect reaches (radius, inches). + * [](types.md#vector) **range**: How far from the Object the reveal effect reaches (radius, inches). * {>>If this is not used, the current setting for this Object is kept.<<} ``` Lua @@ -1148,13 +1148,13 @@ self.setFogOfWarReveal(params) ####setRotationValues(...) -[](/types) Sets rotation values of an object. Rotation values are used to give value to different rotations (like dice). It works by checking all of the rotation values assigned to an object and determining which one of them is closest to pointing up, and then displaying the value associated with that rotation. +[](types.md) Sets rotation values of an object. Rotation values are used to give value to different rotations (like dice). It works by checking all of the rotation values assigned to an object and determining which one of them is closest to pointing up, and then displaying the value associated with that rotation. !!!info "setRotationValues(rotation_values)" - * [](/types) **rotation_values**: A Table containing Tables with the following values. 1 sub-Table per "face". - * [](/types) **rotation_values.value**: What value is associated with a given rotation. Often a String or Int. + * [](types.md) **rotation_values**: A Table containing Tables with the following values. 1 sub-Table per "face". + * [](types.md) **rotation_values.value**: What value is associated with a given rotation. Often a String or Int. * {>>Starting a value with a # will cause it not to show in the Object's tooltip.<<} - * [](/types#vector) **rotation_values.rotation**: The rotation Vector of the Object that best represents the given value pointing up. + * [](types.md#vector) **rotation_values.rotation**: The rotation Vector of the Object that best represents the given value pointing up. ``` Lua -- Example setting of rotation values for a coin @@ -1173,14 +1173,14 @@ self.setRotationValues(rotation_values) ####setValue(...) -[](/types) Sets a value on an Object. What the value represents depends on what type of Object it is. +[](types.md) Sets a value on an Object. What the value represents depends on what type of Object it is. Object | Value -- | -- -[Clock](clock) | Set Int for stopwatch/timer current time *(in seconds)*. -[Counter](clock) | Set Int for counter value. +[Clock](clock.md) | Set Int for stopwatch/timer current time *(in seconds)*. +[Counter](clock.md) | Set Int for counter value. Rotation Value | Set Int for the face-up value. For objects with rotation values set with [setRotationValues](#setrotationvalues) this is an index into the table of rotation values. -Hidden Zone | Set String for the Player [Color](color) of the zone. +Hidden Zone | Set String for the [Player Color](player-color.md) of the zone. Tablet | Set String for the current URL. --- @@ -1213,13 +1213,13 @@ Tablet | Set String for the current URL. ####clone(...) -[](/types) Copy/Paste this Object. +[](types.md) Copy/Paste this Object. !!!info "clone(parameters)" - * [](/types) **parameters**: A Table with information used when pasting. - * [](/types#vector) **parameters.position**: Where the Object is placed. + * [](types.md) **parameters**: A Table with information used when pasting. + * [](types.md#vector) **parameters.position**: Where the Object is placed. * {>>Optional, defaults to {x=0, y=3, z=0}.<<} - * [](/types) **parameters.snap_to_grid**: If the Object snaps to grid. + * [](types.md) **parameters.snap_to_grid**: If the Object snaps to grid. * {>>Optional, defaults to false.<<} --- @@ -1228,7 +1228,7 @@ Tablet | Set String for the current URL. ####cut(...) -[](/types) Cuts (splits) a deck down to a given card. In other words, it counts down from the top of the deck and makes a new deck of that size and puts the remaining cards in the other pile. +[](types.md) Cuts (splits) a deck down to a given card. In other words, it counts down from the top of the deck and makes a new deck of that size and puts the remaining cards in the other pile. After the cut, the resulting decks much each have at least 2 cards. This means the parameter used must be between **2** and **totalNumberOfCards - 2**. @@ -1236,13 +1236,13 @@ After the cut, the resulting decks much each have at least 2 cards. This means t New decks take a frame to be created. This means trying to act on them immediately will not work. Use a coroutine or timer to add a delay. !!!info "cut(count)" - * [](/types) **count**: How many cards down to cut the deck. + * [](types.md) **count**: How many cards down to cut the deck. * {>>Optional, if no value is provided the deck is cut in half.<<} !!!info "Returned table" - * [](/types) The table that is returned - * [](/types) **1**: The lower deck, containing the remaining cards in the deck. - * [](/types) **2**: The upper deck, containing *count* number of cards. + * [](types.md) The table that is returned + * [](types.md) **1**: The lower deck, containing the remaining cards in the deck. + * [](types.md) **2**: The upper deck, containing *count* number of cards. ```Lua newDecks = deck.cut(5) @@ -1260,13 +1260,13 @@ newDecks[2].deal(1) ####deal(...) -[](/types) Deals Objects to hand zones. Will deal from decks/bags/stacks as well as individual items. If dealing an individual item to a hand zone, it is a good idea to make sure that its [Member Variable](#member-variables) for `use_hands` is `true`. +[](types.md) Deals Objects to hand zones. Will deal from decks/bags/stacks as well as individual items. If dealing an individual item to a hand zone, it is a good idea to make sure that its [Member Variable](#member-variables) for `use_hands` is `true`. !!!info "deal(number, player_color, index)" - * [](/types) **number**: How many to deal. - * [](/types) **player_color**: The [Player Color](/player-color) to deal to. + * [](types.md) **number**: How many to deal. + * [](types.md) **player_color**: The [Player Color](player-color.md) to deal to. * {>>Optional, defaults to an empty string. If not supplied, it will attempt to deal to all seated players.<<} - * [](/types) **index**: Index of hand zone to deal to. + * [](types.md) **index**: Index of hand zone to deal to. * {>>Optional, defaults to the first created hand zone.<<} --- @@ -1274,12 +1274,12 @@ newDecks[2].deal(1) ####dealToColorWithOffset(...) -[](/types) Deals from a deck to a position relative to the hand zone. +[](types.md) Deals from a deck to a position relative to the hand zone. !!!info "dealToColorWithOffset(offset, flip, player_color)" - * [](/types#vector) **offset**: The x/y/z offset to deal to around the given hand zone. - * [](/types) **flip**: If the card is flipped over when dealt. - * [](/types) **player_color**: Hand zone [Player Color](/player-color) to offset dealing to. + * [](types.md#vector) **offset**: The x/y/z offset to deal to around the given hand zone. + * [](types.md) **flip**: If the card is flipped over when dealt. + * [](types.md) **player_color**: Hand zone [Player Color](player-color.md) to offset dealing to. ``` Lua -- Example of dealing 2 cards in front of the White player, face up. @@ -1292,13 +1292,13 @@ self.dealToColorWithOffset({ 2,0,5}, true, "White") ####jointTo(...) -[](/types) Joints objects together, in the same way the Joint tool does. +[](types.md) Joints objects together, in the same way the Joint tool does. **Using obj.jointTo(), with no object or parameter used as arguments, will remove all joints from that Object.** !!!info "jointTo(object, parameters)" - * [](/types) **object**: The Object that the selected object will be jointed to. - * [](/types) **parameters**: A table of parameters. Which parameters depends on the joint type. See below for more. + * [](types.md) **object**: The Object that the selected object will be jointed to. + * [](types.md) **parameters**: A table of parameters. Which parameters depends on the joint type. See below for more. * {>>All parameters have defaults, the same as the Joint Tool.<<} Example of Fixed: @@ -1345,10 +1345,10 @@ self.jointTo(obj, { ####putObject(...) -[](/types) Places an object into a container (chip stacks/bags/decks). If neither Object is a container, but they are able to be combined (like with 2 cards), then they form a deck/stack. +[](types.md) Places an object into a container (chip stacks/bags/decks). If neither Object is a container, but they are able to be combined (like with 2 cards), then they form a deck/stack. !!!info "putObject(put_object)" - * [](/types) **put_object**: An Object to place into the container. + * [](types.md) **put_object**: An Object to place into the container. !!!info "Returned Object" The container is returned as the Object reference. Either this is the container/deck/stack the other Object was placed into, or the deck/stack that was formed by the putObject action. @@ -1364,7 +1364,7 @@ self.putObject(obj) ####reload() -[](/types) Returns Object reference of itself after it respawns itself. This function causes the Object to be deleted and respawned instantly to refresh it, so its old Object reference will no longer be valid. +[](types.md) Returns Object reference of itself after it respawns itself. This function causes the Object to be deleted and respawned instantly to refresh it, so its old Object reference will no longer be valid. Most often this is used after using [setCustomObject(...)](#setcustomobject) to modify a custom object. @@ -1375,13 +1375,13 @@ Most often this is used after using [setCustomObject(...)](#setcustomobject) to ####split(...) -[](/types) Splits a deck, as evenly as possible, into a number of piles. +[](types.md) Splits a deck, as evenly as possible, into a number of piles. !!!important New decks take a frame to be created. This means trying to act on them immediately will not work. Use a coroutine or timer to add a delay. !!!info "split(piles)" - * [](/types) **piles**: How many piles to split the deck into. + * [](types.md) **piles**: How many piles to split the deck into. * {>>Optional, if no value is provided, it is split into two piles.<<} * {>>Minimum Value: 2<<} * {>>Maximum Value: Number-Of-Cards-In-Deck / 2<<} @@ -1389,10 +1389,10 @@ Most often this is used after using [setCustomObject(...)](#setcustomobject) to !!!info "Returned table" The number of Objects in the table is equal to the number of decks created by the split. They are ordered so any larger decks come first. - * [](/types) The table that is returned - * [](/types) **1**: The first deck created - * [](/types) **2**: The second deck created - * [](/types) **3**: The third deck created (etc) + * [](types.md) The table that is returned + * [](types.md) **1**: The first deck created + * [](types.md) **2**: The second deck created + * [](types.md) **3**: The third deck created (etc) ``` Lua newDecks = deck.split(4) @@ -1413,29 +1413,29 @@ newDecks[4].deal(1) ####takeObject(...) -[](/types) Takes an object from a container (bag/deck/chip stack) and places it in the world. +[](types.md) Takes an object from a container (bag/deck/chip stack) and places it in the world. !!!tip - Spawned Objects take a moment to be physically spawned into the game. The purpose of the callback functionality is to allow you to run additional actions after the Object has been initiated fully into the instance. It is also possible to add a delay using a [Wait](wait) function instead. + Spawned Objects take a moment to be physically spawned into the game. The purpose of the callback functionality is to allow you to run additional actions after the Object has been initiated fully into the instance. It is also possible to add a delay using a [Wait](wait.md) function instead. !!!info "takeObject(parameters)" - * [](/types) **parameters**: A Table of parameters used to determine how takeObject will act. - * [](/types#vector) **parameters.position**: A Vector of the position to place Object. + * [](types.md) **parameters**: A Table of parameters used to determine how takeObject will act. + * [](types.md#vector) **parameters.position**: A Vector of the position to place Object. * {>>Optional, defaults to container's position + 2 on the x axis.<<} - * [](/types#vector) **parameters.rotation**: A Vector of the rotation of the Object. + * [](types.md#vector) **parameters.rotation**: A Vector of the rotation of the Object. * {>>Optional, defaults to the container's rotation.<<} - * [](/types) **parameters.flip**: If the Object is flipped over. + * [](types.md) **parameters.flip**: If the Object is flipped over. * {>>Optional, defaults to false. Only used with decks, not bags/stacks.<<} * {>>If rotation is used, flip's Bool will be ignored.<<} - * [](/types) **parameters.guid**: GUID of the Object to take. + * [](types.md) **parameters.guid**: GUID of the Object to take. * {>>Optional, no default. Only use index or guid, never both.<<} - * [](/types) **parameters.index**: Index of the Object to take. + * [](types.md) **parameters.index**: Index of the Object to take. * {>>Optional, no default. Only use index or guid, never both.<<} - * [](/types) **parameters.top**: If an object is taken from the top (vs bottom). + * [](types.md) **parameters.top**: If an object is taken from the top (vs bottom). * {>>Optional, defaults to true.<<} - * [](/types) **parameters.smooth**: If the taken Object moves smoothly or instantly. + * [](types.md) **parameters.smooth**: If the taken Object moves smoothly or instantly. * {>>Optional, defaults to true.<<} - * [](/types#function) **parameters.callback_function**: Function to activate once the taken Object fully "exists". + * [](types.md#function) **parameters.callback_function**: Function to activate once the taken Object fully "exists". * {>>Optional, defaults to not being used.<<} * {>>A reference to the object spawned is always passed to callback_function. See the example for how to access it.<<} @@ -1471,13 +1471,13 @@ end ####setHiddenFrom(...) -[](/types) Hides the Object from the specified players, as if it were in a hand zone. +[](types.md) Hides the Object from the specified players, as if it were in a hand zone. Using an empty table will cause the Object to remove the hiding effect. !!!info "setHiddenFrom(players)" - * [](/types) **players**: A table containing colors to hide the Object from. - * [](/types) **(color_name)**: Strings of the color name of each player. + * [](types.md) **players**: A table containing colors to hide the Object from. + * [](types.md) **(color_name)**: Strings of the color name of each player. ``` Lua function onLoad() @@ -1494,13 +1494,13 @@ end ####setInvisibleTo(...) -[](/types) Hides the Object from the specified players, as if it were in a hidden zone. +[](types.md) Hides the Object from the specified players, as if it were in a hidden zone. Using an empty table will cause the Object to remove the hiding effect. !!!info "setInvisibleTo(players)" - * [](/types) **players**: A table containing colors to hide the Object from. - * [](/types) **(color_name)**: Strings of the color name of each player. + * [](types.md) **players**: A table containing colors to hide the Object from. + * [](types.md) **(color_name)**: Strings of the color name of each player. ``` Lua function onLoad() @@ -1516,17 +1516,17 @@ end ####attachHider(...) -[](/types) A more advanced version of `setHiddenFrom(...)`, this function is also used to hide objects as if they were in a hand zone. It allows you to identify multiple sources of "hiding" by an ID and toggle the effect on/off easily. +[](types.md) A more advanced version of `setHiddenFrom(...)`, this function is also used to hide objects as if they were in a hand zone. It allows you to identify multiple sources of "hiding" by an ID and toggle the effect on/off easily. This function is slightly more complicated to use for basic hiding, but allows for much easier hiding in complex situations. !!!info "attachHider(id, hidden, players)" - * [](/types) **id**: The unique name for this hiding effect. + * [](types.md) **id**: The unique name for this hiding effect. * {>>Tip: You can use descriptive tag names like "fog" or "blindness"<<} - * [](/types) **hidden**: If the hiding effect is enabled or not. - * [](/types) **players**: A table containing colors to hide the Object from. + * [](types.md) **hidden**: If the hiding effect is enabled or not. + * [](types.md) **players**: A table containing colors to hide the Object from. * {>>Optional, an empty table (or no table) hides for everyone.<<} - * [](/types) **(color_name)**: Strings of the color name of each player. + * [](types.md) **(color_name)**: Strings of the color name of each player. ``` Lua function onLoad() @@ -1545,17 +1545,17 @@ end ####attachInvisibleHider(...) -[](/types) A more advanced version of `setInvisibleTo(...)`, this function is also used to hide objects as if they were in a hidden zone. It allows you to identify multiple sources of "hiding" by an ID and toggle the effect on/off easily. +[](types.md) A more advanced version of `setInvisibleTo(...)`, this function is also used to hide objects as if they were in a hidden zone. It allows you to identify multiple sources of "hiding" by an ID and toggle the effect on/off easily. This function is slightly more complicated to use for basic hiding, but allows for much easier hiding in complex situations. !!!info "attachInvisibleHider(id, hidden, players)" - * [](/types) **id**: The unique name for this hiding effect. + * [](types.md) **id**: The unique name for this hiding effect. * {>>Tip: You can use descriptive tag names like "fog" or "blindness"<<} - * [](/types) **hidden**: If the hiding effect is enabled or not. - * [](/types) **players**: A table containing colors to hide the Object from. + * [](types.md) **hidden**: If the hiding effect is enabled or not. + * [](types.md) **players**: A table containing colors to hide the Object from. * {>>Optional, an empty table (or no table) hides for everyone.<<} - * [](/types) **(color_name)**: Strings of the color name of each player. + * [](types.md) **(color_name)**: Strings of the color name of each player. ``` Lua function onLoad() @@ -1592,18 +1592,18 @@ end ####addDecal(...) -[](/types) Add a Decal onto an object or the game world. +[](types.md) Add a Decal onto an object or the game world. !!!tip "Relative Vectors" When using this function, the vector parameters (position, rotation) are relative to what the decal is being placed on. For example, if you put a decal at `{0,0,0}` on Global, it will attach to the center of the game room. If you do the same to an object, it will place the decal on the origin point of the object. !!!info "addDecal(parameters)" - * [](/types) **parameters**: A Table of parameters used to determine how the function will act. - * [](/types) **parameters.name**: The name of the decal being placed. - * [](/types) **parameters.url**: The file path or URL for the image to be displayed. - * [](/types#vector) **parameters.position**: Position to place Object. - * [](/types#vector) **parameters.rotation**: Rotation of the Object. - * [](/types#vector) **parameters.scale**: How the image is scaled. + * [](types.md) **parameters**: A Table of parameters used to determine how the function will act. + * [](types.md) **parameters.name**: The name of the decal being placed. + * [](types.md) **parameters.url**: The file path or URL for the image to be displayed. + * [](types.md#vector) **parameters.position**: Position to place Object. + * [](types.md#vector) **parameters.rotation**: Rotation of the Object. + * [](types.md#vector) **parameters.scale**: How the image is scaled. * {>>1 is normal scale, 0.5 would be half sized, 2 would be twice as large, etc.<<} ``` Lua @@ -1625,15 +1625,15 @@ end ####call(...) -[](/types) Used to call a Lua function on another entity. +[](types.md) Used to call a Lua function on another entity. *Var is only returned if the function called has a `return`. Otherwise return is `nil`. See example.* > This function can also be used directly on the game world using Global. !!!info "call(func_name, func_params)" - * [](/types) **func_name**: Function name you want to activate. - * [](/types) **func_params**: A Table containing any data you want to pass to that function. + * [](types.md) **func_name**: Function name you want to activate. + * [](types.md) **func_params**: A Table containing any data you want to pass to that function. * {>>Optional, will not be sent by default.<<} ``` Lua @@ -1657,15 +1657,15 @@ end ####getDecals() -[](/types) Returns a table of sub-tables, each sub-table representing one decal. +[](types.md) Returns a table of sub-tables, each sub-table representing one decal. !!!info "Sub-table elements" - * [](/types) **parameters.name**: The name of the decal being placed. - * [](/types) **parameters.url**: The file path or URL for the image to be displayed. - * [](/types#vector) **parameters.position**: Position to place Object. - * [](/types#vector) **parameters.rotation**: Rotation of the Object. - * [](/types#vector) **parameters.scale**: How the image is scaled. + * [](types.md) **parameters.name**: The name of the decal being placed. + * [](types.md) **parameters.url**: The file path or URL for the image to be displayed. + * [](types.md#vector) **parameters.position**: Position to place Object. + * [](types.md#vector) **parameters.rotation**: Rotation of the Object. + * [](types.md#vector) **parameters.scale**: How the image is scaled. * {>>1 is normal scale, 0.5 would be half sized, 2 would be twice as large, etc.<<} Example returned table: @@ -1701,16 +1701,16 @@ print(decalTable[2].name) ####getSnapPoints() -[](/types) Returns a table of sub-tables, each sub-table representing one snap point. +[](types.md) Returns a table of sub-tables, each sub-table representing one snap point. > This function can also be used directly on the game world using Global. !!!info "Sub-table contents" - * [](/types#vector) **position**: Position of the snap point. The position is relative to the entity's center (a local position). + * [](types.md#vector) **position**: Position of the snap point. The position is relative to the entity's center (a local position). * {>>Optional, defaults to {0,0,0}.<<} - * [](/types#vector) **rotation**: Rotation of the snap point. The rotation is relative to the entity's rotation (a local rotation). + * [](types.md#vector) **rotation**: Rotation of the snap point. The rotation is relative to the entity's rotation (a local rotation). * {>>Optional, defaults to {0,0,0}.<<} - * [](/types) **rotation_snap**: If the snap point is a "rotation" snap point. + * [](types.md) **rotation_snap**: If the snap point is a "rotation" snap point. * {>>Optional, defaults to false.<<} @@ -1742,20 +1742,20 @@ Returned table: ####setDecals(...) -[](/types) Sets which decals are on an object. This removes other decals already present, and can remove all decals as well. +[](types.md) Sets which decals are on an object. This removes other decals already present, and can remove all decals as well. !!!tip "Removing decals" Using this function with an empty table will remove all decals from Global or the object it is used on. `Global.setDecals({})` !!!info "setDecals(parameters)" - * [](/types) **parameters**: The main table, which will contain all of the sub-tables. - * [](/types) **subtable**: The sub-table containing each individual decal's information. The sub-tables are unnamed. - * [](/types) **parameters.subtable.name**: The name of the decal being placed. - * [](/types) **parameters.subtable.url**: The file path or URL for the image to be displayed. - * [](/types#vector) **parameters.subtable.position**: A Vector of the position to place Object. - * [](/types#vector) **parameters.subtable.rotation**: A Vector of the rotation of the Object. - * [](/types) **parameters.subtable.scale**: How the image is scaled. + * [](types.md) **parameters**: The main table, which will contain all of the sub-tables. + * [](types.md) **subtable**: The sub-table containing each individual decal's information. The sub-tables are unnamed. + * [](types.md) **parameters.subtable.name**: The name of the decal being placed. + * [](types.md) **parameters.subtable.url**: The file path or URL for the image to be displayed. + * [](types.md#vector) **parameters.subtable.position**: A Vector of the position to place Object. + * [](types.md#vector) **parameters.subtable.rotation**: A Vector of the rotation of the Object. + * [](types.md) **parameters.subtable.scale**: How the image is scaled. * {>>1 is normal scale, 0.5 would be half sized, 2 would be twice as large, etc.<<} ``` Lua @@ -1787,18 +1787,18 @@ end ####setSnapPoints(...) -[](/types) Spawns snap points from a list of parameters. +[](types.md) Spawns snap points from a list of parameters. > This function can also be used on the game world itself using Global. !!!info "setSnapPoints(parameters)" - * [](/types) **parameters**: A table containing numerically indexed sub-tables. - * [](/types) **sub-table**: - * [](/types#vector) **position**: Position of the snap point. This is relative to the entity's position (local). + * [](types.md) **parameters**: A table containing numerically indexed sub-tables. + * [](types.md) **sub-table**: + * [](types.md#vector) **position**: Position of the snap point. This is relative to the entity's position (local). * {>>Optional, defaults to {0,0,0}.<<} - * [](/types#vector) **rotation**: Rotation of the snap point. This is relative to the entity's rotation (local). + * [](types.md#vector) **rotation**: Rotation of the snap point. This is relative to the entity's rotation (local). * {>>Optional, defaults to {0,0,0}.<<} - * [](/types) **rotation_snap**: If the snap point is a "rotation" snap point. + * [](types.md) **rotation_snap**: If the snap point is a "rotation" snap point. * {>>Optional, defaults to false.<<} @@ -1823,18 +1823,18 @@ self.setSnapPoints({ ####setVectorLines(...) -[](/types) Spawns Vector Lines from a list of parameters. +[](types.md) Spawns Vector Lines from a list of parameters. > This function can also be used on the game world itself using Global. !!!info "setVectorLines(parameters)" - * [](/types) **parameters**: The table containing each "line's" data. Each contiguous line has its own sub-table. - * [](/types) **points**: Table containing [Vector positions](/types#vector) for each "point" on the line. - * [](/types#color) **color**: Color the line will be. + * [](types.md) **parameters**: The table containing each "line's" data. Each contiguous line has its own sub-table. + * [](types.md) **points**: Table containing [Vector positions](types.md#vector) for each "point" on the line. + * [](types.md#color) **color**: Color the line will be. * {>>Optional, defaults to {1,1,1}.<<} - * [](/types) **thickness**: How thick the line is (in Unity units). + * [](types.md) **thickness**: How thick the line is (in Unity units). * {>>Optional, defaults to default line size (0.1).<<} - * [](/types#vector) **rotation**: Rotation Vector for the line to be angled. + * [](types.md#vector) **rotation**: Rotation Vector for the line to be angled. * {>>Optional, defaults to {0,0,0}.<<} ``` Lua diff --git a/docs/overview.md b/docs/overview.md index 54038303..6aacbb52 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -5,13 +5,13 @@ You can access the in-game Lua Editor by clicking on **Scripting** on the top ba The advantage of this method is it requires no additional setup. However it lacks many features included in some of the other options. -![Overview](/img/overview1.png) +![Overview](img/overview1.png) ### Official Atom Plugin -The preferred method of writing Lua scripts is using our Official Plugin for the Atom Text Editor. It has all of the functionality of the in-game editor plus line numbers, syntax highlighting, autocomplete, and a modern look. [Click here for setup instructions.](atom) +The preferred method of writing Lua scripts is using our Official Plugin for the Atom Text Editor. It has all of the functionality of the in-game editor plus line numbers, syntax highlighting, autocomplete, and a modern look. [Click here for setup instructions.](atom.md) -![Aton Plugin](/img/overview2.png) +![Aton Plugin](img/overview2.png) ### External Editor API diff --git a/docs/physics.md b/docs/physics.md index 3b25f0e6..c2db4f24 100644 --- a/docs/physics.md +++ b/docs/physics.md @@ -13,7 +13,7 @@ Read example: `print(Physics.play_area)` Write Example = `Physics.play_area = 0. Variable | Description | Type -- | -- | :-- -play_area | The play area being used (ie. how far from middle you can get). Values from 0 - 1. Default is 0.5 | [](/types) +play_area | The play area being used (ie. how far from middle you can get). Values from 0 - 1. Default is 0.5 | [](types.md) --- @@ -31,9 +31,9 @@ Variable | Description | Type Function Name | Description | Return |   -- | -- | -- | -- -cast([](/types) parameters) | Returns Table containing information on hit Objects. | [](/types) | [](#cast) -getGravity() | Returns directional Vector of the direction gravity is pulling. | [](/types#vector) | -setGravity([](/types#vector) direction) | Sets the direction gravity gravity pulls. | [](/types) +cast([](types.md) parameters) | Returns Table containing information on hit Objects. | [](types.md) | [](#cast) +getGravity() | Returns directional Vector of the direction gravity is pulling. | [](types.md#vector) | +setGravity([](types.md#vector) direction) | Sets the direction gravity gravity pulls. | [](types.md) @@ -47,7 +47,7 @@ cast([](/types) parameters) | Returns Table co ###cast(...) -[](/types) Returns Table containing information on hit Objects. There are three kinds of casts: +[](types.md) Returns Table containing information on hit Objects. There are three kinds of casts: Type | Description --- | --- @@ -61,28 +61,28 @@ It draws the imaginary cast, then moves the rap/box/sphere along that path insta Physics casts are somewhat expensive. When running 30+ at once it will cause your game to stutter and/or crash. Do not overuse. !!!info "cast(parameters)" - * [](/types) **parameters**: A Table of parameters used to guide the function. - * [](/types#vector) **parameters.origin**: Position of the starting point. + * [](types.md) **parameters**: A Table of parameters used to guide the function. + * [](types.md#vector) **parameters.origin**: Position of the starting point. * {>>Optional, defaults to {x=0, y=0, z=0}.<<} - * [](/types#vector) **parameters.direction**: A direction for the cast to move in. + * [](types.md#vector) **parameters.direction**: A direction for the cast to move in. * {>>Optional, but cast is motionless without a direction.<<} - * [](/types) **parameters.type**: The type of cast. {>>1 = Ray, 2 = Sphere, 3= Box<<} + * [](types.md) **parameters.type**: The type of cast. {>>1 = Ray, 2 = Sphere, 3= Box<<} * {>>Optional, defaults to 1.<<} - * [](/types#vector) **parameters.size**: Size of the cast shape. Sphere/Box only. + * [](types.md#vector) **parameters.size**: Size of the cast shape. Sphere/Box only. * {>>Optional, defaults to {x=0, y=0, z=0}.<<} - * [](/types#vector) **parameters.orientation**: Rotation of the cast shape. Box only. + * [](types.md#vector) **parameters.orientation**: Rotation of the cast shape. Box only. * {>>Optional, defaults to {x=0, y=0, z=0}.<<} - * [](/types) **parameters.max_distance**: How far the cast will travel. + * [](types.md) **parameters.max_distance**: How far the cast will travel. * {>>Optional, defaults to infinity. Won't move without direction.<<} - * [](/types) **parameters.debug**: If the cast is visualized for the user. + * [](types.md) **parameters.debug**: If the cast is visualized for the user. * {>>Optional, defaults to false.<<} !!!info "Returned Table of Hit Objects" - * [](/types) **table**: A numerically indexed Table, one entry for each hit Object. Entries are in the order of being hit. - * [](/types#vector) **table.point**: Position the cast impacted the Object. - * [](/types#vector) **table.normal**: The surface normal of the impact point. - * [](/types) **table.distance**: Distance between cast origin and impact point. - * [](/types) **table.hit_object**: An Object reference to the Object hit by the cast. + * [](types.md) **table**: A numerically indexed Table, one entry for each hit Object. Entries are in the order of being hit. + * [](types.md#vector) **table.point**: Position the cast impacted the Object. + * [](types.md#vector) **table.normal**: The surface normal of the impact point. + * [](types.md) **table.distance**: Distance between cast origin and impact point. + * [](types.md) **table.hit_object**: An Object reference to the Object hit by the cast. ``` Lua -- Example usage diff --git a/docs/player-color.md b/docs/player-color.md index 1858d01f..07d970d8 100644 --- a/docs/player-color.md +++ b/docs/player-color.md @@ -1,6 +1,6 @@ Each person able to interact with objects in-game is assigned a Player Color to represent them. This is chosen when a Player picks a seat color or is assigned one by the host. Many functions refer to these Players or their hand zones, and it does so via color names. All color names are strings and are case sensitive within functions. -Each color also has an RGB value associated with it. For more information on the RGB Color standard, view the [Color section](types#color). +Each color also has an RGB value associated with it. For more information on the RGB Color standard, view the [Color section](types.md#color). diff --git a/docs/player.md b/docs/player.md index 5ffcd4fd..cfd2fa73 100644 --- a/docs/player.md +++ b/docs/player.md @@ -5,20 +5,20 @@ Example Usage: `Player["White"].seated` or `Player["Green"].mute()` ##Member Variables -Like [Object member variables](object#member-variables), Player has its own member variables. +Like [Object member variables](object.md#member-variables), Player has its own member variables. Variable | Description | Type -- | -- | :-- -admin | If the player is promoted or the host of the game. Read only. | [](/types) -blindfolded | If the player is blindfolded. | [](/types) -color | The player's [Player Color](/player-color). Read only. | [](/types) -host | If the player is the host. Read only. | [](/types) -lift_height | The lift height for the player. This is how far an object is raised when held in a player's hand. Value is ranged 0 to 1. | [](/types) -promoted | If the current player is promoted. | [](/types) -seated | If a player is currently seated at this color. Read only. | [](/types) -steam_id | The Steam ID of the player. This is unique to each player's Steam account. Read only. | [](/types) -steam_name | The Steam name of the player. Read only. | [](/types) -team | The team of the player.
Options: `"None", "Clubs", "Diamonds", "Hearts", "Spades", "Jokers"`. | [](/types) +admin | If the player is promoted or the host of the game. Read only. | [](types.md) +blindfolded | If the player is blindfolded. | [](types.md) +color | The player's [Player Color](player-color.md). Read only. | [](types.md) +host | If the player is the host. Read only. | [](types.md) +lift_height | The lift height for the player. This is how far an object is raised when held in a player's hand. Value is ranged 0 to 1. | [](types.md) +promoted | If the current player is promoted. | [](types.md) +seated | If a player is currently seated at this color. Read only. | [](types.md) +steam_id | The Steam ID of the player. This is unique to each player's Steam account. Read only. | [](types.md) +steam_name | The Steam name of the player. Read only. | [](types.md) +team | The team of the player.
Options: `"None", "Clubs", "Diamonds", "Hearts", "Spades", "Jokers"`. | [](types.md) --- @@ -28,25 +28,25 @@ Variable | Description | Type Function Name | Description | Return |   -- | -- | -- | -- -attachCameraToObject([](/types) parameters) | Makes a Player's camera follow an Object. | [](/types) | [](#attachcameratoobject) -broadcast([](/types) message, [](/types) Color) | Print message on Player's screen and their game chat log. | [](/types) | [](#broadcast) -changeColor([](/types) player_color) | Changes player to this [Player Color](/player-color). | [](/types) | [](#changecolor) -getHandCount() | Number of [hand zones](http://berserk-games.com/knowledgebase/hands/) owned by this color. | [](/types) -getHandObjects([](/types) hand_index) | Objects that are in this [hand zone](http://berserk-games.com/knowledgebase/hands/). | [](/types) | [](#gethandobjects) -getHandTransform([](/types) hand_index) | Returns a Table of data on this [hand zone](http://berserk-games.com/knowledgebase/hands/). | [](/types) | [](#gethandtransform) -getHoldingObjects() | Objects a Player is holding in their hand. | [](/types) -getHoverObject() | Object that the Player's pointer is hovering over. | [](/types) -getPointerPosition() | Player's pointer coordinates. | [](/types#vector) -getPointerRotation() | Player's pointer rotation. | [](/types#vector) -getSelectedObjects() | Objects that the Player has selected with an area selection. | [](/types) -kick() | Kicks Player out of the room. | [](/types) -lookAt([](/types) parameters) | Moves a Player's camera, forcing 3'rd person camera mode. | [](/types) | [](#lookat) -mute() | Mutes or unmutes Player, preventing/allowing voice chat. | [](/types) -pingTable([](/types#vector) position) | Emulates the player using the ping tool at the given position (tapping Tab). | [](/types) -print([](/types) message, [](/types#color) message_color) | Prints a message into the Player's game chat. | [](/types) | [](#print) -promote() | Promotes/demotes a Player. Promoted players have access to most host privileges. | [](/types) | -setCameraMode([](/types) camera_mode) | Sets the player's camera mode. Camera modes available: "ThirdPerson", "FirstPerson", "TopDown". | [](/types) | [](#setcameramode) -setHandTransform([](/types) parameters, [](/types) hand_index) | Sets transform elements of a hand zone. | [](/types) | [](#sethandtransform) +attachCameraToObject([](types.md) parameters) | Makes a Player's camera follow an Object. | [](types.md) | [](#attachcameratoobject) +broadcast([](types.md) message, [](types.md) Color) | Print message on Player's screen and their game chat log. | [](types.md) | [](#broadcast) +changeColor([](types.md) player_color) | Changes player to this [Player Color](player-color.md). | [](types.md) | [](#changecolor) +getHandCount() | Number of [hand zones](http://berserk-games.com/knowledgebase/hands/) owned by this color. | [](types.md) +getHandObjects([](types.md) hand_index) | Objects that are in this [hand zone](http://berserk-games.com/knowledgebase/hands/). | [](types.md) | [](#gethandobjects) +getHandTransform([](types.md) hand_index) | Returns a Table of data on this [hand zone](http://berserk-games.com/knowledgebase/hands/). | [](types.md) | [](#gethandtransform) +getHoldingObjects() | Objects a Player is holding in their hand. | [](types.md) +getHoverObject() | Object that the Player's pointer is hovering over. | [](types.md) +getPointerPosition() | Player's pointer coordinates. | [](types.md#vector) +getPointerRotation() | Player's pointer rotation. | [](types.md#vector) +getSelectedObjects() | Objects that the Player has selected with an area selection. | [](types.md) +kick() | Kicks Player out of the room. | [](types.md) +lookAt([](types.md) parameters) | Moves a Player's camera, forcing 3'rd person camera mode. | [](types.md) | [](#lookat) +mute() | Mutes or unmutes Player, preventing/allowing voice chat. | [](types.md) +pingTable([](types.md#vector) position) | Emulates the player using the ping tool at the given position (tapping Tab). | [](types.md) +print([](types.md) message, [](types.md#color) message_color) | Prints a message into the Player's game chat. | [](types.md) | [](#print) +promote() | Promotes/demotes a Player. Promoted players have access to most host privileges. | [](types.md) | +setCameraMode([](types.md) camera_mode) | Sets the player's camera mode. Camera modes available: "ThirdPerson", "FirstPerson", "TopDown". | [](types.md) | [](#setcameramode) +setHandTransform([](types.md) parameters, [](types.md) hand_index) | Sets transform elements of a hand zone. | [](types.md) | [](#sethandtransform) @@ -55,10 +55,10 @@ These functions return direct references to Players, not a Player Color. See det Function Name | Description | Return |   -- | -- | -- | --: -getAvailableColors() | Returns a table of strings of every valid seat color at the current table. Returned colors are in the default order. | [](/types) -getColors() | Returns a table of strings of every possible seat color. Returned colors are in the default order. | [](/types) -getPlayers() | Returns Table of all Players in the instance. | [](/types) | [](#getplayers) -getSpectators() | Returns Table of all Players in spectator (Grey). | [](/types) | [](#getspectators) +getAvailableColors() | Returns a table of strings of every valid seat color at the current table. Returned colors are in the default order. | [](types.md) +getColors() | Returns a table of strings of every possible seat color. Returned colors are in the default order. | [](types.md) +getPlayers() | Returns Table of all Players in the instance. | [](types.md) | [](#getplayers) +getSpectators() | Returns Table of all Players in spectator (Grey). | [](types.md) | [](#getspectators) --- @@ -69,12 +69,12 @@ getSpectators() | Returns Table of all Players in spectator (Grey). | [](/types) Makes a Player's camera follow an Object. +[](types.md) Makes a Player's camera follow an Object. !!!info "attachCameraToObject(parameters)" - * [](/types) **parameters**: A Table with parameters which guide the function. - * [](/types) **parameters.object**: The Object to attach the camera to. - * [](/types#vector) **parameters.offset**: A Vector to offset the camera by. + * [](types.md) **parameters**: A Table with parameters which guide the function. + * [](types.md) **parameters.object**: The Object to attach the camera to. + * [](types.md#vector) **parameters.offset**: A Vector to offset the camera by. * {>>Optional, defaults to {x=0, y=0, z=0}.<<} ``` Lua @@ -86,11 +86,11 @@ self.attachCameraToObject({object=self}) ####broadcast(...) -[](/types) Print message on Player's screen and their game chat log. +[](types.md) Print message on Player's screen and their game chat log. !!!info "broadcast(message, message_color)" - * [](/types) **message**: The message to be displayed. - * [](/types#color) **message_color**: Tint of the message text. + * [](types.md) **message**: The message to be displayed. + * [](types.md#color) **message_color**: Tint of the message text. * {>>Optional, defaults to {r=1, g=1, b=1}.<<} --- @@ -98,10 +98,10 @@ self.attachCameraToObject({object=self}) ####changeColor(...) -[](/types) Changes player to this [Player Color](/player-color) (seat). +[](types.md) Changes player to this [Player Color](player-color.md) (seat). !!!info "changeColor(player_color)" - * [](/types) **player_color**: The [Player Color](/player-color) seat to move the Player to. + * [](types.md) **player_color**: The [Player Color](player-color.md) seat to move the Player to. ``` Lua Player["White"].changeColor("Red") @@ -112,10 +112,10 @@ Player["White"].changeColor("Red") ####getHandObjects(...) -[](/types) Returns a Table of Objects that are in this [hand zone](http://berserk-games.com/knowledgebase/hands/). +[](types.md) Returns a Table of Objects that are in this [hand zone](http://berserk-games.com/knowledgebase/hands/). !!!info "getHandObjects(hand_index)" - * [](/types) **hand_index**: An index, representing which hand zone to return Objects for. + * [](types.md) **hand_index**: An index, representing which hand zone to return Objects for. * {>>Optional, defaults to 1.<<} !!!tip "Indexing" @@ -126,20 +126,20 @@ Player["White"].changeColor("Red") ####getHandTransform(...) -[](/types) Returns a Table of data on this [hand zone](http://berserk-games.com/knowledgebase/hands/). +[](types.md) Returns a Table of data on this [hand zone](http://berserk-games.com/knowledgebase/hands/). !!!info "getHandTransform(hand_index)" - * [](/types) **hand_index**: An index, representing which hand zone to return data on. + * [](types.md) **hand_index**: An index, representing which hand zone to return data on. * {>>Optional, defaults to 1.<<} !!!info "Return Data Table" - * [](/types) **data**: The Table the data is returned in. - * [](/types#vector) **data.position**: Position of the hand zone. - * [](/types#vector) **data.rotation**: Rotation of the hand zone. - * [](/types#vector) **data.scale**: Scale of the hand zone. - * [](/types#vector) **data.forward**: Forward direction of the hand zone. - * [](/types#vector) **data.right**: Right direction of the hand zone. - * [](/types#vector) **data.up**: Up direction of the hand zone. + * [](types.md) **data**: The Table the data is returned in. + * [](types.md#vector) **data.position**: Position of the hand zone. + * [](types.md#vector) **data.rotation**: Rotation of the hand zone. + * [](types.md#vector) **data.scale**: Scale of the hand zone. + * [](types.md#vector) **data.forward**: Forward direction of the hand zone. + * [](types.md#vector) **data.right**: Right direction of the hand zone. + * [](types.md#vector) **data.up**: Up direction of the hand zone. !!!tip "Indexing" Hand indexes start at 1 and are numbered in the order of their creation. Each Player color has its own indexes. @@ -149,16 +149,16 @@ Player["White"].changeColor("Red") ####lookAt(...) -[](/types) Moves a Player's camera, forcing 3'rd person camera mode. +[](types.md) Moves a Player's camera, forcing 3'rd person camera mode. !!!info "lookAt(parameters)" - * [](/types) **parameters**: A Table of controlling parameters to point the player camera. - * [](/types#vector) **parameters.position**: Position to center the camera on. - * [](/types) **parameters.pitch**: Pitch angle of the camera. 0 to 90. + * [](types.md) **parameters**: A Table of controlling parameters to point the player camera. + * [](types.md#vector) **parameters.position**: Position to center the camera on. + * [](types.md) **parameters.pitch**: Pitch angle of the camera. 0 to 90. * {>>Optional, defaults to 0.<<} - * [](/types) **parameters.yaw**: Yaw angle of the camera. -180 to 180. + * [](types.md) **parameters.yaw**: Yaw angle of the camera. -180 to 180. * {>>Optional, defaults to 0.<<} - * [](/types) **parameters.distance**: Distance the camera is from the position Vector. + * [](types.md) **parameters.distance**: Distance the camera is from the position Vector. * {>>Optional, defaults to 40.<<} ``` Lua @@ -176,11 +176,11 @@ Player["White"].lookAt({ ####print(...) -[](/types) Prints a message into the Player's game chat. +[](types.md) Prints a message into the Player's game chat. !!!info "print(message, message_color)" - * [](/types) **message**: The text to be displayed. - * [](/types#color) **message_color**: Color for the message text to be tinted. + * [](types.md) **message**: The text to be displayed. + * [](types.md#color) **message_color**: Color for the message text to be tinted. * {>>Optional, defaults to {r=1, g=1, b=1}.<<} --- @@ -188,17 +188,17 @@ Player["White"].lookAt({ ####setHandTransform(...) -[](/types) Sets transform elements of a [hand zone](http://berserk-games.com/knowledgebase/hands/). +[](types.md) Sets transform elements of a [hand zone](http://berserk-games.com/knowledgebase/hands/). !!!info "setHandTransform(parameters, hand_index)" - * [](/types) **parameters**: The Table of data to transform the hand zone with. - * [](/types#vector) **parameters.position**: Position of the hand zone. + * [](types.md) **parameters**: The Table of data to transform the hand zone with. + * [](types.md#vector) **parameters.position**: Position of the hand zone. * {>>Optional, defaults to {x=0, y=0, z=0}.<<} - * [](/types#vector) **parameters.rotation**: Rotation of the hand zone. + * [](types.md#vector) **parameters.rotation**: Rotation of the hand zone. * {>>Optional, defaults to {x=0, y=0, z=0}.<<} - * [](/types#vector) **parameters.scale**: Scale of the hand zone. + * [](types.md#vector) **parameters.scale**: Scale of the hand zone. * {>>Optional, defaults to {x=0, y=0, z=0}.<<} - * [](/types) **hand_index**: Index, representing which hand zone to modify. + * [](types.md) **hand_index**: Index, representing which hand zone to modify. * {>>Optional, defaults to 1.<<} !!!tip "Indexing" @@ -219,10 +219,10 @@ Player["White"].setHandTransform(params, 2) ####setCameraMode(...) -[](/types) Sets the player's camera mode. Camera modes available: "ThirdPerson", "FirstPerson", "TopDown". +[](types.md) Sets the player's camera mode. Camera modes available: "ThirdPerson", "FirstPerson", "TopDown". !!!info "changeColor(camera_mode)" - * [](/types) **camera_mode**: The Camera Mode to set the Player's Camera to. + * [](types.md) **camera_mode**: The Camera Mode to set the Player's Camera to. ``` Lua Player["White"].setCameraMode("FirstPerson") @@ -235,7 +235,7 @@ Player["White"].setCameraMode("FirstPerson") ####getPlayers() -[](/types) Returns Table of all Players in the instance. +[](types.md) Returns Table of all Players in the instance. ``` Lua -- Blindfolding all players @@ -250,7 +250,7 @@ end ####getSpectators() -[](/types) Returns Table of all Players in spectator (Grey). +[](types.md) Returns Table of all Players in spectator (Grey). ``` Lua -- Printing steam name of all players to host chat diff --git a/docs/rpgfigurine.md b/docs/rpgfigurine.md index 34754ba8..ce287219 100644 --- a/docs/rpgfigurine.md +++ b/docs/rpgfigurine.md @@ -7,17 +7,17 @@ These functions are called like this: `self.RPGFigurine.attack()`. Function Name | Description | Return -- | -- | -- -attack() | Plays a random attack animation. | [](/types) -changeMode() | Changes the figurine's current mode. What the mode represents is based on the figurine. | [](/types) -die() | Plays the death animation or causes it to return to life. | [](/types) +attack() | Plays a random attack animation. | [](types.md) +changeMode() | Changes the figurine's current mode. What the mode represents is based on the figurine. | [](types.md) +die() | Plays the death animation or causes it to return to life. | [](types.md) ###Event Functions These functions are called by the game whenever a figurine attacks or is attacked. See details for example usage. Function Name | Description |   -- | -- | --: -onAttack([](/types) hit_list) | Activates when an attack is performed by an identified RPGFigurine Object. | [](#onattack) -onHit([](/types) attacker) | Activates when an attack is performed on this RPGFigurine Object. | [](#onattack) +onAttack([](types.md) hit_list) | Activates when an attack is performed by an identified RPGFigurine Object. | [](#onattack) +onHit([](types.md) attacker) | Activates when an attack is performed on this RPGFigurine Object. | [](#onattack) @@ -34,7 +34,7 @@ onHit([](/types) attacker) | Activates when an Activates when an attack is performed by an identified RPGFigurine Object. An attack is triggered via the context menu or pressing the appropriate number key. If another RPGFigurine is within its attack arch, then the function will be triggered with the figurine hit passed as a parameter. !!!info "onAttack(hit_list)" - * [](/types) **hit_list**: A Table of RPGFigurine Object references within the reach of the attack. + * [](types.md) **hit_list**: A Table of RPGFigurine Object references within the reach of the attack. ``` Lua -- Monitoring and announcing a cyclops attacks @@ -57,7 +57,7 @@ end Activates when an attack is performed on this RPGFigurine Object. An attack is triggered via the context menu or pressing the appropriate number key. If this RPGFigurine is within the attack radius, this function is triggered, passing a parameter of the Object which attacked. !!!info "onHit(attacker)" - * [](/types) **attacker**: Reference to the RPGFigurine attacking the indicated RPGFigurine. + * [](types.md) **attacker**: Reference to the RPGFigurine attacking the indicated RPGFigurine. ``` Lua -- Monitoring and announcing a cyclops being hit diff --git a/docs/spawnableobjects.md b/docs/spawnableobjects.md index d1d69843..b4ed9de3 100644 --- a/docs/spawnableobjects.md +++ b/docs/spawnableobjects.md @@ -1,4 +1,4 @@ -Objects can be spawned by any script using the [spawnObject()](base#spawnobject) function. These are the `type` Strings used to designate the type of Object to spawn. +Objects can be spawned by any script using the [spawnObject()](base.md#spawnobject) function. These are the `type` Strings used to designate the type of Object to spawn. ##Built-in Game Objects @@ -159,20 +159,20 @@ Objects can be spawned by any script using the [spawnObject()](base#spawnobject) ##Custom Game Objects -You can also spawn [custom Objects](https://kb.tabletopsimulator.com/custom-content/about-custom-objects/) and then provide the custom content for them after spawning them by calling [setCustomObject()](object#setcustomobject). {>>See setCustomObject for usage<<} +You can also spawn [custom Objects](https://kb.tabletopsimulator.com/custom-content/about-custom-objects/) and then provide the custom content for them after spawning them by calling [setCustomObject()](object.md#setcustomobject). {>>See setCustomObject for usage<<} -You can also use setCustomObject along with [reload()](object#reload) to modify an existing custom Object. +You can also use setCustomObject along with [reload()](object.md#reload) to modify an existing custom Object. ###Custom AssetBundle * Custom_Assetbundle !!!info "Custom Parameters" - * [](/types) **parameters**: A Table of parameters which determine the properties of the Object. - * [](/types) **assetbundle**: The path/url for the AssetBundle. - * [](/types) **assetbundle_secondary**: The path/url for the secondary AssetBundle property. + * [](types.md) **parameters**: A Table of parameters which determine the properties of the Object. + * [](types.md) **assetbundle**: The path/url for the AssetBundle. + * [](types.md) **assetbundle_secondary**: The path/url for the secondary AssetBundle property. * {>>Optional, is not used by default.<<} - * [](/types) **type**: An Int representing the Object's type. + * [](types.md) **type**: An Int representing the Object's type. * {>>Optional, defaults to 0.<<} * **0**: Generic * **1**: Figurine @@ -182,7 +182,7 @@ You can also use setCustomObject along with [reload()](object#reload) to modify * **5**: Chip * **6**: Bag * **7**: Infinite bag - * [](/types) **material**: An Int representing the Object's material. + * [](types.md) **material**: An Int representing the Object's material. * {>>Optional, defaults to 0.<<} * **0**: Plastic * **1**: Wood @@ -196,8 +196,8 @@ You can also use setCustomObject along with [reload()](object#reload) to modify * Custom_Board !!!info "Custom Parameters" - * [](/types) **parameters**: A Table of parameters which determine the properties of the Object. - * [](/types) **image**: The path/url for the board. + * [](types.md) **parameters**: A Table of parameters which determine the properties of the Object. + * [](types.md) **image**: The path/url for the board. @@ -208,20 +208,20 @@ You can also use setCustomObject along with [reload()](object#reload) to modify * DeckCustom !!!info "Custom Parameters" - * [](/types) **parameters**: A Table of parameters which determine the properties of the Object. - * [](/types) **face**: The path/url of the face cardsheet. - * [](/types) **back**: The path/url of the back cardsheet or card back. - * [](/types) **unique_back**: If each card has a unique card back (via a cardsheet). + * [](types.md) **parameters**: A Table of parameters which determine the properties of the Object. + * [](types.md) **face**: The path/url of the face cardsheet. + * [](types.md) **back**: The path/url of the back cardsheet or card back. + * [](types.md) **unique_back**: If each card has a unique card back (via a cardsheet). * {>>Optional, defaults to false.<<} - * [](/types) **width**: The number of columns on the cardsheet. + * [](types.md) **width**: The number of columns on the cardsheet. * {>>Optional, defaults to 10.<<} - * [](/types) **height**: The number of rows on the cardsheet. + * [](types.md) **height**: The number of rows on the cardsheet. * {>>Optional, defaults to 7.<<} - * [](/types) **number**: The number of cards on the cardsheet. + * [](types.md) **number**: The number of cards on the cardsheet. * {>>Optional, defaults to 52.<<} - * [](/types) **sideways**: If the cards are horizontal instead of vertical. + * [](types.md) **sideways**: If the cards are horizontal instead of vertical. * {>>Optional, defaults to false.<<} - * [](/types) **back_is_hidden**: If cards have a special face that shows up when hidden in a hand zone. + * [](types.md) **back_is_hidden**: If cards have a special face that shows up when hidden in a hand zone. * {>>Optional, defaults to false.<<} @@ -232,9 +232,9 @@ You can also use setCustomObject along with [reload()](object#reload) to modify * Custom_Dice !!!info "Custom Parameters" - * [](/types) **parameters**: A Table of parameters which determine the properties of the Object. - * [](/types) **image**: The path/url for the [custom die](http://berserk-games.com/knowledgebase/custom-dice/). - * [](/types) **type**: The type of die, which determines its number of sides. + * [](types.md) **parameters**: A Table of parameters which determine the properties of the Object. + * [](types.md) **image**: The path/url for the [custom die](http://berserk-games.com/knowledgebase/custom-dice/). + * [](types.md) **type**: The type of die, which determines its number of sides. * {>>Optional, defaults to 1.<<} * **0**: 4-sided * **1**: 6-sided @@ -250,9 +250,9 @@ You can also use setCustomObject along with [reload()](object#reload) to modify * Figurine_Custom !!!info "Custom Parameters" - * [](/types) **parameters**: A Table of parameters which determine the properties of the Object. - * [](/types) **image**: The path/url for the [custom figurine](http://berserk-games.com/knowledgebase/custom-figurines/). - * [](/types) **image_secondary**: The path/url for the custom figurine's back. + * [](types.md) **parameters**: A Table of parameters which determine the properties of the Object. + * [](types.md) **image**: The path/url for the [custom figurine](http://berserk-games.com/knowledgebase/custom-figurines/). + * [](types.md) **image_secondary**: The path/url for the custom figurine's back. * {>>Optional, defaults to "image".<<} @@ -262,16 +262,16 @@ You can also use setCustomObject along with [reload()](object#reload) to modify * Custom_Model !!!info "Custom Parameters" - * [](/types) **parameters**: A Table of parameters which determine the properties of the Object. - * [](/types) **mesh**: The path/url for the .obj mesh used on the [custom model](http://berserk-games.com/knowledgebase/custom-models/). - * [](/types) **diffuse**: The path/url for the diffuse image. - * [](/types) **normal**: The path/url for the normals image. + * [](types.md) **parameters**: A Table of parameters which determine the properties of the Object. + * [](types.md) **mesh**: The path/url for the .obj mesh used on the [custom model](http://berserk-games.com/knowledgebase/custom-models/). + * [](types.md) **diffuse**: The path/url for the diffuse image. + * [](types.md) **normal**: The path/url for the normals image. * {>>Optional, is not used by default.<<} - * [](/types) **collider**: The path/url for the collider mesh. + * [](types.md) **collider**: The path/url for the collider mesh. * {>>Optional, defaults to a generic box collider.<<} - * [](/types) **convex**: If the object model is convex. + * [](types.md) **convex**: If the object model is convex. * {>>Optional, defaults to false.<<} - * [](/types) **type**: An Int representing the Object's type. + * [](types.md) **type**: An Int representing the Object's type. * {>>Optional, defaults to 0.<<} * **0**: Generic * **1**: Figurine @@ -281,21 +281,21 @@ You can also use setCustomObject along with [reload()](object#reload) to modify * **5**: Chip * **6**: Bag * **7**: Infinite bag - * [](/types) **material**: An Int representing the Object's material. + * [](types.md) **material**: An Int representing the Object's material. * {>>Optional, defaults to 0.<<} * **0**: Plastic * **1**: Wood * **2**: Metal * **3**: Cardboard - * [](/types) **specular_intensity**: The specular intensity. + * [](types.md) **specular_intensity**: The specular intensity. * {>>Optional, defaults to 0.1.<<} - * [](/types) **specular_color**: The specular [Color](types#color). + * [](types.md) **specular_color**: The specular [Color](types.md#color). * {>>Optional, defaults to {r=1, g=1, b=1}.<<} - * [](/types) **specular_sharpness**: The specular sharpness. + * [](types.md) **specular_sharpness**: The specular sharpness. * {>>Optional, defaults to 3.<<} - * [](/types) **freshnel_strength**: The freshnel strength. + * [](types.md) **freshnel_strength**: The freshnel strength. * {>>Optional, defaults to 0.1.<<} - * [](/types) **cast_shadows**: If the Object casts shadows. + * [](types.md) **cast_shadows**: If the Object casts shadows. * {>>Optional, defaults to true.<<} @@ -305,18 +305,18 @@ You can also use setCustomObject along with [reload()](object#reload) to modify * Custom_Tile !!!info "Custom Parameters" - * [](/types) **parameters**: A Table of parameters which determine the properties of the Object. - * [](/types) **image**: The path/url for the [custom tile](http://berserk-games.com/knowledgebase/custom-tiles/) image. - * [](/types) **type**: Determines the shape of the tile. + * [](types.md) **parameters**: A Table of parameters which determine the properties of the Object. + * [](types.md) **image**: The path/url for the [custom tile](http://berserk-games.com/knowledgebase/custom-tiles/) image. + * [](types.md) **type**: Determines the shape of the tile. * {>>Optional, defaults to 0.<<} * **0**: Square/Rectangle * **1**: Hex * **2**: Circle - * [](/types) **image_bottom**: The path/url for the bottom-side image. + * [](types.md) **image_bottom**: The path/url for the bottom-side image. * {>>Optional, uses the top image by default.<<} - * [](/types) **thickness**: How thick the tile is. + * [](types.md) **thickness**: How thick the tile is. * {>>Optional, defaults to 0.5.<<} - * [](/types) **stackable**: If these tiles stack together into a pile. + * [](types.md) **stackable**: If these tiles stack together into a pile. * {>>Optional, defaults to false.<<} @@ -325,11 +325,11 @@ You can also use setCustomObject along with [reload()](object#reload) to modify * Custom_Token !!!info "Custom Parameters" - * [](/types) **parameters**: A Table of parameters which determine the properties of the Object. - * [](/types) **image**: The path/url for the [custom token](http://berserk-games.com/knowledgebase/custom-tokens/) image. - * [](/types) **thickness**: How thick the tile is. + * [](types.md) **parameters**: A Table of parameters which determine the properties of the Object. + * [](types.md) **image**: The path/url for the [custom token](http://berserk-games.com/knowledgebase/custom-tokens/) image. + * [](types.md) **thickness**: How thick the tile is. * {>>Optional, defaults to 0.2.<<} - * [](/types) **mege_distance**: How accurate the edges are to the image. + * [](types.md) **mege_distance**: How accurate the edges are to the image. * {>>Optional, defaults to 15.<<} - * [](/types) **stackable**: If these tiles stack together into a pile. + * [](types.md) **stackable**: If these tiles stack together into a pile. * {>>Optional, defaults to false.<<} diff --git a/docs/texttool.md b/docs/texttool.md index aa005b24..09c0ce15 100644 --- a/docs/texttool.md +++ b/docs/texttool.md @@ -6,9 +6,9 @@ TextTool is a special Object type for creating text labels in the game instance. Function Name | Description | Return -- | -- | -- -getFontColor() | Returns Table of font Color. | [](/types#color) -getFontSize() | Returns Int of the font size. | [](/types) -getValue() | Returns the current text. Works the same as Object's [getValue()](object#getvalue). | [](/types) -setFontColor([](/types#color) font_color) | Sets font Color. | [](/types) -setFontSize([](/types) font_size) | Sets font size. | [](/types) -setValue([](/types) text) | Sets the current text. Works the same as Object's [setValue(...)](object#setvalue). | [](/types) +getFontColor() | Returns Table of font Color. | [](types.md#color) +getFontSize() | Returns Int of the font size. | [](types.md) +getValue() | Returns the current text. Works the same as Object's [getValue()](object.md#getvalue). | [](types.md) +setFontColor([](types.md#color) font_color) | Sets font Color. | [](types.md) +setFontSize([](types.md) font_size) | Sets font size. | [](types.md) +setValue([](types.md) text) | Sets the current text. Works the same as Object's [setValue(...)](object.md#setvalue). | [](types.md) diff --git a/docs/time.md b/docs/time.md index 69d633b7..2b4ba04b 100644 --- a/docs/time.md +++ b/docs/time.md @@ -7,8 +7,8 @@ All of the member variables of time are read only. Function Name | Description | Return -- | -- | -- -time | Returns the current time. Works like `os.time()` but is more accurate. | [](/types) -delta_time | Returns the amount of time since the last frame. | [](/types) -fixed_time | Returns a number like `time` does, but using Fixed updates. | [](/types) -fixed_delta_time | Returns a number like `delta_time` does, but using Fixed updates. | [](/types) -frame_count | Returns the amount of total frames since the scene began. | [](/types) +time | Returns the current time. Works like `os.time()` but is more accurate. | [](types.md) +delta_time | Returns the amount of time since the last frame. | [](types.md) +fixed_time | Returns a number like `time` does, but using Fixed updates. | [](types.md) +fixed_delta_time | Returns a number like `delta_time` does, but using Fixed updates. | [](types.md) +frame_count | Returns the amount of total frames since the scene began. | [](types.md) diff --git a/docs/timer.md b/docs/timer.md index e688bbb1..733938db 100644 --- a/docs/timer.md +++ b/docs/timer.md @@ -9,8 +9,8 @@ Timer is a static global class which provides methods for executing other functi Function Name | Description | Return |   -- | -- | -- | --: -create([](/types) parameters) | Creates a Timer. It will auto-delete once its repetitions have been completed. | [](/types) | [](#create) -destroy([](/types) identifier) | Destroys a Timer. | [](/types) | [](#destroy) +create([](types.md) parameters) | Creates a Timer. It will auto-delete once its repetitions have been completed. | [](types.md) | [](#create) +destroy([](types.md) identifier) | Destroys a Timer. | [](types.md) | [](#destroy) --- @@ -19,20 +19,20 @@ destroy([](/types) identifier) | Destroys a Ti ###create(...) -[](/types) Creates a Timer. It will auto-delete once its repetitions have been completed. +[](types.md) Creates a Timer. It will auto-delete once its repetitions have been completed. !!!info "create(parameters)" - * [](/types) **parameters**: A Table containing the information used to start the Timer. - * [](/types) **identifier**: Timer's name, used to destroy it. Must be unique within all other scripts. - * [](/types) **function_name**: Name of function to trigger when time is reached. - * [](/types) **function_owner**: Where the function from function_name exists. + * [](types.md) **parameters**: A Table containing the information used to start the Timer. + * [](types.md) **identifier**: Timer's name, used to destroy it. Must be unique within all other scripts. + * [](types.md) **function_name**: Name of function to trigger when time is reached. + * [](types.md) **function_owner**: Where the function from function_name exists. * {>>Optional, defaults to the calling Object.<<} - * [](/types) **parameters**: Table containing any data that will be passed to the function. + * [](types.md) **parameters**: Table containing any data that will be passed to the function. * {>>Optional, will not be used by default.<<} - * [](/types) **delay**: Length of time before the function is triggered. + * [](types.md) **delay**: Length of time before the function is triggered. * {>>Optional, defaults to 0.<<} * {>>0 results in a delay of 1 frame before the triggered function activates.<<} - * [](/types) **repetitions**: Number of times the countdown repeats. + * [](types.md) **repetitions**: Number of times the countdown repeats. * {>>Optional, defaults to 1.<<} * {>>Use 0 for infinite repetitions.<<} @@ -61,7 +61,7 @@ end ###destroy(...) -[](/types) Destroys a Timer. A timer, if it completes its number of repetitions, will automatically destroy itself. +[](types.md) Destroys a Timer. A timer, if it completes its number of repetitions, will automatically destroy itself. !!!info "destroy(identifier)" - * [](/types) **identifier**: The unique identifier for the timer you want to destroy. + * [](types.md) **identifier**: The unique identifier for the timer you want to destroy. diff --git a/docs/turns.md b/docs/turns.md index d166c340..3ba0956a 100644 --- a/docs/turns.md +++ b/docs/turns.md @@ -4,18 +4,18 @@ Example usage: `Turns.reverse_order = true`. ##Member Variables -Like [Object member variables](object#member-variables), Turns has its own member variables. +Like [Object member variables](object.md#member-variables), Turns has its own member variables. Variable | Description | Type -- | -- | :-- -enable | Enable/disable the turns system. | [](/types) -type | If the turn order is automatic or custom. 1=auto, 2=custom. | [](/types) -order | A table of strings, representing the player turn order. | [](/types) -reverse_order | Enable/disable reversing turn rotation direction. | [](/types) -skip_empty_hands | Enable/disable skipping empty hands. | [](/types) -disable_interactations | Enable/disable the blocking of players ability to interact with Objects when it is not their turn. | [](/types) -pass_turns | Enable/disable a player's ability to pass their turn to another. | [](/types) -turn_color | The color of the Player who's turn it is. | [](/types) +enable | Enable/disable the turns system. | [](types.md) +type | If the turn order is automatic or custom. 1=auto, 2=custom. | [](types.md) +order | A table of strings, representing the player turn order. | [](types.md) +reverse_order | Enable/disable reversing turn rotation direction. | [](types.md) +skip_empty_hands | Enable/disable skipping empty hands. | [](types.md) +disable_interactations | Enable/disable the blocking of players ability to interact with Objects when it is not their turn. | [](types.md) +pass_turns | Enable/disable a player's ability to pass their turn to another. | [](types.md) +turn_color | The color of the Player who's turn it is. | [](types.md) ##Function Summary @@ -24,8 +24,8 @@ Variable | Description | Type Function Name | Description | Return -- | -- | --: -getNextTurnColor() | Returns the Player Color string of the next player in the turn order. | [](/types) -getPreviousTurnColor() | Returns the Player Color string of the previous player in the turn order. | [](/types) +getNextTurnColor() | Returns the Player Color string of the next player in the turn order. | [](types.md) +getPreviousTurnColor() | Returns the Player Color string of the previous player in the turn order. | [](types.md) diff --git a/docs/types.md b/docs/types.md index 048b2579..49a82dd0 100644 --- a/docs/types.md +++ b/docs/types.md @@ -4,16 +4,15 @@ Type refers to the type of information being used. You do not need to declare a Tag | Type | Description | Example -- | -- | -- | -- -[](/types) | nil | No value. | `#!lua nil` -[](/types) | int | Non-decimal value. | `#!lua 5` -[](/types) | float | Non-exact decimal value. | `#!lua 2.032` -[](/types) | bool | `true` or `false` value. | `#!lua true` -[](/types) | string | A series of characters. | `#!lua "Hello."` -[](/types) | table | A container with keys and values. | `#!lua {["key"]="value", true, 5}` -[](/types) | object | An in-game physical Object. Sometimes Global. | `#!lua Global or self` -[](/types) | self | A reference to the current Lua Object. | `#!lua self` -[](/types) | player | An in-game Player. | `#!lua Player["White"]` -[](/types) | variable | A combination of other types. | +[](types.md) | nil | No value. | `#!lua nil` +[](types.md) | int | Non-decimal value. | `#!lua 5` +[](types.md) | float | Non-exact decimal value. | `#!lua 2.032` +[](types.md) | bool | `true` or `false` value. | `#!lua true` +[](types.md) | string | A series of characters. | `#!lua "Hello."` +[](types.md) | table | A container with keys and values. | `#!lua {["key"]="value", true, 5}` +[](types.md) | object | An in-game physical Object. Sometimes Global. | `#!lua Global or self` +[](types.md) | player | An in-game Player. | `#!lua Player["White"]` +[](types.md) | variable | A combination of other types. | You will also see tags for Color, Vector, and Function. See below for more info. @@ -74,7 +73,7 @@ self.setColorTint({50/255, 83/255, 199/255}) ####Strings -You are also able to use a String in place of a color table. Using a [Player Color](player-color) will automatically fill in that value. It works with any of the 12 color names, as they are written on the [Player Color](player-color) page. +You are also able to use a String in place of a color table. Using a [Player Color](player-color.md) will automatically fill in that value. It works with any of the 12 color names, as they are written on the [Player Color](player-color.md) page. Example: `printToAll("Test", "Green")` @@ -83,7 +82,7 @@ Example: `printToAll("Test", "Green")` ###Vector Vector is a type of Object with x, y, and z coordinates that is used to define a position, rotation or direction. -You can use the [Vector](../vector) class to manipulate vectors. +You can use the [Vector](vector.md) class to manipulate vectors. Example: `#!lua target = Vector(1, 0, 0) + Vector(0, 2, 0):normalized()` @@ -96,7 +95,7 @@ The Table will contain the keys `x`, `y`, `z` and/or `1`, `2`, `3`. The letter a y | 2 z | 3 -As an example, An Object at coordinate X=5, Y=2, Z=-1 would return this [`Vector`](../vector): +As an example, An Object at coordinate X=5, Y=2, Z=-1 would return this [`Vector`](vector.md): ``` Lua { x=5, y=2, z=-1, @@ -105,7 +104,7 @@ As an example, An Object at coordinate X=5, Y=2, Z=-1 would return this [`Vector ####Mixed Keys -Before [`Vector`](../vector) was introduced, coordinate tables contained separate values under 1, 2, 3 and x, y, z keys, with letter keys taking precedence when they were different. This is no longer the case, and using letter and numerical keys is equivalent. However, when iterating over Vector components you have to use `pairs` and only letter keys will be read there. +Before [`Vector`](vector.md) was introduced, coordinate tables contained separate values under 1, 2, 3 and x, y, z keys, with letter keys taking precedence when they were different. This is no longer the case, and using letter and numerical keys is equivalent. However, when iterating over Vector components you have to use `pairs` and only letter keys will be read there. ####Value Range @@ -129,7 +128,7 @@ World | The center of the instance is `{x=0, y=0, z=0}`. That is usually near th Local | The center of the Object's model is `{x=0, y=0, z=0}`. The center of an Object is determined by the model's creator. ???tip "Conversion Between World/Local" - [positionToWorld(...)](object#positiontoworld) and [positionToLocal(...)](object#positiontolocal) can be used to convert between the two types. + [positionToWorld(...)](object.md#positiontoworld) and [positionToLocal(...)](object.md#positiontolocal) can be used to convert between the two types. #####Rotation @@ -176,7 +175,7 @@ end ####Example -As an example, here is [Wait.frames(...)](wait#frames) used 3 times. It waits a set number of frames and then activates a given function: +As an example, here is [Wait.frames(...)](wait.md#frames) used 3 times. It waits a set number of frames and then activates a given function: ``` Lua function onLoad() diff --git a/docs/ui.md b/docs/ui.md index eb288a67..cf306ad6 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -1,7 +1,7 @@ UI, a static global class AND an Object class. It is the method to interact with custom UI elements. It allows you to read/write attributes of elements defined in the XML of the UI. It also allows you to receive information from various inputs (like buttons) on-screen and on objects. !!!attention - This class allows for the **manipulation** of UI **at runtime**. It does **NOT** modify or fetch **the original XML** in the editor, but rather what is displayed as it continues to run during a game. Just like with Lua, you can only get/set dynamic values during runtime. You can use [onSave](event#onsave) and [onLoad](event#onload) to record any data you want to persist through save/load/undo. + This class allows for the **manipulation** of UI **at runtime**. It does **NOT** modify or fetch **the original XML** in the editor, but rather what is displayed as it continues to run during a game. Just like with Lua, you can only get/set dynamic values during runtime. You can use [onSave](event.md#onsave) and [onLoad](event.md#onload) to record any data you want to persist through save/load/undo. For more information on how to build UI elements within XML, view the [UI API](ui/introUI.md). @@ -17,15 +17,15 @@ UI can either be placed on the screen by using the **Global UI** or placed on an ##Inputs -[Input Elements](ui/inputelements) are able to trigger a function. By default, Global UI will trigger a function in Global and Object UI will trigger a function in the Object's script. To change the target script for an input, [view more details here](ui/inputelements#targeting-triggers). +[Input Elements](ui/inputelements.md) are able to trigger a function. By default, Global UI will trigger a function in Global and Object UI will trigger a function in the Object's script. To change the target script for an input, [view more details here](ui/inputelements.md#targeting-triggers). When creating the input element in XML, you will select the name of the function it activates. Regardless of its name, it always will pass parameters !!!info "functionName(player, value, id)" - * [](/types) **player**: A direct Player reference to the person that triggered the input. - * [](/types) **value**: The value sent by the input. A numeric value or a string, generally. + * [](types.md) **player**: A direct Player reference to the person that triggered the input. + * [](types.md) **value**: The value sent by the input. A numeric value or a string, generally. * {>>This is not used by buttons!<<} - * [](/types) **id**: + * [](types.md) **id**: * {>>This is only passed if the element was given an Id attribute in the XML.<<} ```lua @@ -41,20 +41,20 @@ end Function Name | Description | Return |   -- | -- | -- | -- -getAttribute([](/types) id, [](/types) attribute) | Obtains the value of a specified attribute of a UI element. | [](/types) | [](#getattribute) -getAttributes([](/types) id) | Returns the attributes and their values of a UI element. | [](/types) | [](#getattributes) -getCustomAssets() | Returns information on all custom assets uploaded to the UI ASSETS pane. | [](/types) | [](#getcustomassets) -getValue([](/types) id) | Obtains the value between elements tags, like: `ValueToGet` | [](/types) | [](#getvalue) -getXml() | Returns the run-time UI's XML in string format. | [](/types) | -getXmlTable() | Returns the run-time UI's XML formatted as a Lua table. | [](/types) | [](#getxmltable) -hide([](/types) id) | Hides the given UI element. Unlike the "active" attribute, hide triggers animations. | [](/types) | [](#hide) -setAttribute([](/types) id, [](/types) attribute, [](/types) value) | Sets the value of a specified attribute of a UI element. | [](/types) | [](#setattribute) -setAttributes([](/types) id, [](/types) data) | Updates the value of the supplied attributes of a UI element. | [](/types) | [](#setattributes) -setCustomAssets([](/types) assets) | Sets the UI ASSETS (like custom images) for global or an Object. | [](/types) | [](#setcustomassets) -setValue([](/types) id, [](/types) value) | Updates the value between elements tags, like: `ValueChanged` | [](/types) | [](#setvalue) -setXml([](/types) xml) | Replaces the run-time UI with the XML string. | [](/types) | [](#setxml) -setXmlTable([](/types) data) | Replaces the run-time UI with an XML string which is generated from a table of data. | [](/types) | [](#setxmltable) -show([](/types) id) | Displays the given UI element. Unlike the "active" attribute, show triggers animations. | [](/types) | [](#show) +getAttribute([](types.md) id, [](types.md) attribute) | Obtains the value of a specified attribute of a UI element. | [](types.md) | [](#getattribute) +getAttributes([](types.md) id) | Returns the attributes and their values of a UI element. | [](types.md) | [](#getattributes) +getCustomAssets() | Returns information on all custom assets uploaded to the UI ASSETS pane. | [](types.md) | [](#getcustomassets) +getValue([](types.md) id) | Obtains the value between elements tags, like: `ValueToGet` | [](types.md) | [](#getvalue) +getXml() | Returns the run-time UI's XML in string format. | [](types.md) | +getXmlTable() | Returns the run-time UI's XML formatted as a Lua table. | [](types.md) | [](#getxmltable) +hide([](types.md) id) | Hides the given UI element. Unlike the "active" attribute, hide triggers animations. | [](types.md) | [](#hide) +setAttribute([](types.md) id, [](types.md) attribute, [](types.md) value) | Sets the value of a specified attribute of a UI element. | [](types.md) | [](#setattribute) +setAttributes([](types.md) id, [](types.md) data) | Updates the value of the supplied attributes of a UI element. | [](types.md) | [](#setattributes) +setCustomAssets([](types.md) assets) | Sets the UI ASSETS (like custom images) for global or an Object. | [](types.md) | [](#setcustomassets) +setValue([](types.md) id, [](types.md) value) | Updates the value between elements tags, like: `ValueChanged` | [](types.md) | [](#setvalue) +setXml([](types.md) xml) | Replaces the run-time UI with the XML string. | [](types.md) | [](#setxml) +setXmlTable([](types.md) data) | Replaces the run-time UI with an XML string which is generated from a table of data. | [](types.md) | [](#setxmltable) +show([](types.md) id) | Displays the given UI element. Unlike the "active" attribute, show triggers animations. | [](types.md) | [](#show) @@ -65,11 +65,11 @@ show([](/types) id) | Displays the given UI el ###getAttribute(...) -[](/types) Obtains the value of a specified attribute of a UI element. What it returns will typically be a string or a number. +[](types.md) Obtains the value of a specified attribute of a UI element. What it returns will typically be a string or a number. !!!info "getAttribute(id, attribute)" - * [](/types) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. - * [](/types) **attribute**: The name of the attribute you wish to get the value of. + * [](types.md) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. + * [](types.md) **attribute**: The name of the attribute you wish to get the value of. ``` Lua self.UI.getAttribute("testElement", "fontSize") @@ -80,15 +80,15 @@ self.UI.getAttribute("testElement", "fontSize") ###getAttributes(...) -[](/types) Returns the attributes and their values of a UI element. It only returns the attributes (and values) for elements that have had those attributes set by the user. +[](types.md) Returns the attributes and their values of a UI element. It only returns the attributes (and values) for elements that have had those attributes set by the user. !!!info "getAttributes(id)" - * [](/types) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. + * [](types.md) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. !!!info "Return table" - * [](/types) **parameters**: A Table with the attributes as keys and their XML value as the key's value. - * [](/types) **texture**: The name of the image element - * [](/types) **color**: The hex used for the color element's value. + * [](types.md) **parameters**: A Table with the attributes as keys and their XML value as the key's value. + * [](types.md) **texture**: The name of the image element + * [](types.md) **color**: The hex used for the color element's value. **IMPORTANT**: This return table is an example of one you may get back from using it on a RawImage element type. The attribute keys you get back and their values will depend on the element you use the function on as well as the attributes you, the user, have assigned to it. @@ -97,12 +97,12 @@ self.UI.getAttribute("testElement", "fontSize") ###getCustomAssets() -[](/types) Returns information on all custom assets uploaded to the UI ASSETS pane. +[](types.md) Returns information on all custom assets uploaded to the UI ASSETS pane. !!!info "Return table" - * [](/types) **table**: An unnamed table that contains sub-tables. Each sub-table represents one asset. - * [](/types) **name**: The name of the image element - * [](/types) **url**: The URL/file location of the asset's source. + * [](types.md) **table**: An unnamed table that contains sub-tables. Each sub-table represents one asset. + * [](types.md) **name**: The name of the image element + * [](types.md) **url**: The URL/file location of the asset's source. ``` Lua function onLoad() @@ -118,10 +118,10 @@ end ###getValue(...) -[](/types) Obtains the value between elements tags, like: `ValueObtained` +[](types.md) Obtains the value between elements tags, like: `ValueObtained` !!!info "getValue(id)" - * [](/types) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. + * [](types.md) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. ``` Lua @@ -139,7 +139,7 @@ print(string) ###getXmlTable() -[](/types) Obtain the run-time UI formatted as a Lua table of data. +[](types.md) Obtain the run-time UI formatted as a Lua table of data. Example Returned Table: ```lua @@ -186,10 +186,10 @@ What the XML would look like which returns that table: ###hide(...) -[](/types) Hides the given UI element. Unlike the "active" attribute, hide triggers animations. +[](types.md) Hides the given UI element. Unlike the "active" attribute, hide triggers animations. !!!info "hide(id)" - * [](/types) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. + * [](types.md) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. ``` Lua @@ -201,15 +201,15 @@ self.UI.hide("testElement") ###setAttribute(...) -[](/types) Sets the value of a specified attribute of a UI element. +[](types.md) Sets the value of a specified attribute of a UI element. !!!important This will override the run-time value from the XML UI for all players, forcing them to see the same value. !!!info "setAttribute(id, attribute, value)" - * [](/types) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. - * [](/types) **attribute**: The name of the attribute you want to set the value of. - * [](/types) **value**: The value to set for the attribute. + * [](types.md) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. + * [](types.md) **attribute**: The name of the attribute you want to set the value of. + * [](types.md) **value**: The value to set for the attribute. ``` Lua @@ -221,19 +221,19 @@ self.UI.setAttribute("testElement", "fontSize", 200) ###setAttributes(...) -[](/types) Updates the value of the supplied attributes of a UI element. You do not need to set every attribute with the data table, an element will continue using any previous values you do not overwrite. +[](types.md) Updates the value of the supplied attributes of a UI element. You do not need to set every attribute with the data table, an element will continue using any previous values you do not overwrite. !!!important This will override the run-time value from the XML UI for all players, forcing them to see the same value. !!!info "setAttributes(id, data)" - * [](/types) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. - * [](/types) **data**: A Table with key/value pairs representing attributes and their values. + * [](types.md) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. + * [](types.md) **data**: A Table with key/value pairs representing attributes and their values. !!!info "Example data table" - * [](/types) **data**: A Table with parameters which guide the function. - * [](/types) **data.fontSize**: Attribute's desired value value - * [](/types#vector) **data.color**: Attribute's desired value + * [](types.md) **data**: A Table with parameters which guide the function. + * [](types.md) **data.fontSize**: Attribute's desired value value + * [](types.md#vector) **data.color**: Attribute's desired value **IMPORTANT**: This table is an example of one you may use when setting a text UI element. The attribute keys you use and their values will depend on the element you use the function on. @@ -250,14 +250,14 @@ self.UI.setAttributes("exampleText", attributeTable) ###setCustomAssets(...) -[](/types) Sets the UI ASSETS (like custom images) for Global or an Object. Passing nothing as a parameter results in the clearing of the UI Assets. +[](types.md) Sets the UI ASSETS (like custom images) for Global or an Object. Passing nothing as a parameter results in the clearing of the UI Assets. !!!warning "This function will overwrite any currently existing assets in Custom UI Assets, not add to them." !!!info "setCustomAssets(table)" - * [](/types) **table**: An unnamed table that contains sub-tables. Each sub-table represents one asset. - * [](/types) **name**: The name of the image element - * [](/types) **url**: The URL/file location of the asset's source. + * [](types.md) **table**: An unnamed table that contains sub-tables. Each sub-table represents one asset. + * [](types.md) **name**: The name of the image element + * [](types.md) **url**: The URL/file location of the asset's source. ``` Lua function onLoad() @@ -279,11 +279,11 @@ end ###setValue(...) -[](/types) Updates the value between elements tags, like: `ValueChanged` +[](types.md) Updates the value between elements tags, like: `ValueChanged` !!!info "setValue(id, value)" - * [](/types) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. - * [](/types) **value**: The value to put between the element tags. + * [](types.md) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. + * [](types.md) **value**: The value to put between the element tags. ``` Lua UI.setValue("testElement", "New Text To Display") @@ -298,10 +298,10 @@ UI.setValue("testElement", "New Text To Display") ###setXml(...) -[](/types) Replaces the run-time UI with the XML string. +[](types.md) Replaces the run-time UI with the XML string. !!!info "setXml(xml)" - * [](/types) **xml**: A single string with the contents of the XML to use + * [](types.md) **xml**: A single string with the contents of the XML to use ``` Lua @@ -316,17 +316,17 @@ self.UI.setXml("Test") ###setXmlTable(...) -[](/types) Replaces the run-time UI with an XML string which is generated from a table of data. +[](types.md) Replaces the run-time UI with an XML string which is generated from a table of data. !!!info "setXmlTable(data)" - * [](/types) **data**: A table containing sub-tables. One sub-table for each element being created. - * [](/types) **tag**: The element type. - * [](/types) **attributes**: A table containing attribute names for keys. Available attribute types depend on tag's element type. + * [](types.md) **data**: A table containing sub-tables. One sub-table for each element being created. + * [](types.md) **tag**: The element type. + * [](types.md) **attributes**: A table containing attribute names for keys. Available attribute types depend on tag's element type. * {>>Optional, defaults to not being used.<<} * {>>Example key/value pairs: text="Test", color="black"<<} - * [](/types) **value**: Text that appears `Here`, between the `<>` and ``. + * [](types.md) **value**: Text that appears `Here`, between the `<>` and ``. * {>>Optional, defaults to an empty string.<<} - * [](/types) **children**: A table containing more sub-tables, formatted as above. This does mean the sub-tables can contain their own children as well, containing sub-sub tables, etc. + * [](types.md) **children**: A table containing more sub-tables, formatted as above. This does mean the sub-tables can contain their own children as well, containing sub-sub tables, etc. * {>>Optional, defaults to not being used.<<} ```lua @@ -370,10 +370,10 @@ end ###show(...) -[](/types) Shows the given UI element. Unlike the "active" attribute, show triggers animations. +[](types.md) Shows the given UI element. Unlike the "active" attribute, show triggers animations. !!!info "show(id)" - * [](/types) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. + * [](types.md) **id**: The Id that was assigned, as an attribute, to the desired XML UI element. ``` Lua diff --git a/docs/ui/attributes.md b/docs/ui/attributes.md index 702f46ce..2cc33fd2 100644 --- a/docs/ui/attributes.md +++ b/docs/ui/attributes.md @@ -1,4 +1,4 @@ -As mentioned in the [Introduction](xml/introUI), attributes are modifiers that can be applied to elements. They can be applied to individual elements or to whole groups of them. +As mentioned in the [Introduction](introUI.md), attributes are modifiers that can be applied to elements. They can be applied to individual elements or to whole groups of them. !!!important They consists of two parts, a **tag** and a **value**. ***The value is always in quotation marks.*** @@ -30,7 +30,7 @@ Elements all share some common attributes which are not repeated under their sep Attribute Name             | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- active | Specifies whether or not this element is active. This can be used to hide/show elements via scripting. Triggering this via script will not trigger animations. | bool | `true` -class | This allows you to group elements together by giving them the same class. It is used with [Defaults](defaults). | string | (none) +class | This allows you to group elements together by giving them the same class. It is used with [Defaults](defaults.md). | string | (none) id | Used by Lua scripting to identify an element within the XML. | string | (none) isDropReceiver | Determine if an object triggers onElementDropped. | bool | false visibility | What colors are able to see the element. See below for additional details. | string | (visible to all) @@ -44,8 +44,8 @@ Not using the visibility attribute (or setting it to an empty string) does not l #####Visiblity Selection * `Host`: Only visible to the game host. * `Admin`: Only visible to the host and any promoted player. -* `Red`: Only visible to the player in that seat color. (Works with all valid [color names](/player-color)) -* `Clubs`: Only visible to members of that player group. (Works with all valid [team names](/player#team)) +* `Red`: Only visible to the player in that seat color. (Works with all valid [color names](../player-color.md)) +* `Clubs`: Only visible to members of that player group. (Works with all valid [team names](../player.md#team)) #####Combining Groups You are able to list multiple color names in a single string by placing a vertical line `|` between valid entries. @@ -61,10 +61,10 @@ Attribute Name          & -- | -- | -- | -- text | This can be used to determine the text that appears. It can also be modified externally by the script. | string | *(none)* alignment | |
  • UpperLeft
  • UpperCenter
  • UpperRight
  • MiddleLeft
  • MiddleCenter
  • MiddleRight
  • LowerLeft
  • LowerCenter
  • LowerRight
| MiddleCenter -color | | [](attributes#attribute-types) | `#323232` +color | | [](#attribute-types) | `#323232` fontStyle | |
  • Normal
  • Bold
  • Italic
  • BoldItalic
| `Normal` fontSize | | float | `14` -resizeTextForBestFit | Resize text to fit? | [](attributes#attribute-types) | `false` +resizeTextForBestFit | Resize text to fit? | [](#attribute-types) | `false` resizeTextMinSize | Minimum font size | float | `10` resizeTextMaxSize | Maximum font size | float | `40` horizontalOverflow | |
  • Wrap
  • Overflow
| `Overflow` @@ -77,18 +77,18 @@ Applies to elements with an image component. The string that `image`s all take i Attribute Name             | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- image | Name of image (in the asset manager). | string | (*none*) -preserveAspect | Should the aspect ratio of this image be preserved? | [](attributes#attribute-types) | *(varies)* -color | Color for this element's image | [](attributes#attribute-types) | `clear` or `#FFFFFF` +preserveAspect | Should the aspect ratio of this image be preserved? | [](#attribute-types) | *(varies)* +color | Color for this element's image | [](#attribute-types) | `clear` or `#FFFFFF` type | Image Type | Simple, Sliced, Filled, Tiled | *(varies)* -raycastTarget | If the element blocks clicks. | [](attributes#attribute-types) | `true` +raycastTarget | If the element blocks clicks. | [](#attribute-types) | `true` ###Appearance Attributes Attribute Name             | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- -shadow | Defines the shadow color of this element. | [](attributes#attribute-types) | (none) +shadow | Defines the shadow color of this element. | [](#attribute-types) | (none) shadowDistance | Defines the distance of the shadow for this element. | float(x) float(y) | `1 -1` -outline | Defines the outline color of this element. | [](attributes#attribute-types) | (none) +outline | Defines the outline color of this element. | [](#attribute-types) | (none) outlineSize | Defines the size of this elements outline. | float(x) float(y) | `1 -1` @@ -97,7 +97,7 @@ These will only apply to elements within a layout group. Attribute Name             | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- -ignoreLayout | Should this element ignore its parent layout group? | [](attributes#attribute-types) | `false` +ignoreLayout | Should this element ignore its parent layout group? | [](#attribute-types) | `false` minWidth | Minimum width for this element. | float | minHeight | Minimum height for this element. | float | preferredWidth | Preferred width for this element. | float | @@ -136,9 +136,9 @@ Allow users to move elements by click/dragging. Attribute Name             | Description                                  | Type / Options | Default Value       -- | -- | -- | -- -allowDragging | Allow this element to be dragged?
{>>Does not work on child elements of layout groups)<<} | [](attributes#attribute-types) | `false` -restrictDraggingToParentBounds | Prevent this element from being dragged outside of its parent? | [](attributes#attribute-types) | `true` -returnToOriginalPositionWhenReleased | If this is set to true, then the element will return to its original position when it is released. | [](attributes#attribute-types) | `true` +allowDragging | Allow this element to be dragged?
{>>Does not work on child elements of layout groups)<<} | [](#attribute-types) | `false` +restrictDraggingToParentBounds | Prevent this element from being dragged outside of its parent? | [](#attribute-types) | `true` +returnToOriginalPositionWhenReleased | If this is set to true, then the element will return to its original position when it is released. | [](#attribute-types) | `true` ###Animation Attributes @@ -157,16 +157,16 @@ Allow any element to have a tooltip (text that appears when the element is hover Attribute Name             | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- tooltip | Tooltip text. | string | *(none)* -tooltipBorderColor | Color of the tooltips border. | [](attributes#attribute-types) | `#FFFFFF` -tooltipBackgroundColor | Color of the tooltips background | [](attributes#attribute-types) | `rgba(0,0,0,0.62)` -tooltipTextColor | Color of the text within this tooltip | [](attributes#attribute-types) | +tooltipBorderColor | Color of the tooltips border. | [](#attribute-types) | `#FFFFFF` +tooltipBackgroundColor | Color of the tooltips background | [](#attribute-types) | `rgba(0,0,0,0.62)` +tooltipTextColor | Color of the text within this tooltip | [](#attribute-types) | tooltipPosition | Position of this tooltip in relation to the element. |
  • Above
  • Below
  • Left
  • Right
| `Right` tooltipBorderImage | This attribute allows you to override the default image used for the tooltips border. | string | tooltipBackgroundImage | This attribute allows you to override the default image used for the tooltips background. | string | tooltipOffset | This attribute allows you to modify the distance this tooltip will appear from the element. | float | ###Event Attributes -Allows Lua scripting events to be triggered by any element, through a variety of interactions. See the [Input Elements](inputelements) page for how to interact with Lua scripting. +Allows Lua scripting events to be triggered by any element, through a variety of interactions. See the [Input Elements](inputelements.md) page for how to interact with Lua scripting. Attribute Name             | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- diff --git a/docs/ui/basicelements.md b/docs/ui/basicelements.md index e11094f1..8b0baabe 100644 --- a/docs/ui/basicelements.md +++ b/docs/ui/basicelements.md @@ -1,6 +1,6 @@ These are display-type elements for the UI. They cannot send information to any Lua scripts. -Each element has its own attributes specific to its type that work in addition to the [common attributes](attributes#common-attributes). +Each element has its own attributes specific to its type that work in addition to the [common attributes](attributes.md#common-attributes). ##Element Summary @@ -22,10 +22,10 @@ Attribute Name            -- | -- | -- | -- text | This can be used to determine the text that appears. It can also be modified externally by the script. | string | *(none)* alignment | |
  • UpperLeft
  • UpperCenter
  • UpperRight
  • MiddleLeft
  • MiddleCenter
  • MiddleRight
  • LowerLeft
  • LowerCenter
  • LowerRight
| MiddleCenter -color | | [](attributes#attribute-types) | `#323232` +color | | [](attributes.md#attribute-types) | `#323232` fontStyle | |
  • Normal
  • Bold
  • Italic
  • BoldItalic
| `Normal` fontSize | | float | `14` -resizeTextForBestFit | Resize text to fit? | [](attributes#attribute-types) | `false` +resizeTextForBestFit | Resize text to fit? | [](attributes.md#attribute-types) | `false` resizeTextMinSize | Minimum font size | float | `10` resizeTextMaxSize | Maximum font size | float | `40` horizontalOverflow | |
  • Wrap
  • Overflow
| `Overflow` @@ -54,9 +54,9 @@ Adds an image. Attribute Name                       | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- image | The name of the file in the asset manager (upper right corner of the scripting window in-game). | string | *(none)* -color | | [](attributes#attribute-types) | `#FFFFFF` +color | | [](attributes.md#attribute-types) | `#FFFFFF` type | Image Type |
  • Simple
  • Sliced
  • Filled
  • Tiled
| `Simple` -raycastTarget | Should this image block clicks from passing through it? | [](attributes#attribute-types) | `true` +raycastTarget | Should this image block clicks from passing through it? | [](attributes.md#attribute-types) | `true` --- @@ -68,15 +68,15 @@ Displays a progress bar which can be updated dynamically via script. Attribute Name                       | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- image | Background Image | (path to image) | *(none)* -color | Background Color | [](attributes#attribute-types) | `#FFFFFF` +color | Background Color | [](attributes.md#attribute-types) | `#FFFFFF` fillImage | Fill Image | string | *(none)* -fillImageColor | Fill Color | [](attributes#attribute-types) | `#FFFFFF` +fillImageColor | Fill Color | [](attributes.md#attribute-types) | `#FFFFFF` percentage | Percentage to Display | float | `0` -showPercentageText | Is the percentage text displayed? | [](attributes#attribute-types) | `true` +showPercentageText | Is the percentage text displayed? | [](attributes.md#attribute-types) | `true` percentageTextFormat | Format to use for the percentage text | string | `0.00` -textColor | Percentage Text Color | [](attributes#attribute-types) | `#000000` -textShadow | Percentage Text Shadow Color | [](attributes#attribute-types) | *(none)* -textOutline | Percentage Text Outline Color | [](attributes#attribute-types) | *(none)* +textColor | Percentage Text Color | [](attributes.md#attribute-types) | `#000000` +textShadow | Percentage Text Shadow Color | [](attributes.md#attribute-types) | *(none)* +textOutline | Percentage Text Outline Color | [](attributes.md#attribute-types) | *(none)* textAlignment | Percentage Text Alignment |
  • UpperLeft
  • UpperCenter
  • UpperRight
  • MiddleLeft
  • MiddleCenter
  • MiddleRight
  • LowerLeft
  • LowerCenter
  • LowerRight
| `MiddleCenter` --- diff --git a/docs/ui/image_inprogress b/docs/ui/image_inprogress index f5ab8348..b7e20fca 100644 --- a/docs/ui/image_inprogress +++ b/docs/ui/image_inprogress @@ -10,7 +10,7 @@ Displays an image from those that were uploaded to the UI assets. Attribute Name                       | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- texture | | string | *(none)* -color | | [](attributes#attribute-types) | `#FFFFFF` +color | | [](attributes.md#attribute-types) | `#FFFFFF` type | Image Type |
  • Simple
  • Sliced
  • Filled
  • Tiled
| `Simple` -raycastTarget | Will the element block clicks? | [](attributes#attribute-types) | `true` +raycastTarget | Will the element block clicks? | [](attributes.md#attribute-types) | `true` uvRect | Tile image (like within a panel) | offset(x) offset(y) repetitions(x) repetitions(y) | *(none)* diff --git a/docs/ui/inputelements.md b/docs/ui/inputelements.md index f3c7d7d1..67c8181d 100644 --- a/docs/ui/inputelements.md +++ b/docs/ui/inputelements.md @@ -1,7 +1,7 @@ All input elements allow for the XML UI to interact with the Lua scripts in the game instance. !!!tip - Be sure to check out the [**UI section of the Lua Scripting API**](/ui) for how to receive the input from these element types. With Lua scripting, you can even modify the UI elements! + Be sure to check out the [**UI section of the Lua Scripting API**](../ui.md) for how to receive the input from these element types. With Lua scripting, you can even modify the UI elements! ##Targeting Triggers When using an attribute that triggers scripting, like onValueChanged or onClick, the UI will target a default location. Global UI targets Global script, Object UI targets the Object's script. This behavior can be overwritten. For example: @@ -19,7 +19,7 @@ Now when the button is clicked, it will still try to activate `function uiClickF ``` And if this was in an Object's UI, it would direct the function activation to Global instead of that Object. -Remember you can also use the [Id attribute](attributes#general-attributes) to identify which UI element triggered the function. +Remember you can also use the [Id attribute](attributes.md#general-attributes) to identify which UI element triggered the function. --- @@ -50,16 +50,16 @@ onValueChanged | Each time the text is changed, a Lua function with this name wi onEndEdit | When the input box is deselected, a Lua function with this name will be triggered. | string | *(none)* text | The string in the text box, if any. Is the value sent to onValueChanged's or onEndEdit's function. | string | *(none)* placeholder | A string that is semi-visible when there is no text in the input. | string | *(none)* -interactable | | [](attributes#attribute-types) | `true` -colors | | [](attributes#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` +interactable | | [](attributes.md#attribute-types) | `true` +colors | | [](attributes.md#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` lineType | |
  • SingleLine
  • MultiLineSubmit
  • MultiLineNewLine
| `SingleLine` characterValidation | |
  • None
  • Integer
  • Decimal
  • Alphanumeric
  • Name
  • EmailAddress
| `None` caretBlinkRate | | float | `0.85` caretWidth | | float | `1` -caretColor | | [](attributes#attribute-types) | `#323232` -selectionColor | | [](attributes#attribute-types) | `rgba(0.65,0.8,1,0.75)` -readOnly | | [](attributes#attribute-types) | false -textColor | | [](attributes#attribute-types) | `#323232` +caretColor | | [](attributes.md#attribute-types) | `#323232` +selectionColor | | [](attributes.md#attribute-types) | `rgba(0.65,0.8,1,0.75)` +readOnly | | [](attributes.md#attribute-types) | false +textColor | | [](attributes.md#attribute-types) | `#323232` characterLimit | | int | `0` (no limit) Example: @@ -77,14 +77,14 @@ A button. Is able to send a trigger event. Attribute Name                       | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- onClick | When clicked, a Lua function with this name will be triggered. | string | *(none)* -interactable | | [](attributes#attribute-types) | `true` -colors | | [](attributes#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` -textShadow | | [](attributes#attribute-types) | *(none)* -textOutline | | [](attributes#attribute-types) | *(none)* +interactable | | [](attributes.md#attribute-types) | `true` +colors | | [](attributes.md#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` +textShadow | | [](attributes.md#attribute-types) | *(none)* +textOutline | | [](attributes.md#attribute-types) | *(none)* textAlignment | |
  • UpperLeft
  • UpperCenter
  • UpperRight
  • MiddleLeft
  • MiddleCenter
  • MiddleRight
  • LowerLeft
  • LowerCenter
  • LowerRight
| `UpperLeft` icon | | string | *(none)* iconWidth | | float | -iconColor | | [](attributes#attribute-types) | +iconColor | | [](attributes.md#attribute-types) | iconAlignment | |
  • Left
  • Right
| `Left` padding | | float float float float | `0 0 0 0` transition | |
  • None
  • ColorTint
  • SpriteSwap
  • Animation
| `ColorTint` @@ -121,10 +121,10 @@ A simple on/off toggle. Is able to send on/off status. Attribute Name                       | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- onValueChanged | When toggled, a Lua function with this name will be triggered. | string | *(none)* -interactable | | [](attributes#attribute-types) | `true` -textColor | | [](attributes#attribute-types) | `#000000` -colors | | [](attributes#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` -isOn | If the toggle is "on" or not. Is the value sent to onValueChanged's function. | [](attributes#attribute-types) | false +interactable | | [](attributes.md#attribute-types) | `true` +textColor | | [](attributes.md#attribute-types) | `#000000` +colors | | [](attributes.md#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` +isOn | If the toggle is "on" or not. Is the value sent to onValueChanged's function. | [](attributes.md#attribute-types) | false Example: ```xml @@ -143,16 +143,16 @@ A toggle, but styled as a button. Attribute Name                       | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- onValueChanged | When toggled, a Lua function with this name will be triggered. | string | *(none)* -interactable | | [](attributes#attribute-types) | `true` -textColor | | [](attributes#attribute-types) | `#000000` -colors | | [](attributes#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` -isOn | If the toggle is "on" or not. Is the value sent to onValueChanged's function. | [](attributes#attribute-types) | false -textShadow | | [](attributes#attribute-types) | *(none)* -textOutline | | [](attributes#attribute-types) | *(none)* +interactable | | [](attributes.md#attribute-types) | `true` +textColor | | [](attributes.md#attribute-types) | `#000000` +colors | | [](attributes.md#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` +isOn | If the toggle is "on" or not. Is the value sent to onValueChanged's function. | [](attributes.md#attribute-types) | false +textShadow | | [](attributes.md#attribute-types) | *(none)* +textOutline | | [](attributes.md#attribute-types) | *(none)* textAlignment | |
  • UpperLeft
  • UpperCenter
  • UpperRight
  • MiddleLeft
  • MiddleCenter
  • MiddleRight
  • LowerLeft
  • LowerCenter
  • LowerRight
| `UpperLeft` icon | | string | *(none)* iconWidth | | float | -iconColor | | [](attributes#attribute-types) | +iconColor | | [](attributes.md#attribute-types) | iconAlignment | |
  • Left
  • Right
| `Left` padding | | float float float float | `0 0 0 0` @@ -169,11 +169,11 @@ Allows a group of toggles to act as a radio button, where only 1 of them can be Attribute Name                       | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- -allowSwitchOff | If this is set to true, then the user may clear their selection from within the ToggleGroup by clicking on the selected Toggle. | [](attributes#attribute-types) | `false` +allowSwitchOff | If this is set to true, then the user may clear their selection from within the ToggleGroup by clicking on the selected Toggle. | [](attributes.md#attribute-types) | `false` toggleBackgroundImage | Sets the default background image to use for nested Toggle elements. | string | -toggleBackgroundColor | | [](attributes#attribute-types) | `#FFFFFF` +toggleBackgroundColor | | [](attributes.md#attribute-types) | `#FFFFFF` toggleSelectedImage | Sets the default image to use for selected (checked) nested Toggle elements. | string | -toggleSelectedColor | | [](attributes#attribute-types) | `#FFFFFF` +toggleSelectedColor | | [](attributes.md#attribute-types) | `#FFFFFF` ```xml @@ -203,17 +203,17 @@ A value slider. Is able to send Value. Attribute Name                       | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- onValueChanged | When the slider is moved, a Lua function with this name will be triggered. (rapidly) | string | *(none)* -interactable | | [](attributes#attribute-types) | `true` -colors | | [](attributes#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` +interactable | | [](attributes.md#attribute-types) | `true` +colors | | [](attributes.md#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` minValue | | float | `0` maxValue | | float | `1` value | The value currently selected. Is the value sent to onValueChanged's function. | float | `0` -wholeNumbers | | [](attributes#attribute-types) | false +wholeNumbers | | [](attributes.md#attribute-types) | false direction | |
  • LeftToRight
  • RightToLeft
  • TopToBottom
  • BottomToTop
| `LeftToRight` -backgroundColor | | [](attributes#attribute-types) | *(none)* -fillColor | | [](attributes#attribute-types) | *(none)* +backgroundColor | | [](attributes.md#attribute-types) | *(none)* +fillColor | | [](attributes.md#attribute-types) | *(none)* fillImage | | string | -handleColor | | [](attributes#attribute-types) | *(none)* +handleColor | | [](attributes.md#attribute-types) | *(none)* handleImage | | string | Example: @@ -233,17 +233,17 @@ Attribute Name            -- | -- | -- | -- onValueChanged | When an option is selected, a Lua function with this name will be triggered. | string | *(none)* text | The string in the text box, if any. Is the value sent to onValueChanged's or onEndEdit's function. | string | *(none)* -interactable | | [](attributes#attribute-types) | `true` -textColor | | [](attributes#attribute-types) | `#000000` -itemBackgroundColors | | [](attributes#attribute-types) | #FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5) -itemTextColor | | [](attributes#attribute-types) | `#000000` -checkColor | | [](attributes#attribute-types) | `#000000` +interactable | | [](attributes.md#attribute-types) | `true` +textColor | | [](attributes.md#attribute-types) | `#000000` +itemBackgroundColors | | [](attributes.md#attribute-types) | #FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5) +itemTextColor | | [](attributes.md#attribute-types) | `#000000` +checkColor | | [](attributes.md#attribute-types) | `#000000` checkImage | | string | -arrowColor | | [](attributes#attribute-types) | `#000000` +arrowColor | | [](attributes.md#attribute-types) | `#000000` arrowImage | | string | -dropdownBackgroundColor | | [](attributes#attribute-types) | `#000000` +dropdownBackgroundColor | | [](attributes.md#attribute-types) | `#000000` dropdownBackgroundImage | | string | -scrollbarColors | | [](attributes#attribute-types) | +scrollbarColors | | [](attributes.md#attribute-types) | scrollbarImage | | string | itemHeight | | float | diff --git a/docs/ui/layoutgrouping.md b/docs/ui/layoutgrouping.md index 82b45e48..7fd02475 100644 --- a/docs/ui/layoutgrouping.md +++ b/docs/ui/layoutgrouping.md @@ -1,6 +1,6 @@ By nesting elements within layouts/groupings, you are able to easily group elements together in-game. It allows for adjusting/moving them together, uniform padding and additional visual flair possibilities. -Each layout element has its own attributes specific to its type. Additionally, elements within a layout are subject to common [common layout element attributes](attributes#layout-element-attributes). +Each layout element has its own attributes specific to its type. Additionally, elements within a layout are subject to common [common layout element attributes](attributes.md#layout-element-attributes). ##Element Summary @@ -53,8 +53,8 @@ Attribute Name            padding | | float(left) float(right) float(top) float(bottom) | `0 0 0 0` spacing | Spacing between child elements. | float | `0` childAlignment | |
  • UpperLeft
  • UpperCenter
  • UpperRight
  • MiddleLeft
  • MiddleCenter
  • MiddleRight
  • LowerLeft
  • LowerCenter
  • LowerRight
| `UpperLeft` -childForceExpandWidth | | [](attributes#attribute-types) | `true` -childForceExpandHeight | | [](attributes#attribute-types) | `true` +childForceExpandWidth | | [](attributes.md#attribute-types) | `true` +childForceExpandHeight | | [](attributes.md#attribute-types) | `true` ```xml @@ -75,8 +75,8 @@ Attribute Name            padding | | float(left) float(right) float(top) float(bottom) | `0 0 0 0` spacing | Spacing between child elements. | float | `0` childAlignment | |
  • UpperLeft
  • UpperCenter
  • UpperRight
  • MiddleLeft
  • MiddleCenter
  • MiddleRight
  • LowerLeft
  • LowerCenter
  • LowerRight
| `UpperLeft` -childForceExpandWidth | | [](attributes#attribute-types) | `true` -childForceExpandHeight | | [](attributes#attribute-types) | `true` +childForceExpandWidth | | [](attributes.md#attribute-types) | `true` +childForceExpandHeight | | [](attributes.md#attribute-types) | `true` ```xml @@ -123,15 +123,15 @@ Attribute Name            padding | | float(left) float(right) float(top) float(bottom) | `0 0 0 0` cellSpacing | Spacing between each cell. | float | `0` columnWidths | (Optional) Explicitly set the width of each column. Use a value of 0 to auto-size a specific column. | float list - e.g. '32 0 0 32' | *(none)* -automaticallyAddColumns | If more cells are added to a row than are accounted for by columnWidths, should this TableLayout automatically add one or more new auto-sized entries (0) to columnWidths? | [](attributes#attribute-types) | `true` -automaticallyRemoveEmptyColumns | If there are more entries in columnWidths than there are cells in any row, should this TableLayout automatically remove entries from columnWidths until their are no 'empty' columns? | [](attributes#attribute-types) | `true` -autoCalculateHeight | If set to true, then the height of this TableLayout will automatically be calculated as the sum of each rows preferredHeight value. This option cannot be used without explicitly sized rows. | [](attributes#attribute-types) | `false` -useGlobalCellPadding | If set to true, then all cells will use this TableLayout's cellPadding value. | [](attributes#attribute-types) | `true` +automaticallyAddColumns | If more cells are added to a row than are accounted for by columnWidths, should this TableLayout automatically add one or more new auto-sized entries (0) to columnWidths? | [](attributes.md#attribute-types) | `true` +automaticallyRemoveEmptyColumns | If there are more entries in columnWidths than there are cells in any row, should this TableLayout automatically remove entries from columnWidths until their are no 'empty' columns? | [](attributes.md#attribute-types) | `true` +autoCalculateHeight | If set to true, then the height of this TableLayout will automatically be calculated as the sum of each rows preferredHeight value. This option cannot be used without explicitly sized rows. | [](attributes.md#attribute-types) | `false` +useGlobalCellPadding | If set to true, then all cells will use this TableLayout's cellPadding value. | [](attributes.md#attribute-types) | `true` cellPadding | Padding for each cell. | float(left) float(right) float(top) float(bottom) | `0 0 0 0` cellBackgroundImage | Image to use as the background for each cell. | string | -cellBackgroundColor | Color for each cells background. | [](attributes#attribute-types) | `rgba(1,1,1,0.4)` +cellBackgroundColor | Color for each cells background. | [](attributes.md#attribute-types) | `rgba(1,1,1,0.4)` rowBackgroundImage | Image to use as the background for each row. | string | -rowBackgroundColor | Color to use for each rows background. | [](attributes#attribute-types) | `clear` +rowBackgroundColor | Color to use for each rows background. | [](attributes.md#attribute-types) | `clear` ```xml @@ -154,7 +154,7 @@ A row within a TableLayout. Attribute Name                       | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- preferredHeight | Sets the height for this row. Use a value of '0' to specify that this row should be auto-sized. | float | `0` -dontUseTableRowBackground | If set to true, then this row will ignore the tables' *rowBackgroundImage* and *rowBackgroundColor* values, allowing you to override those values for this row. | [](attributes#attribute-types) | `false` +dontUseTableRowBackground | If set to true, then this row will ignore the tables' *rowBackgroundImage* and *rowBackgroundColor* values, allowing you to override those values for this row. | [](attributes.md#attribute-types) | `false` #####Cell A cell within a TableLayout. @@ -162,11 +162,11 @@ A cell within a TableLayout. Attribute Name                       | Description                                  | Type / Options                       | Default Value       -- | -- | -- | -- columnSpan | __ | int | `1` -dontUseTableCellBackground | If set to true, then this cell will ignore the tables' *cellBackgroundImage* and values, allowing you to override those values for this cell. | [](attributes#attribute-types) | `false` -overrideGlobalCellPadding | If set to true, then this cell will ignore the tables' *cellPadding* value, allowing you to set unique cell padding for this cell. | [](attributes#attribute-types) | `false` +dontUseTableCellBackground | If set to true, then this cell will ignore the tables' *cellBackgroundImage* and values, allowing you to override those values for this cell. | [](attributes.md#attribute-types) | `false` +overrideGlobalCellPadding | If set to true, then this cell will ignore the tables' *cellPadding* value, allowing you to set unique cell padding for this cell. | [](attributes.md#attribute-types) | `false` padding | Padding values to use for this cell if *overrideGlobalCellPadding* is set to true. | float(left) float(right) float(top) float(bottom) | `0 0 0 0` -childForceExpandWidth | | [](attributes#attribute-types) | `true` -childForceExpandHeight | | [](attributes#attribute-types) | `true` +childForceExpandWidth | | [](attributes.md#attribute-types) | `true` +childForceExpandHeight | | [](attributes.md#attribute-types) | `true` --- @@ -174,25 +174,25 @@ childForceExpandHeight | | [](attributes#attribute ###Scroll View Details ####HorizontalScrollView -A scrollable horizontal row of elements. This is an [input element](inputelements). +A scrollable horizontal row of elements. This is an [input element](inputelements.md). A layout element such as a Panel, HorizontalLayout, GridLayout, or TableLayout can be used to position child elements within the Scroll View. Attribute Name                       | Description                            | Type / Options                       | Default Value       -- | -- | -- | -- onValueChanged | When a selection is made, its name is sent to a function with this name. | string | *(none)* -horizontal | | [](attributes#attribute-types) | `true` -vertical | | [](attributes#attribute-types) | `false` +horizontal | | [](attributes.md#attribute-types) | `true` +vertical | | [](attributes.md#attribute-types) | `false` movementType | |
  • Unrestricted
  • Elastic
  • Clamped
| `Clamped` elasticity | | float | `0.1` -inertia | | [](attributes#attribute-types) | `true` +inertia | | [](attributes.md#attribute-types) | `true` decelerationRate | | float | `0.135` scrollSensitivity | | float | `1` horizontalScrollbarVisibility | |
  • Permanent
  • AutoHide
  • AutoHideAndExpandViewport
| `AutoHide` verticalScrollbarVisibility | |
  • Permanent
  • AutoHide
  • AutoHideAndExpandViewport
| *(none)* -noScrollbars | If set to true, then this scroll view will have no visible scrollbars. | [](attributes#attribute-types) | `false` -scrollbarBackgroundColor | | [](attributes#attribute-types) | `#FFFFFF` -scrollbarColors | | [](attributes#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` +noScrollbars | If set to true, then this scroll view will have no visible scrollbars. | [](attributes.md#attribute-types) | `false` +scrollbarBackgroundColor | | [](attributes.md#attribute-types) | `#FFFFFF` +scrollbarColors | | [](attributes.md#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` scrollbarImage | | string | ```xml @@ -219,25 +219,25 @@ scrollbarImage | | string | ####VerticalScrollView -A scrollable vertical column of elements. This is an [input element](inputelements). +A scrollable vertical column of elements. This is an [input element](inputelements.md). A layout element such as a Panel, HorizontalLayout, GridLayout, or TableLayout can be used to position child elements within the Scroll View. Attribute Name                       | Description                            | Type / Options                       | Default Value       -- | -- | -- | -- onValueChanged | When a selection is made, its name is sent to a function with this name. | string | *(none)* -horizontal | | [](attributes#attribute-types) | `false` -vertical | | [](attributes#attribute-types) | `true` +horizontal | | [](attributes.md#attribute-types) | `false` +vertical | | [](attributes.md#attribute-types) | `true` movementType | |
  • Unrestricted
  • Elastic
  • Clamped
| `Clamped` elasticity | | float | `0.1` -inertia | | [](attributes#attribute-types) | `true` +inertia | | [](attributes.md#attribute-types) | `true` decelerationRate | | float | `0.135` scrollSensitivity | | float | `1` horizontalScrollbarVisibility | |
  • Permanent
  • AutoHide
  • AutoHideAndExpandViewport
| *(none)* verticalScrollbarVisibility | |
  • Permanent
  • AutoHide
  • AutoHideAndExpandViewport
| `AutoHide` -noScrollbars | If set to true, then this scroll view will have no visible scrollbars. | [](attributes#attribute-types) | `false` -scrollbarBackgroundColor | | [](attributes#attribute-types) | `#FFFFFF` -scrollbarColors | | [](attributes#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` +noScrollbars | If set to true, then this scroll view will have no visible scrollbars. | [](attributes.md#attribute-types) | `false` +scrollbarBackgroundColor | | [](attributes.md#attribute-types) | `#FFFFFF` +scrollbarColors | | [](attributes.md#attribute-types) | `#FFFFFF|#FFFFFF|#C8C8C8|rgba(0.78,0.78,0.78,0.5)` scrollbarImage | | string | ```xml diff --git a/docs/vector.md b/docs/vector.md index af70991a..941a8c16 100644 --- a/docs/vector.md +++ b/docs/vector.md @@ -19,12 +19,12 @@ Check [Manipulation examples](#manipulation-examples) for more detailed usage. Function Name | Description | Return |   -- | -- | -- | --: -Vector([](/types) x, [](/types) y, [](/types) z) | Return a vector with specified (x, y, z) components. | [](/types) -Vector([](/types) v) | Return a vector with x/y/z or 1/2/3 components from source table (x/y/z first). | [](/types) -Vector.new(...) | Same as Vector(...). | [](/types) -Vector.min([](/types) vec1, [](/types) vec2) | Returns a vector that is made from the smallest components of two vectors. | [](/types) | [](#vectormin) -Vector.max([](/types) vec1, [](/types) vec2) | Returns a vector that is made from the largest components of two vectors. | [](/types) | [](#vectormax) -Vector.between([](/types) vec1, [](/types) vec2) | Return a vector pointing from vec1 to vec2. | [](/types) | [](#vectorbetween) +Vector([](types.md) x, [](types.md) y, [](types.md) z) | Return a vector with specified (x, y, z) components. | [](types.md) +Vector([](types.md) v) | Return a vector with x/y/z or 1/2/3 components from source table (x/y/z first). | [](types.md) +Vector.new(...) | Same as Vector(...). | [](types.md) +Vector.min([](types.md) vec1, [](types.md) vec2) | Returns a vector that is made from the smallest components of two vectors. | [](types.md) | [](#vectormin) +Vector.max([](types.md) vec1, [](types.md) vec2) | Returns a vector that is made from the largest components of two vectors. | [](types.md) | [](#vectormax) +Vector.between([](types.md) vec1, [](types.md) vec2) | Return a vector pointing from vec1 to vec2. | [](types.md) | [](#vectorbetween) ###Constructors examples @@ -48,10 +48,10 @@ In addition to accessing vector components by their numeric indices (1, 2, 3) an Function Name | Description | Return |   -- | -- | -- | -- -setAt([](/types) k, [](/types) value) | Sets a component to value and returns self. | [](/types#vector) | [](#setat) -set([](/types) x, [](/types) y, [](/types) z) | Sets `x`, `y`, `z` components to given values and returns self. | [](/types#vector) | [](#set) -get() | Returns `x`, `y`, `z` components as three separate values. | [](/types)
[](/types)
[](/types) | [](#get) -copy() | Returns a separate Vector with identical component values. | [](/types#vector) | [](#copy) +setAt([](types.md) k, [](types.md) value) | Sets a component to value and returns self. | [](types.md#vector) | [](#setat) +set([](types.md) x, [](types.md) y, [](types.md) z) | Sets `x`, `y`, `z` components to given values and returns self. | [](types.md#vector) | [](#set) +get() | Returns `x`, `y`, `z` components as three separate values. | [](types.md)
[](types.md)
[](types.md) | [](#get) +copy() | Returns a separate Vector with identical component values. | [](types.md#vector) | [](#copy) !!!tip Before `Vector` was introduced, coordinate tables contained separate values under 1, 2, 3 and x, y, z keys, with letter keys taking precedence when they were different. This is no longer the case, and using letter and numerical keys is equivalent. However, when iterating over Vector components you have to use `pairs` and only letter keys will be read there. @@ -84,10 +84,10 @@ Vector also allows you to use arithmetic operators to performs basic operations: Operator | Description | Return |   -- | -- | -- | -- -[](/types) one + [](/types) two | Returns a new Vector that is a sum of `one` and `two` | [](/types#vector) -[](/types) one - [](/types) two | Returns a new Vector that is a difference of `one` and `two` | [](/types#vector) -[](/types) one * [](/types) factor | Returns a new Vector that is `one` with each component multiplied by the factor. | [](/types#vector) -[](/types) one == [](/types) two | Returns a boolean whether `one` and `two` are very similar to each other (less than ~0.03 difference in magnitude) | [](/types) +[](types.md) one + [](types.md) two | Returns a new Vector that is a sum of `one` and `two` | [](types.md#vector) +[](types.md) one - [](types.md) two | Returns a new Vector that is a difference of `one` and `two` | [](types.md#vector) +[](types.md) one * [](types.md) factor | Returns a new Vector that is `one` with each component multiplied by the factor. | [](types.md#vector) +[](types.md) one == [](types.md) two | Returns a boolean whether `one` and `two` are very similar to each other (less than ~0.03 difference in magnitude) | [](types.md) ###Arithmetics examples @@ -116,40 +116,40 @@ end Method Name | Description | Return |   -- | -- | -- | --: -vec:add([](/types) otherVec) | Adds components of otherVec to self. | [](/types) | [](#add) -vec:sub([](/types) otherVec) | Subtracts components of otherVec from self. | [](/types) | [](#sub) -vec:scale([](/types) otherVec) | Multiplies self-components by corresponding components from otherVec. | [](/types) | [](#scale) -vec:scale([](/types) num) | Multiplies self-components by a numeric factor. | [](/types) | [](#scale) -vec:clamp([](/types) num) | If self-magnitude is higher than provided limit, scale self-down to match it. | [](/types) | [](#clamp) -vec:normalize() | Makes self-have a magnitude of 1. | [](/types) | [](#normalize) -vec:project([](/types) otherVec) | Make self into projection on another vector. | [](/types) | [](#project) -vec:projectOnPlane([](/types) otherVec) | Project self on a plane defined through a normal vector arg. | [](/types) | [](#projectonplane) -vec:reflect([](/types) otherVec) | Reflect self over a plane defined through a normal vector arg. | [](/types) | [](#reflect) -vec:inverse() | Multiply self-components by -1. | [](/types) | [](#inverse) -vec:moveTowards([](/types) otherVec, [](/types) num) | Move self towards another vector, but only up to a provided distance limit. | [](/types) | [](#movetowards) -vec:rotateTowards([](/types) target, [](/types) maxAngle) | Rotate self towards another vector, but only up to a provided angle limit. | [](/types) | [](#rotatetowards) -vec:rotateTowardsUnit([](/types) target, [](/types) maxAngle) | Same as rotateTowards, but only works correctly if `target` Vector is normalized. Less expensive than `rotateTowards`. | [](/types) | [](#rotatetowardsunit) -vec:rotateOver([](/types) axis, [](/types) angle) | Rotate a Vector `angle` degrees over given `axis` (can be `'x'`, `'y'`, `'z'`). | [](/types) | [](#rotateover) +vec:add([](types.md) otherVec) | Adds components of otherVec to self. | [](types.md) | [](#add) +vec:sub([](types.md) otherVec) | Subtracts components of otherVec from self. | [](types.md) | [](#sub) +vec:scale([](types.md) otherVec) | Multiplies self-components by corresponding components from otherVec. | [](types.md) | [](#scale) +vec:scale([](types.md) num) | Multiplies self-components by a numeric factor. | [](types.md) | [](#scale) +vec:clamp([](types.md) num) | If self-magnitude is higher than provided limit, scale self-down to match it. | [](types.md) | [](#clamp) +vec:normalize() | Makes self-have a magnitude of 1. | [](types.md) | [](#normalize) +vec:project([](types.md) otherVec) | Make self into projection on another vector. | [](types.md) | [](#project) +vec:projectOnPlane([](types.md) otherVec) | Project self on a plane defined through a normal vector arg. | [](types.md) | [](#projectonplane) +vec:reflect([](types.md) otherVec) | Reflect self over a plane defined through a normal vector arg. | [](types.md) | [](#reflect) +vec:inverse() | Multiply self-components by -1. | [](types.md) | [](#inverse) +vec:moveTowards([](types.md) otherVec, [](types.md) num) | Move self towards another vector, but only up to a provided distance limit. | [](types.md) | [](#movetowards) +vec:rotateTowards([](types.md) target, [](types.md) maxAngle) | Rotate self towards another vector, but only up to a provided angle limit. | [](types.md) | [](#rotatetowards) +vec:rotateTowardsUnit([](types.md) target, [](types.md) maxAngle) | Same as rotateTowards, but only works correctly if `target` Vector is normalized. Less expensive than `rotateTowards`. | [](types.md) | [](#rotatetowardsunit) +vec:rotateOver([](types.md) axis, [](types.md) angle) | Rotate a Vector `angle` degrees over given `axis` (can be `'x'`, `'y'`, `'z'`). | [](types.md) | [](#rotateover) ###Methods not modifying self Method Name | Description | Return |   -- | -- | -- | --: -vec1:dot([](/types) vec2) | Return a dot product of two vectors. | [](/types) | [](#dot) -vec:magnitude() | Returns the length of this vector. | [](/types) | [](#magnitude) -vec:sqrMagnitude() | Returns the squared length of this vector. | [](/types) | [](#sqrmagnitude) -p1:distance([](/types) p2) | Returns distance between two points. | [](/types) | [](#distance) -p1:sqrDistance([](/types) p2) | Returns squared distance between two points. | [](/types) | [](#sqrdistance) -vec1:equals([](/types) vec2, [](/types) margin) | Returns true if two vectors are approximately equal. The `margin` argument is optional and defaults to tolerating a difference of ~0.03 in both vector magnitude. | [](/types) | [](#equals) -vec:string([](/types) prefix) | Return string describing self, optional string prefix. | [](/types)
[](/types) | [](#string) -vec1:angle([](/types) vec2) | Return an angle between two vectors, in degrees [0, 180]. | [](/types) | [](#angle) -vec1:cross([](/types) vec2) | Return a cross-product vector of two vectors. | [](/types) | [](#cross) -p1:lerp([](/types) p2, [](/types) t) | Linearly interpolates between two points. Numeric arg [0, 1] is the fraction. | [](/types) | [](#lerp) -vec:normalized() | Return a new vector that is normalized (length 1) version of self. | [](/types) | [](#normalized) -vec:orthoNormalize() | Return three normalized vectors perpendicular to each other, first one being in the same dir as self. Return `base`, `normal`, `binormal` vectors. | [](/types)
[](/types)
[](/types)
| [](#orthonormalize) -vec:orthoNormalize([](/types) binormalPlanar) | Same as vec:orthoNormalize(), but second vector is guranteed to be on a self-binormalPlanar plane. | [](/types)
[](/types)
[](/types)
| [](#orthonormalize) -vec:heading() | Returns an angle (In degrees) of rotation of Vector over all axis (`'x'`, `'y'`, `'z'`). | [](/types)
[](/types)
[](/types) | [](#heading) -vec:heading([](/types) axis) | Returns an angle (In degrees) of rotation of Vector over a given `axis` (can be `'x'`, `'y'`, `'z'`). | [](/types) | [](#heading) +vec1:dot([](types.md) vec2) | Return a dot product of two vectors. | [](types.md) | [](#dot) +vec:magnitude() | Returns the length of this vector. | [](types.md) | [](#magnitude) +vec:sqrMagnitude() | Returns the squared length of this vector. | [](types.md) | [](#sqrmagnitude) +p1:distance([](types.md) p2) | Returns distance between two points. | [](types.md) | [](#distance) +p1:sqrDistance([](types.md) p2) | Returns squared distance between two points. | [](types.md) | [](#sqrdistance) +vec1:equals([](types.md) vec2, [](types.md) margin) | Returns true if two vectors are approximately equal. The `margin` argument is optional and defaults to tolerating a difference of ~0.03 in both vector magnitude. | [](types.md) | [](#equals) +vec:string([](types.md) prefix) | Return string describing self, optional string prefix. | [](types.md)
[](types.md) | [](#string) +vec1:angle([](types.md) vec2) | Return an angle between two vectors, in degrees [0, 180]. | [](types.md) | [](#angle) +vec1:cross([](types.md) vec2) | Return a cross-product vector of two vectors. | [](types.md) | [](#cross) +p1:lerp([](types.md) p2, [](types.md) t) | Linearly interpolates between two points. Numeric arg [0, 1] is the fraction. | [](types.md) | [](#lerp) +vec:normalized() | Return a new vector that is normalized (length 1) version of self. | [](types.md) | [](#normalized) +vec:orthoNormalize() | Return three normalized vectors perpendicular to each other, first one being in the same dir as self. Return `base`, `normal`, `binormal` vectors. | [](types.md)
[](types.md)
[](types.md)
| [](#orthonormalize) +vec:orthoNormalize([](types.md) binormalPlanar) | Same as vec:orthoNormalize(), but second vector is guranteed to be on a self-binormalPlanar plane. | [](types.md)
[](types.md)
[](types.md)
| [](#orthonormalize) +vec:heading() | Returns an angle (In degrees) of rotation of Vector over all axis (`'x'`, `'y'`, `'z'`). | [](types.md)
[](types.md)
[](types.md) | [](#heading) +vec:heading([](types.md) axis) | Returns an angle (In degrees) of rotation of Vector over a given `axis` (can be `'x'`, `'y'`, `'z'`). | [](types.md) | [](#heading) --- @@ -157,11 +157,11 @@ vec:heading([](/types) axis) | Returns an angl ###Vector.min(...) -[](/types) Returns a vector that is made from the smallest components of two vectors. +[](types.md) Returns a vector that is made from the smallest components of two vectors. !!!info "Vector.min(vec1, vec2)" - * [](/types) **vec1**: First vector. - * [](/types) **vec2**: Second vector. + * [](types.md) **vec1**: First vector. + * [](types.md) **vec2**: Second vector. ``` Lua vec1 = Vector(1, 2, 3) @@ -171,11 +171,11 @@ print(Vector.min(vec1, vec2)) --> Vector: { 1, 2, 2 } ###Vector.max(...) -[](/types) Returns a vector that is made from the largest components of two vectors. +[](types.md) Returns a vector that is made from the largest components of two vectors. !!!info "Vector.max(vec1, vec2)" - * [](/types) **vec1**: First vector. - * [](/types) **vec2**: Second vector. + * [](types.md) **vec1**: First vector. + * [](types.md) **vec2**: Second vector. ``` Lua vec1 = Vector(1, 2, 3) @@ -185,11 +185,11 @@ print(Vector.max(vec1, vec2)) --> Vector: { 4, 3, 3 } ###Vector.between(...) -[](/types) Return a vector pointing from vec1 to vec2. +[](types.md) Return a vector pointing from vec1 to vec2. !!!info "Vector.between(vec1, vec2)" - * [](/types) **vec1**: First vector. - * [](/types) **vec2**: Second vector. + * [](types.md) **vec1**: First vector. + * [](types.md) **vec2**: Second vector. ``` Lua vec1 = Vector(1, 2, 3) @@ -203,11 +203,11 @@ print(Vector.between(vec1, vec2)) --> Vector: { 3, 1, -1 } ###setAt(...) -[](/types) Update one component of the vector and returning self. +[](types.md) Update one component of the vector and returning self. !!!info "setAt(key, num)" - * [](/types) **key**: Index of component (1, 2 or 3 for x, y or z). - * [](/types) **num**: New value. + * [](types.md) **key**: Index of component (1, 2 or 3 for x, y or z). + * [](types.md) **num**: New value. ``` Lua vec = Vector(1, 2, 3) @@ -217,14 +217,14 @@ print(vec) --> Vector: { 4, 3, 3 } ###set(...) -[](/types) Update all components of the vector and returning self. +[](types.md) Update all components of the vector and returning self. Providing a nil value makes it ignore that argument. !!!info "set(x, y, z)" - * [](/types) **x**: New value of X component. - * [](/types) **y**: New value of Y component. - * [](/types) **z**: New value of Z component. + * [](types.md) **x**: New value of X component. + * [](types.md) **y**: New value of Y component. + * [](types.md) **z**: New value of Z component. ``` Lua vec = Vector(1, 2, 3) @@ -234,9 +234,9 @@ print(vec) --> Vector: { 4, 3, 2 } ###get() -[](/types) -[](/types) -[](/types) Returns `x`, `y`, `z` components as three separate values. +[](types.md) +[](types.md) +[](types.md) Returns `x`, `y`, `z` components as three separate values. ``` Lua vec = Vector(1, 2, 3) @@ -246,7 +246,7 @@ print(x + y + z) --> 6 ###copy() -[](/types) Copy self into a new vector and return it. +[](types.md) Copy self into a new vector and return it. ``` Lua vec1 = Vector(1, 2, 3) @@ -264,10 +264,10 @@ print(vec2) --> Vector { 1, 2, 3 } ####add(...) -[](/types) Adds components of otherVec to self and returning self. +[](types.md) Adds components of otherVec to self and returning self. !!!info "add(otherVec)" - * [](/types) **otherVec**: The vector to add. + * [](types.md) **otherVec**: The vector to add. ``` Lua vec = Vector(1, 2, 3) @@ -284,10 +284,10 @@ print(vec) --> Vector: { 5, 7, 9 } ####sub(...) -[](/types) Subtracts components of otherVec from self and returning self. +[](types.md) Subtracts components of otherVec from self and returning self. !!!info "sub(otherVec)" - * [](/types) **otherVec**: The vector to subtracts. + * [](types.md) **otherVec**: The vector to subtracts. ``` Lua vec = Vector(1, 2, 3) @@ -304,15 +304,15 @@ print(vec) --> Vector: { -5, -3, -1 } ####scale(...) -[](/types) Multiplies self-components by corresponding components from otherVec and returning self. +[](types.md) Multiplies self-components by corresponding components from otherVec and returning self. Every component in the result is a component of vec multiplied by the same component of otherVec or by a number factor. !!!info "scale(otherVec)" - * [](/types) **otherVec**: The vector to scale. + * [](types.md) **otherVec**: The vector to scale. !!!info "scale(num)" - * [](/types) **num**: The numeric factor. + * [](types.md) **num**: The numeric factor. ``` Lua vec = Vector(1, 2, 3) @@ -325,10 +325,10 @@ print(vec) --> Vector: { 4, 12, 24 } ####clamp(...) -[](/types) If self-magnitude is higher than provided limit, scale self-down to match it and returning self. +[](types.md) If self-magnitude is higher than provided limit, scale self-down to match it and returning self. !!!info "clamp(num)" - * [](/types) **num**: The numeric max magnitude. + * [](types.md) **num**: The numeric max magnitude. ``` Lua vec = Vector(1, 2, 3) @@ -338,7 +338,7 @@ print(vec) --> Vector: { 0.53, 1.07, 1.60 } ####normalize() -[](/types) Makes this vector have a magnitude of 1 and returning self. +[](types.md) Makes this vector have a magnitude of 1 and returning self. When normalized, a vector keeps the same direction but its length is 1.0. @@ -352,12 +352,12 @@ print(vec) --> Vector: { 0.27, 0.53, 0.80 } ####project(...) -[](/types) Make self into projection on another vector and return self. +[](types.md) Make self into projection on another vector and return self. To understand vector projection, imagine that `otherVec` is resting on a line pointing in its direction. Somewhere along that line will be the nearest point to the tip of vector. The projection is just `otherVec` rescaled so that it reaches that point on the line. !!!info "project(otherVec)" - * [](/types) **otherVec**: The normal vector. + * [](types.md) **otherVec**: The normal vector. ``` Lua vec = Vector(2, 1, 4) @@ -367,12 +367,12 @@ print(vec) --> Vector: { 0.67, -1.3, 0.67 } ####projectOnPlane(...) -[](/types) Projects a vector onto a plane defined by a normal orthogonal to the plane and return self. +[](types.md) Projects a vector onto a plane defined by a normal orthogonal to the plane and return self. A Vector stores the position of the given `vec` in 3d space. A second Vector is given by `otherVec` and defines a direction from a plane towards vector that passes through the origin. Vector.projectOnPlane uses the two Vector values to generate the position of vector in the `otherVec` direction, and return the location of the Vector on the plane. !!!info "projectOnPlane(otherVec)" - * [](/types) **otherVec**: The plane normal vector. + * [](types.md) **otherVec**: The plane normal vector. ``` Lua vec = Vector(2, 1, 4) @@ -382,13 +382,13 @@ print(vec) --> Vector: { 1.33, 2.33, 3.33 } ####reflect(...) -[](/types) Make self into reflection on another vector and return self. +[](types.md) Make self into reflection on another vector and return self. The `otherVec` vector defines a plane (a plane's normal is the vector that is perpendicular to its surface). The `vec` vector is treated as a directional arrow coming in to the plane. The returned value is a vector of equal magnitude to `vec` but with its direction reflected. !!!info "reflect(otherVec)" - * [](/types) **otherVec**: The normal vector. + * [](types.md) **otherVec**: The normal vector. ``` Lua vec = Vector(1, 2, 3) @@ -398,7 +398,7 @@ print(vec) --> Vector: { -3.41, -1.31, 0.79 } ####inverse() -[](/types) Multiply self-components by -1. +[](types.md) Multiply self-components by -1. ``` Lua vec = Vector(1, 2, 3) @@ -408,11 +408,11 @@ print(vec) --> Vector: { -1, -2, -3 } ####moveTowards(...) -[](/types) Move self towards another vector, but only up to a provided distance limit and return self. +[](types.md) Move self towards another vector, but only up to a provided distance limit and return self. !!!info "moveTowards(otherVec, num)" - * [](/types) **target**: The position to move towards. - * [](/types) **num**: The distance limit. + * [](types.md) **target**: The position to move towards. + * [](types.md) **num**: The distance limit. ``` Lua vec = Vector(1, 2, 3) @@ -422,13 +422,13 @@ print(vec) --> Vector: { 1.45, 2.15, 2.85 } ####rotateTowards(...) -[](/types) Rotate self towards another vector, but only up to a provided angle limit and return self. +[](types.md) Rotate self towards another vector, but only up to a provided angle limit and return self. This function is similar to [moveTowards()](#movetowards) except that the vector is treated as a direction rather than a position. The current vector will be rotated round toward the target direction by an angle of `maxAngle`, although it will land exactly on the target rather than overshoot. If the magnitudes of current and target are different, then the magnitude of the result will be linearly interpolated during the rotation. If a negative value is used for `maxAngle`, the vector will rotate away from target until it is pointing in exactly the opposite direction, then stops. !!!info "rotateTowards(target, maxAngle)" - * [](/types) **target**: The position to rotate towards. - * [](/types) **maxAngle**: The maximum angle in **degree** allowed for this rotation. + * [](types.md) **target**: The position to rotate towards. + * [](types.md) **maxAngle**: The maximum angle in **degree** allowed for this rotation. ``` Lua vec = Vector(1, 2, 3) @@ -438,11 +438,11 @@ print(vec) --> Vector: { 2.78, 2.08, 1.39 } ####rotateTowardsUnit(...) -[](/types) Same as [rotateTowards()](#rotatetowards), but only works correctly if `target` Vector is normalized and return self. Less expensive than `rotateTowards()`. +[](types.md) Same as [rotateTowards()](#rotatetowards), but only works correctly if `target` Vector is normalized and return self. Less expensive than `rotateTowards()`. !!!info "rotateTowardsUnit(target, maxAngle)" - * [](/types) **target**: The position to rotate towards. - * [](/types) **maxAngle**: The maximum angle in **degree** allowed for this rotation. + * [](types.md) **target**: The position to rotate towards. + * [](types.md) **maxAngle**: The maximum angle in **degree** allowed for this rotation. ``` Lua vec = Vector(1, 2, 3) @@ -452,11 +452,11 @@ print(vec) --> Vector: { 3.29, 0.87, -1.55 } ####rotateOver(...) -[](/types) Rotate a Vector `angle` degrees over given `axis` (can be `'x'`, `'y'`, `'z'`) and return self. +[](types.md) Rotate a Vector `angle` degrees over given `axis` (can be `'x'`, `'y'`, `'z'`) and return self. !!!info "rotateOver(axis, angle)" - * [](/types) **axis**: The axis to rotate around. - * [](/types) **angle**: The angle in **degree** for this rotation. + * [](types.md) **axis**: The axis to rotate around. + * [](types.md) **angle**: The angle in **degree** for this rotation. ``` Lua vec = Vector(3, 2, 3) @@ -471,15 +471,15 @@ print(vec) --> Vector: { 4.24, 2, 0 } ####dot(...) -[](/types) Return the dot product of two vectors. +[](types.md) Return the dot product of two vectors. The dot product is a float value equal to the magnitudes of the two vectors multiplied together and then multiplied by the cosine of the angle between them. For normalized vectors Dot returns 1 if they point in exactly the same direction, -1 if they point in completely opposite directions and zero if the vectors are perpendicular. !!!info "vec1:dot(vec2)" - * [](/types) **vec1**: First vector. - * [](/types) **vec2**: Second vector. + * [](types.md) **vec1**: First vector. + * [](types.md) **vec2**: Second vector. ``` Lua vec1 = Vector(0, 1, 2) @@ -490,7 +490,7 @@ print(Vector.dot(vec1:normalized(), vec2:normalized())) --> 1 ####magnitude() -[](/types) Returns the length of this vector. +[](types.md) Returns the length of this vector. ``` Lua vec = Vector(1, 2, 3) @@ -500,7 +500,7 @@ print(Vector.magnitude(vec)) --> 3.74 (sqrt of 14) ####sqrMagnitude() -[](/types) Returns the squared length of this vector. +[](types.md) Returns the squared length of this vector. ``` Lua vec = Vector(1, 2, 3) @@ -510,11 +510,11 @@ print(Vector.sqrMagnitude(vec)) --> 14 ####distance(...) -[](/types) Returns distance between two points. +[](types.md) Returns distance between two points. !!!info "p1:distance(p2)" - * [](/types) **p1**: First point. - * [](/types) **p2**: Second point. + * [](types.md) **p1**: First point. + * [](types.md) **p2**: Second point. ``` Lua p1 = Vector(1, 2, 3) @@ -526,11 +526,11 @@ print((p1 - p2):magnitude()) --> 3.32 ####sqrDistance(...) -[](/types) Returns squared distance between two points. +[](types.md) Returns squared distance between two points. !!!info "p1:sqrDistance(p2)" - * [](/types) **p1**: First point. - * [](/types) **p2**: Second point. + * [](types.md) **p1**: First point. + * [](types.md) **p2**: Second point. ``` Lua p1 = Vector(1, 2, 3) @@ -541,13 +541,13 @@ print(Vector.sqrDistance(p1, p2)) --> 11 ####equals(...) -[](/types) Returns true if two vectors are approximately equal. +[](types.md) Returns true if two vectors are approximately equal. The `margin` argument is optional and defaults to tolerating a difference of `~0.03` in both vector magnitude. !!!info "vec1:equals(vec2, margin)" - * [](/types) **vec1**: First vector. - * [](/types) **vec2**: Second vector. - * [](/types) **margin**: (Optional) Numeric tolerance. + * [](types.md) **vec1**: First vector. + * [](types.md) **vec2**: Second vector. + * [](types.md) **margin**: (Optional) Numeric tolerance. ``` Lua vec1 = Vector(1, 2, 3.10) @@ -558,11 +558,11 @@ print(Vector.equals(vec1, vec2, 0.01)) --> true ####string(...) -[](/types) -[](/types) Return string describing self, optional string prefix. +[](types.md) +[](types.md) Return string describing self, optional string prefix. !!!info "string(prefix)" - * [](/types) **prefix**: The prefix of return string. + * [](types.md) **prefix**: The prefix of return string. ``` Lua vec = Vector(1, 2, 3) @@ -577,13 +577,13 @@ print(Vector.string(vec, 'Prefix')) --> Prefix: { 1, 2, 3 }0 ####angle(...) -[](/types) Returns the angle in degrees between two vectors. +[](types.md) Returns the angle in degrees between two vectors. The angle returned is the unsigned angle between the two vectors. This means the smaller of the two possible angles between the two vectors is used. The result is never greater than 180 degrees. !!!info "vec1:angle(vec2)" - * [](/types) **vec1**: First vector. - * [](/types) **vec2**: Second vector. + * [](types.md) **vec1**: First vector. + * [](types.md) **vec2**: Second vector. ``` Lua vec1 = Vector(1, 2, 3) @@ -594,13 +594,13 @@ print(Vector.angle(vec1, vec2)) --> 37.43 ####cross(...) -[](/types) Return a cross-product vector of two vectors. +[](types.md) Return a cross-product vector of two vectors. The cross product of two vectors results in a third vector which is perpendicular to the two input vectors. The result's magnitude is equal to the magnitudes of the two inputs multiplied together and then multiplied by the sine of the angle between the inputs. You can determine the direction of the result vector using the "left hand rule". !!!info "vec1:cross(vec2)" - * [](/types) **vec1**: First vector. - * [](/types) **vec2**: Second vector. + * [](types.md) **vec1**: First vector. + * [](types.md) **vec2**: Second vector. ``` Lua vec1 = Vector(1, 2, 3) @@ -613,16 +613,16 @@ print(Vector.cross(vec2, vec1)) --> Vector: { -5, -10, 5 } ####lerp(...) -[](/types) Linearly interpolates between two points. +[](types.md) Linearly interpolates between two points. Interpolates between the points a and b by the interpolant t. The parameter t is clamped to the range [0, 1]. This is most commonly used to find a point some fraction of the way along a line between two endpoints (e.g. to move an object gradually between those points). The value returned equals (b - a) * t. When t = 0 returns a. When t = 1 returns b. When t = 0.5 returns the point midway between a and b. !!!info "p1:lerp(p2, t)" - * [](/types) **p1**: First point. - * [](/types) **p2**: Second point. - * [](/types) **t**: Fraction. + * [](types.md) **p1**: First point. + * [](types.md) **p2**: Second point. + * [](types.md) **t**: Fraction. ``` Lua p1 = Vector(1, 2, - 4) @@ -633,7 +633,7 @@ print(Vector.lerp(p1, p2, 0.25)) --> Vector: { 1, 2, -2 } ####normalized() -[](/types) Return a new vector that is normalized (length 1) version of self. +[](types.md) Return a new vector that is normalized (length 1) version of self. ``` Lua vec = Vector(1, 2, 3) @@ -643,12 +643,12 @@ print(Vector.normalized(vec)) --> Vector: { 0.27, 0.53, 0.80} ####orthoNormalize(...) -[](/types) -[](/types) -[](/types) Return three normalized vectors perpendicular to each other, first one being in the same direction as self. If `binormalPlaner` is provided, the second vector is guaranteed to be on a self-binormalPlanar plane. +[](types.md) +[](types.md) +[](types.md) Return three normalized vectors perpendicular to each other, first one being in the same direction as self. If `binormalPlaner` is provided, the second vector is guaranteed to be on a self-binormalPlanar plane. !!!info "orthoNormalize(binormalPlanar)" - * [](/types) **binormalPlanar**: (optional) The vector for binormal planar. + * [](types.md) **binormalPlanar**: (optional) The vector for binormal planar. ``` Lua vec = Vector(0, 0, 2) @@ -660,10 +660,10 @@ print(binormal) --> Vector: { 0, -1, 0} ####heading(...) -[](/types) Returns an angle (In degrees) of rotation of Vector over a given `axis` (can be `'x'`, `'y'`, `'z'`). +[](types.md) Returns an angle (In degrees) of rotation of Vector over a given `axis` (can be `'x'`, `'y'`, `'z'`). !!!info "heading(axis)" - * [](/types) **axis**: Can be `'x'`, `'y'`, `'z'`. + * [](types.md) **axis**: Can be `'x'`, `'y'`, `'z'`. ``` Lua vec = Vector(1, 2, 3) diff --git a/docs/wait.md b/docs/wait.md index c27229ea..b2a66013 100644 --- a/docs/wait.md +++ b/docs/wait.md @@ -3,16 +3,16 @@ The Wait class is a static global class which deals with triggering a specified Example usage: `Wait.frames(functionName, 60)` !!!tip - This is the first Class to use functions as parameters. To help, detailed examples are included for each usage. For more details, you can check out the [Function section](types#function) of the Introduction page. + This is the first Class to use functions as parameters. To help, detailed examples are included for each usage. For more details, you can check out the [Function section](types.md#function) of the Introduction page. ##Function Summary Function Name | Description | Return |   -- | -- | -- | -- -condition([](/types#function) toRunFunc, [](/types#function) conditionFunc, [](/types) timeout, [](/types#function) timeoutFunc) | Activates a function when a given function returns `true` or activates a different function if a timeout occurs. | [](/types) | [](#condition) -frames([](/types#function) toRunFunc, [](/types) frameCount) | Activates a function after a set number of frames. | [](/types) | [](#frames) -stop([](/types) id) | Stops a currently running Wait function. | [](/types) | [](#stop) -time([](/types#function) toRunFunc, [](/types) time, [](/types) repetitions) | Activates a function after a set amount of time has passed. | [](/types) | [](#time) +condition([](types.md#function) toRunFunc, [](types.md#function) conditionFunc, [](types.md) timeout, [](types.md#function) timeoutFunc) | Activates a function when a given function returns `true` or activates a different function if a timeout occurs. | [](types.md) | [](#condition) +frames([](types.md#function) toRunFunc, [](types.md) frameCount) | Activates a function after a set number of frames. | [](types.md) | [](#frames) +stop([](types.md) id) | Stops a currently running Wait function. | [](types.md) | [](#stop) +time([](types.md#function) toRunFunc, [](types.md) time, [](types.md) repetitions) | Activates a function after a set amount of time has passed. | [](types.md) | [](#time) --- @@ -20,16 +20,16 @@ time([](/types#function) toRunFunc, [](/types) Activates a function when a given function returns `true` or activates a different function if a timeout occurs. +[](types.md) Activates a function when a given function returns `true` or activates a different function if a timeout occurs. > The returned value is an ID which can be used with [stop](#stop) to cancel the function at any time. !!!info "condition(toRunFunc, conditionFunc, timeout, timeoutFunc)" - * [](/types#function) **toRunFunc**: The function to activate once the condition is met. - * [](/types#function) **conditionFunc**: The function that is watched until it returns `true`. - * [](/types) **timeout**: The amount of time, in seconds, before this function gives up checking the condition function. + * [](types.md#function) **toRunFunc**: The function to activate once the condition is met. + * [](types.md#function) **conditionFunc**: The function that is watched until it returns `true`. + * [](types.md) **timeout**: The amount of time, in seconds, before this function gives up checking the condition function. * {>>Optional, defaults to never timing out.<<} - * [](/types#function) **timeoutFunc**: The function that that triggers if the timeout amount is met. + * [](types.md#function) **timeoutFunc**: The function that that triggers if the timeout amount is met. * {>>Optional, defaults to no function being triggered if a timeout happens.<<} Example without a timeout: @@ -85,13 +85,13 @@ end ###frames(...) -[](/types) Activates a function after a set number of frames. The amount of time this takes is based off the Host's FPS. The higher their FPS, the faster this will trigger. +[](types.md) Activates a function after a set number of frames. The amount of time this takes is based off the Host's FPS. The higher their FPS, the faster this will trigger. > The returned value is an ID which can be used with [stop](#stop) to cancel the function at any time. !!!info "frames(toRunFunc, frameCount)" - * [](/types#function) **toRunFunc**: The function to activate once the condition is met. - * [](/types) **frameCount**: The number of frames to wait before activating the above function. + * [](types.md#function) **toRunFunc**: The function to activate once the condition is met. + * [](types.md) **frameCount**: The number of frames to wait before activating the above function. ``` Lua function onLoad() @@ -118,10 +118,10 @@ function sayThree() print("Three") end ###stop(...) -[](/types) Stops a currently running Wait function. The only way to obtain these ID numbers is to get them from the return value of a Wait function. +[](types.md) Stops a currently running Wait function. The only way to obtain these ID numbers is to get them from the return value of a Wait function. !!!info "stop(id)" - * [](/types) **id**: The index number assigned by the game to every Wait function (besides stop). + * [](types.md) **id**: The index number assigned by the game to every Wait function (besides stop). ``` Lua function onLoad() @@ -136,14 +136,14 @@ end ###time(...) -[](/types) Activates a function after a set amount of time has passes. +[](types.md) Activates a function after a set amount of time has passes. > The returned value is an ID which can be used with [stop](#stop) to cancel the function at any time. !!!info "time(toRunFunc, time)" - * [](/types#function) **toRunFunc**: The function to activate once the amount of time has passed. - * [](/types) **time**: The amount of time before the function is triggered. - * [](/types) **repetitions**: Number of times the timer will be repeated. + * [](types.md#function) **toRunFunc**: The function to activate once the amount of time has passed. + * [](types.md) **time**: The amount of time before the function is triggered. + * [](types.md) **repetitions**: Number of times the timer will be repeated. * {>>Optional, defaults to 0.<<} * {>>Using -1 causes it to loop indefinitely unless stopped.<<} diff --git a/docs/webrequest.md b/docs/webrequest.md index 55bc097e..db847f80 100644 --- a/docs/webrequest.md +++ b/docs/webrequest.md @@ -4,19 +4,19 @@ The static global WebRequest class allows you to interact with the web via get, ##Member Variables -Like [Object member variables](object#member-variables), WebRequests have their own member variables. +Like [Object member variables](object.md#member-variables), WebRequests have their own member variables. A WebRequest is returned as part of a function, and these member variables are how your access its information. Variable | Description | Type -- | -- | :-- -download_progress | Download percentage, represented as a value from 0-1. | [](/types) -error | Error text. | [](/types) -is_error | If there is an error with the WebRequest. | [](/types) -is_done | If the WebRequest has finished. | [](/types) -text | Returned data. | [](/types) -upload_progress | Upload percentage, represented as a value from 0-1. | [](/types) -url | The targeted URL. | [](/types) +download_progress | Download percentage, represented as a value from 0-1. | [](types.md) +error | Error text. | [](types.md) +is_error | If there is an error with the WebRequest. | [](types.md) +is_done | If the WebRequest has finished. | [](types.md) +text | Returned data. | [](types.md) +upload_progress | Upload percentage, represented as a value from 0-1. | [](types.md) +url | The targeted URL. | [](types.md) ##Function Summary @@ -24,9 +24,9 @@ All functions return a WebRequest. Function Name | Description |   -- | -- | --: -get([](/types) url, [](/types#function) callback_function) | Get data from the current URL. | [](#get) -post([](/types) url, [](/types) form, [](/types#function) callback_function) | Post the form to the URL. | [](#post) -put([](/types) url, [](/types) data, [](/types#function) callback_function) | Post the data to the URL. | [](#put) +get([](types.md) url, [](types.md#function) callback_function) | Get data from the current URL. | [](#get) +post([](types.md) url, [](types.md) form, [](types.md#function) callback_function) | Post the form to the URL. | [](#post) +put([](types.md) url, [](types.md) data, [](types.md#function) callback_function) | Post the data to the URL. | [](#put) --- @@ -38,8 +38,8 @@ put([](/types) url, [](/types) **url**: The url to pull data from. - * [](/types#function) **callback_function**: The function that will be triggered + * [](types.md) **url**: The url to pull data from. + * [](types.md#function) **callback_function**: The function that will be triggered * {>>Optional, but you will get no data back from the get if it isn't used.<<} ``` Lua @@ -62,9 +62,9 @@ end Post the form to the URL. !!!info "post(url, form, callback_function)" - * [](/types) **url**: The url to pull post to. - * [](/types) **form**: The form of data to post. - * [](/types#function) **callback_function**: The function that will be triggered + * [](types.md) **url**: The url to pull post to. + * [](types.md) **form**: The form of data to post. + * [](types.md#function) **callback_function**: The function that will be triggered * {>>Optional, but you will get no data back from the get if it isn't used.<<} --- @@ -75,7 +75,7 @@ Post the form to the URL. Post the data to the URL. !!!info "put(url, data, callback_function)" - * [](/types) **url**: The url to pull post to. - * [](/types) **data**: The data string to post. - * [](/types#function) **callback_function**: The function that will be triggered + * [](types.md) **url**: The url to pull post to. + * [](types.md) **data**: The data string to post. + * [](types.md#function) **callback_function**: The function that will be triggered * {>>Optional, but you will get no data back from the get if it isn't used.<<} From 0fef033087e7b01388fadd225bb611f9c62378bb Mon Sep 17 00:00:00 2001 From: Eldinnie Date: Sun, 26 Apr 2020 22:25:24 +0200 Subject: [PATCH 26/48] Update object.md --- docs/object.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/object.md b/docs/object.md index 1ec1c0eb..60d14ad4 100644 --- a/docs/object.md +++ b/docs/object.md @@ -231,8 +231,8 @@ call([](types.md) func_name, [](types.md) | [](#getdecals) getLuaScript() | Get a Lua script as a string from the entity. | [](types.md) | getSnapPoints() | Returns a table of sub-tables, each sub-table representing one snap point. | [](types.md) | [](#getsnappoints) -getTable([](types.md) func_name) | Data value of a variable in another Object's script. Can only return a table. | [](types.md) | -getVar([](types.md) func_name) | Data value of a variable in another entity's script. Cannot return a table. | [](types.md) | +getTable([](types.md) table_name) | Data value of a variable in another Object's script. Can only return a table. | [](types.md) | +getVar([](types.md) var_name) | Data value of a variable in another entity's script. Cannot return a table. | [](types.md) | getVectorLines() | Returns Table of data representing the current Vector Lines on this entity. See [setVectorLines](#setvectorlines) for table format.| [](types.md) | setDecals([](types.md) parameters) | Sets which decals are on an object. This removes other decals already present, and can remove all decals as well. | [](types.md) | [](#setdecals) setLuaScript([](types.md) script) | Input a string as an entity's Lua script. Generally only used after spawning a new Object. | [](types.md) | From 8b45999b744f8797ac0fd8f927d897ef708c5e91 Mon Sep 17 00:00:00 2001 From: Zehir Date: Mon, 27 Apr 2020 00:53:32 +0200 Subject: [PATCH 27/48] Adding Color class doc --- docs/color.md | 431 ++++++++++++++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 432 insertions(+) create mode 100644 docs/color.md diff --git a/docs/color.md b/docs/color.md new file mode 100644 index 00000000..099778c9 --- /dev/null +++ b/docs/color.md @@ -0,0 +1,431 @@ +Color is a type of Table that is used to define RGBA values for tinting. R for red, G for green, B for blue and A for alpha (transparency) + +Besides the functions listed below, other classes can be used to manipulate colors as well. + +Example Usage: `#!lua orange = Color(1, 0, 0):lerp(Color(1, 1, 0), 0.5)` + +Check [Manipulation examples](#manipulation-examples) for more detailed usage. + +!!!tip + Vector and Color are the first classes to be defined in pure Lua. This means you **have** to use colon operator (e.g. `col:lerp()`) to call member functions, not the dot operator. Failing to do so will fail with cryptic error messages displayed. + +##Constructors summary + +!!!tip + Every place that returns a coordinate table, like `#!lua obj.getColorTint()`, serves a Color class instance already - you do not have to explicitly construct it. + When constructing Color instances, the `.new` part can be omitted, making e.g. `#!lua Color(1, 0.5, 0.75)` equivalent to `#!lua Color.new(1, 0.5, 0.75)`. + +Function Name | Description | Return |   +-- | -- | -- | --: +Color([](types.md) r, [](types.md) g, [](types.md) b) | Return a color with specified (r, g, b) components. | [](types.md) | [](#colornew) +Color([](types.md) r, [](types.md) g, [](types.md) b, [](types.md) a) | Return a color with specified (r, g, b, a) components. | [](types.md) | [](#colornew) +Color([](types.md) t) | Return a color with r/g/b/a components from source table. | [](types.md) | [](#colornew) +Color.new(...) | Same as Color(...). | [](types.md) | [](#colornew) +Color.fromString([](types.md) colorStr) | Return a color from a color string ('Red', 'Green' etc), capitalization ignored. | [](types.md) | [](#colorfromstring) +Color.Blue | Shorthand for Color.fromString('Blue'), works for all [Player](player-color.md) and [added colors](#coloradd), capitalization ignored. Also return the color name. | [](types.md)[](types.md) | [](#colorblue) + + + + +###Constructors examples + +```lua +function onLoad() + local red = Color.new(1, 0, 0) + local green = Color(0, 1, 0) -- same as Color.new(0, 1, 0) + + local orangePlayer = Color.fromString("Orange") + local purplePlayer = Color.Purple +end +``` + +--- + +##Element access summary + +In addition to accessing color components by their numeric indices (1, 2, 3, 4) and textual identifiers (r, g, b, a), the following methods may also be utilized. + +Function Name | Description | Return |   +-- | -- | -- | -- +setAt([](types.md) k, [](types.md) value) | Sets a component to value and returns self. | [](types.md#vector) | [](#setat) +set([](types.md) r, [](types.md) g, [](types.md) b, [](types.md) a) | Sets `r`, `g`, `b`, `a` components to given values and returns self, alpha is optional| [](types.md#vector) | [](#set) +get() | Returns `r`, `g`, `b`, `a` components as four separate values. | [](types.md)
[](types.md)
[](types.md)
[](types.md) | [](#get) +copy() | Returns a separate Color with identical component values. | [](types.md#vector) | [](#copy) + +!!!tip + Before `Color` was introduced, color tables contained separate values under 1, 2, 3, 4 and r, g, b, a keys, with letter keys taking precedence when they were different. This is no longer the case, and using letter and numerical keys is equivalent. However, when iterating over Color components you have to use `pairs` and only letter keys will be read there. + +###Element access examples + +```lua +function onLoad() + local col = Color(0, 0.5, 0.75) + col.r = 1 -- set the first component + col[2] = 0.25 -- set the second component + col:setAt('b', 1) -- set the third component + + print(col:get()) --> same as print(col.r, col.g, col.b, col.a) + + for colorCode, value in pairs(col) do + print(colorCode .. "="..value) --> r=1 then g=0.25 then b=1 and finally a=1 + end + + col:copy():setAt('a', 0.5) + print(col.a) --> 1, because we only changed 'a' on a copy +end +``` + +--- + + +##Arithmetics summary + +Color also allows you to use arithmetic operators to performs basic operations: + +Operator | Description | Return |   +-- | -- | -- | -- +[](types.md) one == [](types.md) two | Return true if both colors identical or within a small margin of each other, false otherwise. See also [color:equals()](#equals). | [](types.md) +tostring([](types.md) col) | Return a string description of a color. | [](types.md) + +###Arithmetics examples + +```lua +function onLoad() + local col = Color({r = 0.118, g = 0.53, b = 1}) + print(col == Color.blue) --> true + + -- Color : Blue { r = 0.118, g = 0.53, b = 1, a = 1} + tostring(Color(0.118, 0.53, 1)) + + --> Color : { r = 0.3, g = 0.5, b = 1, a = 1} + tostring(Color({r = 0.3, g = 0.5, b = 1})) +end +``` + +--- + +##Methods summary + +###Methods not modifying self + +Method Name | Description | Return |   +-- | -- | -- | --: +col:toHex([](types.md) includeAlpha) | Returns a hex string for `col`, boolean parameter `includeAlpha`. | [](types.md) | [](#tohex) +col:toString([](types.md) tolerance) | Returns a color string if matching this instance, nil otherwise, optional numeric `tolerance` param. | [](types.md) | [](#tostring) +col:equals([](types.md) otherCol, [](types.md) num) | Returns true if `otherCol` same as `col`, false otherwise, optional numeric tolerance param. | [](types.md) | [](#equals) +col:lerp([](types.md) otherCol, [](types.md) num) | Return a color some part of the way between `col` and `otherCol`, numeric arg [0, 1] is the fraction. | [](types.md) | [](#lerp) +col:dump([](types.md) prefix) | Return a string description of a color with an optional `prefix`. | [](types.md)
[](types.md) | [](#dump) + +###Other methods +Method Name | Description | Return |   +-- | -- | -- | --: +Color.list | Returns a table of all color strings. | [](types.md) | [](#colorlist) +Color.Add([](types.md) name, [](types.md) yourColor) | Add your own color definition to the class. | [](types.md) | [](#coloradd) + +--- + +##Constructors details + +###Color.new(...) + +[](types.md) Return a color with specified components. + +!!!info "Color.new(r, g, b)" + * [](types.md) **r**: Red component between 0 and 1. + * [](types.md) **g**: Green component between 0 and 1. + * [](types.md) **b**: Blue component between 0 and 1. + +!!!info "Color.new(r, g, b, a)" + * [](types.md) **r**: Red component between 0 and 1. + * [](types.md) **g**: Green component between 0 and 1. + * [](types.md) **b**: Blue component between 0 and 1. + * [](types.md) **a**: Alpha component between 0 and 1. + +!!!info "Color.new(t)" + * [](types.md) **t**: The table should use the `r`, `g`, `b` and `a` index.
By default the value is 0 for color and 1 for alpha. + + +``` Lua +local red = Color.new(1, 0, 0) +local green = Color(0, 1, 0) -- same as Color.new(0, 1, 0) +local river = Color(52 / 255, 152 / 255, 219 / 255, 160 / 255) +local teal = Color({ r = 0.129, g = 0.694, b = 0.607}) +``` + +!!!info + If you want to use value between 0 and 255 you should divide them by 255 before construct the object. + + +###Color.fromString(...) + +[](types.md) Return a color from a color string ('Red', 'Green' etc), capitalization ignored. + +!!!info "Color.fromString(colorStr)" + * [](types.md) **colorStr**: Any [Player Color](player-color.md) or color added with [Color.Add](#coloradd). + +``` Lua +local col = Color.fromString("Blue") +print(col) --> Color: Blue { r = 0.118, g = 0.53, b = 1, a = 1 } +``` + +###Color.Blue + +[](types.md) +[](types.md) Return a color from a color string ('Red', 'Green' etc). + +Any [Player Color](player-color.md) or color added with [Color.Add](#coloradd). + +``` Lua +local color, name = Color.Blue +print(color) -- Color: Blue { r = 0.118, g = 0.53, b = 1, a = 1 } +print(name) -- Blue + +local color, name = Color.Red +print(color) -- Color: Red { r = 0.856, g = 0.1, b = 0.094, a = 1 } +print(name) -- Red +``` + +--- + +##Element access details + +###setAt(...) + +[](types.md) Update one component of the color and returning self. + +!!!info "setAt(key, num)" + * [](types.md) **key**: Index of component (1, 2, 3 or 4 for r, g, b or a). + * [](types.md) **num**: New value. + +``` Lua +col = Color.Blue +col:setAt(1, 128 / 255):setAt('a', 0.5) +print(col) --> Color: { r = 0.501961, g = 0.53, b = 1, a = 0.5 } +``` + +###set(...) + +[](types.md) Update all components of the vector and returning self. + +Providing a nil value makes it ignore that argument. + +!!!info "set(r, g, b)" + * [](types.md) **r**: New value of Red component. + * [](types.md) **g**: New value of Green component. + * [](types.md) **b**: New value of Blue component. + +!!!info "set(r, g, b, a)" + * [](types.md) **r**: New value of Red component. + * [](types.md) **g**: New value of Green component. + * [](types.md) **b**: New value of Blue component. + * [](types.md) **a**: New value of Alpha component. + +``` Lua +col = Color.black +col:set(41 / 255, 128 / 255, 185 / 255) +print(col) --> Color: { r = 0.160784, g = 0.501961, b = 0.72549, a = 1 } +``` + +###get() + +[](types.md) +[](types.md) +[](types.md) +[](types.md) Returns `r`, `g`, `b`, `a` components as four separate values. + +``` Lua +col = Color.Blue +r, g, b, a = col:get() +print(r + g + b + a) --> 2.648 +``` + +###copy() + +[](types.md) Copy self into a new Color and return it. + +``` Lua +col1 = Color(1, 0.5, 0.75) +col2 = col1:copy() +col1:set(0.75, 1, 0.25) +print(col1) --> Color: { r = 0.75, g = 1, b = 0.25, a = 1 } +print(col2) --> Color: { r = 1, g = 0.5, b = 0.75, a = 1 } +``` + + +##Methods details + +###Methods not modifying self + +####toHex(...) + +[](types.md) Returns a hex string representation of self. + +!!!info "toHex(includeAlpha)" + * [](types.md) **includeAlpha**: Include or not the `a` value. (Default true) + +``` Lua +print(Color.blue:toHex()) -- 1e87ffff +print(Color.blue:toHex(true)) -- 1e87ffff +print(Color.blue:toHex(false)) -- 1e87ff +``` + +####toString(...) + +[](types.md) Returns a color string if matching this instance, nil otherwise, optional numeric `tolerance` param. + +!!!info "toString(tolerance)" + * [](types.md) **tolerance**: Numeric `tolerance`, by default 0.01. + +``` Lua +print(Color( 0.118, 0.53, 1):toString()) -- Blue +``` + +####equals(...) + +[](types.md) Returns true if `otherCol` same as self, false otherwise, optional numeric `tolerance` param. + +!!!info "equals(otherCol, tolerance)" + * [](types.md) **otherCol**: The color to compare with. + * [](types.md) **tolerance**: Numeric `tolerance`, by default 0.01. + +``` Lua +print(Color( 0.118, 0.53, 1):equals(Color.Blue:copy())) -- true +print(Color( 0.118, 0.53, 1) == Color.Blue) -- true + +print(Color( 0.118, 0.53, 1):equals(Color.Blue)) -- Throw errors +``` + +####lerp(...) + +[](types.md) Return a color some part of the way between self and `otherCol`, numeric arg [0, 1] is the fraction. + +!!!info "lerp(otherCol, fraction)" + * [](types.md) **otherCol**: The color to compare with. + * [](types.md) **fraction**: Numeric `fraction`. + +``` Lua +local pink = Color.Red:lerp(Color.White, 0.5) +print(pink) -- Color: { r = 0.928, g = 0.55, b = 0.547, a = 1 } +``` + +####dump(...) + +[](types.md) +[](types.md) Return string describing self, optional string prefix. + +!!!info "dump(prefix)" + * [](types.md) **prefix**: The prefix of return string. + +!!!warning + This function returns one extra float that will be displayed in print function. This value is returned by the last gsub used in internal function. + +``` Lua +col = Color.Blue +str = col:dump('Prefix') +print(str) --> Prefix: Blue { r = 0.118, g = 0.53, b = 1, a = 1 } +print(col:dump('Prefix')) --> Prefix: Blue { r = 0.118, g = 0.53, b = 1, a = 1 } 2 +print(Color.dump(col, 'Prefix')) --> Prefix: Blue { r = 0.118, g = 0.53, b = 1, a = 1 } 2 +``` + +###Other methods + + +####Color.list + +[](types.md) Returns a table of all color strings. + + +``` Lua +data = Color.list +-- Same as +data = { + [1] => "White", + [2] => "Brown", + [3] => "Red", + [4] => "Orange", + [5] => "Yellow", + [6] => "Green", + [7] => "Teal", + [8] => "Blue", + [9] => "Purple", + [10] => "Pink", + [11] => "Grey", + [12] => "Black" +} + +``` + +####Color.Add(...) + +[](types.md) Add your own color definition to the class. + +!!!info "dump(name, yourColor)" + * [](types.md) **name**: The name of the color. + * [](types.md) **yourColor**: The color value. + +``` Lua +Color.Add("River", Color(52 / 255, 152 / 255, 219 / 255)) +local color, name = Color.River +print(color) -- Color: River { r = 0.203922, g = 0.596078, b = 0.858824, a = 1 } +print(name) -- River +``` + +--- + +##Manipulation examples + +Tint all object in scene in orange. +```lua +function onLoad() + local red = Color.Red + local green = Color.Green + + -- Get a color between red and green + local yellow = red:lerp(green, 0.5) + + -- Make the color brighter + yellow:set(yellow.r * 1.5, yellow.g * 1.5, yellow.b * 1.5) + + -- Get a color between yellow and red + local orange = yellow:lerp(Color.Red, 0.5) + + -- Iterate through all scene objects and set the color tint to orange + for k, obj in pairs(getAllObjects()) do + obj.setColorTint(orange) + end +end +``` + +Tint all object in a random color. +```lua +function onLoad() + -- Iterate through all scene objects and generate a random color + for k, obj in pairs(getAllObjects()) do + local colorA = getRandomColor() + local colorB = getRandomColor() + + color = colorA:lerp(colorB, math.random(0, 1)) + + -- Make the color darker or brighter + local factor = math.random(1, 2) + color:set(color.r * factor, color.g * factor, color.b * factor) + + -- Apply the color to object + obj.setColorTint(color) + end +end + +function getRandomColor() + local r = math.random(0, 255) + local g = math.random(0, 255) + local b = math.random(0, 255) + return Color(r / 255, g / 255, b / 255) +end +``` + + + diff --git a/mkdocs.yml b/mkdocs.yml index 3660e9b1..8a91e381 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -70,6 +70,7 @@ pages: - Object: object.md - AssetBundle: assetbundle.md - Clock: clock.md + - Color: color.md - Component: component.md - Counter: counter.md - JSON: json.md From 5664e62c1c969bca0c27f21b70fb376057143626 Mon Sep 17 00:00:00 2001 From: Zehir Date: Mon, 27 Apr 2020 01:41:24 +0200 Subject: [PATCH 28/48] Update mkdocs.yml Replace the pages option (deprecated) with the nav option. --- mkdocs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index 8a91e381..1e62f41a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -52,7 +52,7 @@ extra: - type: 'youtube' link: 'https://www.youtube.com/user/berserkgames' -pages: +nav: - Getting Started: - Introduction: index.md - Overview: overview.md @@ -84,6 +84,7 @@ pages: - Spawnable Objects: spawnableobjects.md - TextTool: texttool.md - Time: time.md + - Timer: timer.md - Turns: turns.md - UI: ui.md - Vector: vector.md From 89c9e39093bfa4684ea313ee666ddaeef150ecd0 Mon Sep 17 00:00:00 2001 From: omniraptorr <63944670+omniraptorr@users.noreply.github.com> Date: Sun, 26 Apr 2020 19:56:56 -0700 Subject: [PATCH 29/48] fixed function signature for group() --- docs/base.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/base.md b/docs/base.md index 68f9804f..fa65660b 100644 --- a/docs/base.md +++ b/docs/base.md @@ -15,7 +15,7 @@ destroyObject([](types.md) obj) | Destory an O getAllObjects() | Returns Table of all spawned [Objects](object.md) in the game. | [](types.md) | getObjectFromGUID([](types.md) guid) | Returns Object by its GUID. Will return `nil` if this GUID doesn't currently exist. | [](types.md) | [](#getobjectfromguid) getSeatedPlayers() | Returns Table of the [Player Colors](player-color.md) strings of seated players. | [](types.md) | -group([](types.md) objects) | Groups objects together, like how the `G` key does for players. | [](types.md) | [](#group) +group([](types.md) objects) | Groups objects together, like how the `G` key does for players. | [](types.md) | [](#group) paste([](types.md) parameters) | Pastes Objects in-game that were copied to the in-game clipboard. Works with [copy(...)](#copy). | [](types.md) | [](#paste) setLookingForPlayers([](types.md) lfp) | Enables/disables looking for group. This is visible in the server browsers, indicating if you are recruiting for a game. | [](types.md) | spawnObject([](types.md) parameters) | Spawns an Object. View the [Spawnable Object](spawnableobjects.md) page for Objects that can be spawned. | [](types.md) | [](#spawnobject) @@ -89,7 +89,7 @@ copy(object_list) ####group(...) -[](types.md) Groups objects together, like how the `G` key does for players. It returns an object reference to the deck/stack formed. +[](types.md) Groups objects together, like how the `G` key does for players. It returns a table of object references to any decks/stacks formed. Not all objects CAN be grouped. If the G key won't work on them, neither will this function. From a603f04236b32f075e4d1efe2dd94955b0e8c017 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Mon, 27 Apr 2020 06:24:18 +1000 Subject: [PATCH 30/48] onObjectCollision* events --- docs/event.md | 154 +++++++++++++++++++++++++++++++++++++++---------- docs/object.md | 22 +++++++ 2 files changed, 147 insertions(+), 29 deletions(-) diff --git a/docs/event.md b/docs/event.md index 2f125f65..860849f5 100644 --- a/docs/event.md +++ b/docs/event.md @@ -14,6 +14,9 @@ onChat([](types.md) message, [](types.md) data) | Called when an external script editor (like [Atom](atom.md)) sends a message back to the game. Used for custom editor functionality. | [](#onexternalmessage) onFixedUpdate() | Called **every physics tick** (90 times a second). This is a frame independent onUpdate(). | [](#onfixedupdate) onLoad([](types.md) save_state) | Called when a game save is finished loading every Object. It is where most setup code will go. | [](#onload) +onObjectCollisionEnter([](types.md) registered_object, [](types.md) collision_info) | Called when an Object starts colliding with a [collision registered](object.md#registercollisions) Object. | [](#onobjectcollisionenter) +onObjectCollisionExit([](types.md) registered_object, [](types.md) collision_info) | Called when an Object stops colliding with a [collision registered](object.md#registercollisions) Object. | [](#onobjectcollisionexit) +onObjectCollisionStay([](types.md) registered_object, [](types.md) collision_info) | Called **every frame** that an Object is colliding with a [collision registered](object.md#registercollisions) Object. | [](#onobjectcollisionstay) onObjectDestroy([](types.md) dying_object) | Called whenever any object is destroyed. | [](#onobjectdestroy) onObjectDrop([](types.md) player_color, [](types.md) dropped_object) | Called whenever any object is dropped by a player. | [](#onobjectdrop) onObjectEnterScriptingZone([](types.md) zone, [](types.md) enter_object) | Called when any object enters any scripting zone. | [](#onobjectenterscriptingzone) @@ -164,6 +167,100 @@ end ``` --- +###onObjectCollisionEnter(...) + +This function is called when an Object starts colliding with a [collision registered](object.md#registercollisions) Object. + +!!!info "onObjectCollisionEnter(registered_object, collision_info)" + * [](types.md) **registered_object**: The object registered to receive collision events. + * [](types.md) **collision_info**: A table containing data about the collision. + * [](types.md) **collision_info.*collision_object***: Object coming into contact with `registered_object`. + * [](types.md) **collision_info.*contact_points***: Table/array full of contact points, where each 3D point is represented by a (number indexed) table, _not_ a [Vector](vector.md). + * [](types.md) **collision_info.*relative_velocity***: Table (number indexed) representation of a 3D vector (but _not_ a [Vector](vector.md)) indicating the direction and magnitude of the collision. + +``` Lua +-- Example Usage +function onObjectCollisionEnter(registered_object, info) + print(tostring(info.collision_object) .. " collided with " .. tostring(object)) +end +``` +``` Lua +-- Example collision_info table +{ + collision_object = objectReference, + contact_points = { + {5, 0, -2} + }, + relative_velocity = {0, 20, 0} +} +``` + +--- + + +###onObjectCollisionExit(...) + +This function is called when an Object stops colliding with a [collision registered](object.md#registercollisions) Object. + +!!!info "onObjectCollisionExit(registered_object, collision_info)" + * [](types.md) **registered_object**: The object registered to receive collision events. + * [](types.md) **collision_info**: A table containing data about the collision. + * [](types.md) **collision_info.*collision_object***: Object leaving contact with `registered_object`. + * [](types.md) **collision_info.*contact_points***: Table/array full of contact points, where each 3D point is represented by a (number indexed) table, _not_ a [Vector](vector.md). + * [](types.md) **collision_info.*relative_velocity***: Table (number indexed) representation of a 3D vector (but _not_ a [Vector](vector.md)) indicating the velocity of the object that has moved out of contact. + +``` Lua +-- Example Usage +function onObjectCollisionExit(registered_object, info) + print(tostring(info.collision_object) .. " stopped colliding with " .. tostring(object)) +end +``` +``` Lua +-- Example collision_info table +{ + collision_object = objectReference, + contact_points = { + {5, 0, -2} + }, + relative_velocity = {0, 20, 0} +} +``` + +--- + + +###onObjectCollisionStay(...) + +This function is called **every frame** that an Object is colliding with a [collision registered](object.md#registercollisions) Object. + +!!!warning + This is a very expensive function and can easily slow/crash your game if misused. Use with caution. + +!!!info "onObjectCollisionStay(registered_object, collision_info)" + * [](types.md) **registered_object**: The object registered to receive collision events. + * [](types.md) **collision_info**: A table containing data about the collision. + * [](types.md) **collision_info.*collision_object***: Object coming into contact with `registered_object`. + * [](types.md) **collision_info.*contact_points***: Table/array full of contact points, where each 3D point is represented by a (number indexed) table, _not_ a [Vector](vector.md). + * [](types.md) **collision_info.*relative_velocity***: Table (number indexed) representation of a 3D vector (but _not_ a [Vector](vector.md)) indicating the direction and magnitude of the collision. + +``` Lua +-- Example Usage +function onObjectCollisionStay(registered_object, info) + print(tostring(info.collision_object) .. " still colliding with " .. tostring(object)) +end +``` +``` Lua +-- Example collision_info table +{ + collision_object = objectReference, + contact_points = { + {5, 0, -2} + }, + relative_velocity = {0, 20, 0} +} +``` + +--- ###onObjectDestroy(...) @@ -538,25 +635,24 @@ end This function is called when an Object starts colliding with the Object the function is on. Does not work in Global. !!!info "onCollisionEnter(collision_info)" - * [](types.md) **collision_info**: A Table containing data on colliding object. + * [](types.md) **collision_info**: A table containing data about the collision. * [](types.md) **collision_info.*collision_object***: Object coming into contact with `self`. - * [](types.md) **collision_info.*contact_points***: Sub-table full of the Vectors where contact took place. - * [](types.md#vector) **collision_info.*relative_velocity***: Direction and magnitude at the time of collision. - + * [](types.md) **collision_info.*contact_points***: Table/array full of contact points, where each 3D point is represented by a (number indexed) table, _not_ a [Vector](vector.md). + * [](types.md) **collision_info.*relative_velocity***: Table (number indexed) representation of a 3D vector (but _not_ a [Vector](vector.md)) indicating the direction and magnitude of the collision. ``` Lua -- Example Usage function onCollisionEnter(info) - print(info.collision_object) + print(tostring(info.collision_object) .. " collided with " .. tostring(self)) end ``` ``` Lua --- Example returned table +-- Example collision_info table { - collision_object = objectReference + collision_object = objectReference, contact_points = { - {x=5, y=0, z=-2, 5, 0, -2}, - } - relative_velocity = {x=0, y=20, z=0, 0, 20, 0} + {5, 0, -2} + }, + relative_velocity = {0, 20, 0} } ``` @@ -568,25 +664,25 @@ end This function is called when an Object stops colliding with the Object the function is on. Does not work in Global. !!!info "onCollisionExit(collision_info)" - * [](types.md) **collision_info**: A Table containing data on colliding object. + * [](types.md) **collision_info**: A table containing data about the collision. * [](types.md) **collision_info.*collision_object***: Object leaving contact with `self`. - * [](types.md) **collision_info.*contact_points***: Sub-table full of the Vectors where contact last broke off. - * [](types.md#vector) **collision_info.*relative_velocity***: Direction and magnitude of the departing Object. + * [](types.md) **collision_info.*contact_points***: Table/array full of contact points, where each 3D point is represented by a (number indexed) table, _not_ a [Vector](vector.md). + * [](types.md) **collision_info.*relative_velocity***: Table (number indexed) representation of a 3D vector (but _not_ a [Vector](vector.md)) indicating the velocity of the object that has moved out of contact. ``` Lua -- Example Usage function onCollisionExit(info) - print(info.collision_object) + print(tostring(info.collision_object) .. " stopped colliding with " .. tostring(self)) end ``` ``` Lua --- Example returned table +-- Example collision_info table { - collision_object = objectReference + collision_object = objectReference, contact_points = { - {x=5, y=0, z=-2, 5, 0, -2}, - } - relative_velocity = {x=0, y=20, z=0, 0, 20, 0} + {5, 0, -2} + }, + relative_velocity = {0, 20, 0} } ``` @@ -600,26 +696,26 @@ This function is called **every frame** that an Object is colliding with the Obj !!!warning This is a very expensive function and can easily slow/crash your game if misused. Use with caution. -!!!info "onCollisionExit(collision_info)" - * [](types.md) **collision_info**: A Table containing data on colliding object. +!!!info "onCollisionStay(collision_info)" + * [](types.md) **collision_info**: A table containing data about the collision. * [](types.md) **collision_info.*collision_object***: Object coming into contact with `self`. - * [](types.md) **collision_info.*contact_points***: Sub-table full of the Vectors where contact is taking place. - * [](types.md#vector) **collision_info.*relative_velocity***: Direction and magnitude of the Object, currently. + * [](types.md) **collision_info.*contact_points***: Table/array full of contact points, where each 3D point is represented by a (number indexed) table, _not_ a [Vector](vector.md). + * [](types.md) **collision_info.*relative_velocity***: Table (number indexed) representation of a 3D vector (but _not_ a [Vector](vector.md)) indicating the direction and magnitude of the collision. ``` Lua -- Example Usage function onCollisionStay(info) - print(info.collision_object) + print(tostring(info.collision_object) .. " still colliding with " .. tostring(self)) end ``` ``` Lua --- Example returned table +-- Example collision_info table { - collision_object = objectReference + collision_object = objectReference, contact_points = { - {x=5, y=0, z=-2, 5, 0, -2}, - } - relative_velocity = {x=0, y=20, z=0, 0, 20, 0} + {5, 0, -2} + }, + relative_velocity = {0, 20, 0} } ``` diff --git a/docs/object.md b/docs/object.md index 60d14ad4..43508ec1 100644 --- a/docs/object.md +++ b/docs/object.md @@ -182,6 +182,7 @@ dealToColorWithOffset([](types.md#vector) offs jointTo([](types.md) object, [](types.md) parameters) | Joints objects together, in the same way the Joint tool does. | [](types.md) | [](#jointto) putObject([](types.md) put_object) | Places an object into a container (chip stacks/bags/decks). | [](types.md) | [](#putobject) randomize([](types.md) color) | Shuffles deck/bag, rolls dice/coin, lifts other objects into the air. Same as pressing `R` by default. If the optional parameter `color` is used, this function will trigger `onObjectRandomized()`, passing that player color. | [](types.md) | +registerCollisions([](types.md) stay) | Registers this object for Global collision events. | [](types.md) | [](#registercollisions) reload() | Returns Object reference of itself after it respawns itself. | [](types.md) | [](#reload) reset() | Resets this Object. Resetting a Deck brings all the Cards back into it. Resetting a Bag clears its contents (works for both Loot and Infinite Bags). | [](types.md) | roll() | Rolls dice/coins. | [](types.md) | @@ -189,6 +190,7 @@ reload() | Returns Object reference of itself after it respawns itself. | [shuffleStates() | Returns an Object reference to a new [state](http://berserk-games.com/knowledgebase/creating-states/) after randomly selecting and changing to one. | [](types.md) | split([](types.md) piles) | Splits a deck, as evenly as possible, into a number of piles. | [](types.md) | [](#split) takeObject([](types.md) parameters) | Returns an Object reference of Object taken from a container (bag/deck/chip stack) and placed into the world. | [](types.md) | [](#takeobject) +unregisterCollisions() | Unregisters this object for Global collision events. | [](types.md) | [](#unregistercollisions) @@ -1362,6 +1364,17 @@ self.putObject(obj) --- +####registerCollisions(...) + +[](types.md) Registers this object for Global collision events, such as [onObjectCollisionEnter](event.md#onobjectcollisionenter). Always returns `true`. + +!!!info "registerCollision(stay)" + * [](types.md) **stay**: Whether we should register for [onObjectCollisionStay](event.md#onobjectcollisionstay). Stay events may negatively impact performance, only set this to `true` if absolutely necessary. + * {>>Optional, defaults to `false`.<<} + +--- + + ####reload() [](types.md) Returns Object reference of itself after it respawns itself. This function causes the Object to be deleted and respawned instantly to refresh it, so its old Object reference will no longer be valid. @@ -1464,6 +1477,15 @@ end --- +####unregisterCollisions(...) + +[](types.md) Unregisters this object for Global collision events. Returns `true` if the object was previously registered, `false` otherwise. + +!!!info "unregisterCollision()" + +--- + + From 4864d3ba1c9d03887e008d5cb99051e529cd0337 Mon Sep 17 00:00:00 2001 From: Zehir Date: Tue, 28 Apr 2020 17:29:04 +0200 Subject: [PATCH 31/48] Update Unity doc links --- docs/object.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/object.md b/docs/object.md index 43508ec1..d596cafb 100644 --- a/docs/object.md +++ b/docs/object.md @@ -13,11 +13,11 @@ Read Example = `isResting = self.resting` Write Example = `self.resting = true` Variable | Description | Type -- | -- | :-- -angular_drag | Angular drag. [Unity rigidbody property](https://docs.unity3d.com/Manual/class-Rigidbody.html). | [](types.md) +angular_drag | Angular drag. [Unity rigidbody property](https://docs.unity3d.com/2019.1/Documentation/Manual/class-Rigidbody.html). | [](types.md) auto_raise | If an object should be lifted above other objects to avoid collision when held by a player. | [](types.md) -bounciness | Bounciness, value of 0-1. [Unity physics material](https://docs.unity3d.com/Manual/class-PhysicMaterial.html). | [](types.md) -drag | Drag. [Unity rigidbody property](https://docs.unity3d.com/Manual/class-Rigidbody.html). | [](types.md) -dynamic_friction | Dynamic friction, value of 0-1. [Unity physics material](https://docs.unity3d.com/Manual/class-PhysicMaterial.html). | [](types.md) +bounciness | Bounciness, value of 0-1. [Unity physics material](https://docs.unity3d.com/2019.1/Documentation/Manual/class-PhysicMaterial.html). | [](types.md) +drag | Drag. [Unity rigidbody property](https://docs.unity3d.com/2019.1/Documentation/Manual/class-Rigidbody.html). | [](types.md) +dynamic_friction | Dynamic friction, value of 0-1. [Unity physics material](https://docs.unity3d.com/2019.1/Documentation/Manual/class-PhysicMaterial.html). | [](types.md) grid_projection | If grid lines can appear on the Object if visible grids are turned on. | [](types.md) guid | The 6 character unique Object identifier within Tabletop Simulator. It is assigned correctly once the `spawning` member variable becomes false. | [](types.md) held_by_color | The Color of the Player that is holding the object. | [](types.md) @@ -26,13 +26,13 @@ Variable | Description | Type interactable | If an object can be interacted with by Players. Other object will still be able to interact with it. | [](types.md) is_face_down | If an Object is roughly face-down (like with cards). The face is the "top" of the Object, the direction of its positive Y coordinate. Read only. | [](types.md) loading_custom | If the Object's custom elements (images/models/etc) are loading. Read only. | [](types.md) -mass | Mass. [Unity rigidbody property](https://docs.unity3d.com/Manual/class-Rigidbody.html). | [](types.md) +mass | Mass. [Unity rigidbody property](https://docs.unity3d.com/2019.1/Documentation/Manual/class-Rigidbody.html). | [](types.md) name | The Object's name. Read only, use `setName("")` to write to it. | [](types.md) -resting | If an Object is at rest. [Unity rigidbody property](https://docs.unity3d.com/412/Documentation/Components/RigidbodySleeping.html). | [](types.md) +resting | If an Object is at rest. [Unity rigidbody property](https://docs.unity3d.com/2019.1/Documentation/Manual/RigidbodiesOverview.html). | [](types.md) script_code | The Lua Script on the Object. | [](types.md) script_state | The saved data on the object. See [onSave()](event.md#onsave). | [](types.md) spawning | If the Object is finished spawning. Read only. | [](types.md) -static_friction | Static friction, value of 0-1. [Unity physics material](https://docs.unity3d.com/Manual/class-PhysicMaterial.html). | [](types.md) +static_friction | Static friction, value of 0-1. [Unity physics material](https://docs.unity3d.com/2019.1/Documentation/Manual/class-PhysicMaterial.html). | [](types.md) sticky | If other Objects on top of this one are also picked up when this Object is. | [](types.md) tag | This object's type. Read only. | [](types.md) tooltip | If the tooltip opens when a pointer hovers over the object. Tooltips display name and description. | [](types.md) @@ -289,7 +289,7 @@ setVectorLines([](types.md) parameters) | Spaw ####getBounds() -[](types.md) Returns a Table of Vector information describing the size of an object in Global terms. [Bounds](https://docs.unity3d.com/ScriptReference/Bounds.html) are part of Unity, and represent an imaginary square box that can be drawn around an object. Unlike scale, it can help indicate the size of an object in in-game units, not just relative model size. +[](types.md) Returns a Table of Vector information describing the size of an object in Global terms. [Bounds](https://docs.unity3d.com/2019.1/Documentation/ScriptReference/Bounds.html) are part of Unity, and represent an imaginary square box that can be drawn around an object. Unlike scale, it can help indicate the size of an object in in-game units, not just relative model size. !!!info "Return Table" * [](types.md) **center**: The Vector of the center of the bounding box. @@ -310,7 +310,7 @@ setVectorLines([](types.md) parameters) | Spaw ####getBoundsNormalized() -[](types.md) Returns a Table of Vector information describing the size of an object in Global terms, as if it was rotated to {0,0,0}. [Bounds](https://docs.unity3d.com/ScriptReference/Bounds.html) are part of Unity, and represent an imaginary square box that can be drawn around an object. Unlike scale, it can help indicate the size of an object in in-game units, not just relative model size. +[](types.md) Returns a Table of Vector information describing the size of an object in Global terms, as if it was rotated to {0,0,0}. [Bounds](https://docs.unity3d.com/2019.1/Documentation/ScriptReference/Bounds.html) are part of Unity, and represent an imaginary square box that can be drawn around an object. Unlike scale, it can help indicate the size of an object in in-game units, not just relative model size. !!!info "Return Table" * [](types.md) **center**: The Vector of the center of the bounding box. From cf5534cc3034d1931792f8400a351a99f04e7f44 Mon Sep 17 00:00:00 2001 From: omniraptorr <63944670+omniraptorr@users.noreply.github.com> Date: Wed, 29 Apr 2020 08:20:49 -0700 Subject: [PATCH 32/48] Patch 12.3 (tts-community/api#18) adds in new lua features from patch 12.3. Since this patch introduces a couple new types of spawnable objects, we also move spawnable objects to their own subcategory in the scripting api nav menu. --- docs/book.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++ docs/browser.md | 12 ++++++++ docs/css/theme.css | 13 +++++---- docs/event.md | 26 ++++++++++++++++++ docs/grid.md | 20 ++++++++++++++ docs/object.md | 22 +++++++++++++-- docs/player.md | 1 + mkdocs.yml | 3 ++ 8 files changed, 157 insertions(+), 8 deletions(-) create mode 100644 docs/book.md create mode 100644 docs/browser.md create mode 100644 docs/grid.md diff --git a/docs/book.md b/docs/book.md new file mode 100644 index 00000000..893b4b65 --- /dev/null +++ b/docs/book.md @@ -0,0 +1,68 @@ +The Custom PDF is a type in-game Spawnable Object that renders a PDF from a URL. It has its own class, Book, with functions/members associated with it. This allows you to manipulate the special properties of a Custom PDF. + +Example Usage: `obj.Book.setPage(1, false)` + +##Member Variables + +Like [Object member variables](object.md#member-variables), Books have their own member variables. + +Variable | Description | Type +-- | -- | :-- +page_offset | The page numbers displayed in the Custom PDF UI are offset by this amount. | [](types.md) + +!!! info + For example, if `page_offset` were set to 10, the first page in the UI would be 11, rather than 1. Negative numbers are accepted, and useful if a rule book contains a front cover, index etc. within the PDF file. + +##Function Summary + +###Object Functions + +Function Name | Description | Return |   +-- | -- | -- | --: +getPage([](types.md) offsetPageNumbering) | Gets the current page of the PDF. | [](types.md) | [](#getpage) +setPage([](types.md) page, [](types.md) offsetPageNumbering) | Set current page. | [](types.md)| [](#setpage) +setHighlight([](types.md) x1, [](types.md) y1, [](types.md) x2, [](types.md) y2) | Set highlight box on current page. | [](types.md) | [](#sethighlight) +clearHighlight() | Clears the current highlight. | [](types.md) + +--- + +##Function Details + +####getPage(...) + +[](types.md) Gets the current page of the PDF. + +!!! info "getPage(offsetPageNumbering)" + * [](types.md) **offsetPageNumbering**: Indicates whether or not [page_offset](#page_offset) should be applied to the page number returned. + * {>>Optional, defaults to `false`.<<} +--- + +####setPage(...) + +[](types.md) Sets the current page of the PDF. Returns true if the page was succesfully set, false if the page number was invalid. + +!!! info "setPage(page, offsetPageNumbering)" + * [](types.md) **page**: The new page number. + * [](types.md) **offsetPageNumbering**: Indicates whether or not [page_offset](#page_offset) should be applied to the page number set. + * {>>Optional, defaults to `false`.<<} + + +--- + +####setHighlight(...) + +[](types.md) Draws a highlight rectangle on the popout mode of the PDF at the given coordinates. Coordinates (0,0) are the lower left corner of the PDF, while coordinates (1,1) are the upper right corner. + +!!! info "setHighlight(x1, y1, x2, y2)" + * [](types.md) **x1**: x coordinate of the rectangle's left side. + * [](types.md) **y1**: y coordinate of the rectangle's bottom side. + * [](types.md) **x2**: x coordinate of the rectangle's right side. + * [](types.md) **y2**: y coordinate of the rectangle's top side. + +``` Lua +-- Sets highlight of upper right quarter of the pdf +self.Book.setHighlight(0.5, 0.5, 1, 1) +``` + +!!! bug + setHighlight() will do nothing if you try to draw a highlight twice in a row at the same coordinates, even if you call clearHighlight() or reload() on the object in between calls to setHighlight(). diff --git a/docs/browser.md b/docs/browser.md new file mode 100644 index 00000000..a72fdcc5 --- /dev/null +++ b/docs/browser.md @@ -0,0 +1,12 @@ +The Tablet is an in-game Object that displays a web page. It has its own class, Browser, with member variables associated with it. This allows you to manipulate the special properties of a tablet. + +Example Usage: `self.Browser.url = "https://yahoo.com/"` + +##Member Variables + +Like [Object member variables](object.md#member-variables), Tablets have their own member variables. + +Variable | Description | Type +-- | -- | :-- +url | URL which currently wants to display. | [](types.md) +pixel_width | The pixel width the browser is virtually rendering to. | [](types.md) diff --git a/docs/css/theme.css b/docs/css/theme.css index 2f492dae..c4a52c0e 100644 --- a/docs/css/theme.css +++ b/docs/css/theme.css @@ -87,12 +87,13 @@ color: #bb0c0d !important; } -/*anchor offset*/ -.anchor:before { - content:""; - display:block; - height:130px; /* fixed header height*/ - margin:-130px 0 0; /* negative fixed header height */ +/*anchor offset, see issue #20*/ +.anchor { + content:""; + display:block; + padding-top: 72px; + margin:-72px 0 0; /* negative fixed header height */ + pointer-events: none; } /*prevent left/right scrollbar diff --git a/docs/event.md b/docs/event.md index 860849f5..911bf2e5 100644 --- a/docs/event.md +++ b/docs/event.md @@ -24,6 +24,7 @@ onObjectEnterContainer([](types.md) container, onObjectLeaveScriptingZone([](types.md) zone, [](types.md) enter_object) | Called when any object leaves any scripting zone. | [](#onobjectleavescriptingzone) onObjectLeaveContainer([](types.md) container, [](types.md) leave_object) | Called when any object leaves any container. | [](#onobjectleavecontainer) onObjectLoopingEffect([](types.md) loop_object, [](types.md) index) | Called whenever the looping effect of an [AssetBundle](assetbundle.md) is activated. | [](#onobjectloopingeffect) +onObjectPageChange([](types.md) object) | Called when a Custom PDF object changes page. | [](#onobjectpagechange) onObjectPeek([](types.md) object, [](types.md) player) | Called when a player using peek to look under an Object. | [](#onobjectpeek) onObjectPickUp([](types.md) player_color, [](types.md) picked_up_object) | Called whenever a Player picks up an Object. | [](#onobjectpickup) onObjectRandomize([](types.md) randomize_object, [](types.md) player_color) | Called when an Object is randomized. Like when shuffling a deck or shaking dice. | [](#onobjectrandomize) @@ -60,6 +61,7 @@ onCollisionExit([](types.md) collision_info) | onCollisionStay([](types.md) collision_info) | Called **every frame** that an Object is colliding with the Object this function is on. | [](#oncollisionstay) onDestroy() | Called when an Object it is on is destroyed. | [](#ondestroy) onDrop([](types.md) player_color) | Called when a player releases an Object after picking it up. | [](#ondrop) +onPageChange() | Called when a Custom PDF page is changed. | [](#onpagechange) onPeek([](types.md) player) | Called when a player using peek to look under this Object. | [](#onpeek) onPickUp([](types.md) player_color) | Called when a player picks up an Object. | [](#onpickup) onRandomize([](types.md) player_color) | Called when this Object is randomized. Like when shuffling a deck or shaking dice. | [](#onrandomize) @@ -380,6 +382,18 @@ function onObjectLoopingEffect(obj, index) end ``` +--- +###onObjectPageChange(...) + +Called when an object's Custom PDF page is changed. + +``` Lua +function onObjectPageChange(obj) + print(obj.getName() .. "changed page to " .. obj.Book.getPage()) -- Print new page. +end +``` + + --- @@ -749,6 +763,18 @@ end --- +###onPageChange() + +Called when this object's Custom PDF page is changed. + +``` Lua +function onPageChange() + print(self.getName() .. "changed page to " .. self.Book.getPage()) -- Print new page. +end +``` + + +--- ###filterObjectEnter(...) diff --git a/docs/grid.md b/docs/grid.md new file mode 100644 index 00000000..9af01485 --- /dev/null +++ b/docs/grid.md @@ -0,0 +1,20 @@ +Grid, a static global class, controls the in-game grid. It allows you to manipulate the placement and appearance of the grid in the same way as the in-game interface. + +Example usage: `Grid.show_lines = true`. + +##Member Variables + +Like [Object member variables](object.md#member-variables), Grid has its own member variables. They allow for direct access to the Grid's properties. + +Variable | Description | Type +-- | -- | :-- +type | The type of the grid. 1 = Rectangles, 2 = Horizontal hexes, 3 = Vertical hexes. | [](types.md) +show_lines | Visibility of the grid lines. | [](types.md) +color | Color of the grid lines. | [](types.md) +opacity | Opacity of the grid lines. | [](types.md) +thick_lines | Thickness of the grid lines. | [](types.md) +offsetX | X offset of the grid origin. | [](types.md) +offsetY | Y offset of the grid origin. | [](types.md) +sizeX | Width of the grid cells. | [](types.md) +sizeY | Height of the grid cells. | [](types.md) +snapping | Method of snapping objects to the grid. 1 = Off, 2 = Lines, 3 = Center, 4 = Both. | [](types.md) diff --git a/docs/object.md b/docs/object.md index d596cafb..f6c3dd21 100644 --- a/docs/object.md +++ b/docs/object.md @@ -16,6 +16,7 @@ Variable | Description | Type angular_drag | Angular drag. [Unity rigidbody property](https://docs.unity3d.com/2019.1/Documentation/Manual/class-Rigidbody.html). | [](types.md) auto_raise | If an object should be lifted above other objects to avoid collision when held by a player. | [](types.md) bounciness | Bounciness, value of 0-1. [Unity physics material](https://docs.unity3d.com/2019.1/Documentation/Manual/class-PhysicMaterial.html). | [](types.md) +drag_selectable | If this is set, object will never be drag-selected. | [](types.md) drag | Drag. [Unity rigidbody property](https://docs.unity3d.com/2019.1/Documentation/Manual/class-Rigidbody.html). | [](types.md) dynamic_friction | Dynamic friction, value of 0-1. [Unity physics material](https://docs.unity3d.com/2019.1/Documentation/Manual/class-PhysicMaterial.html). | [](types.md) grid_projection | If grid lines can appear on the Object if visible grids are turned on. | [](types.md) @@ -41,12 +42,19 @@ Variable | Description | Type use_hands | If this object can be held in a hand zone. | [](types.md) use_rotation_value_flip | Switches the axis an Object rotates around when flipped. | [](types.md) use_snap_points | If snap points are used or ignored. | [](types.md) +value_flags | A bit field, objects with overlapping `value_flag` bits are counted together when selected. | [](types.md) +value | The value of the object for summing up selected objects. Only works if the apropriate bits are set in `obj.value_flags` | [](types.md) + +!!! bug + The `drag_selectable`, `value_flags` and `value` member variables do not persist when the object is reloaded (such as loading a save and entering/exiting containers). These member variables are classes of their own, and have their own member variables. Each one is for a special type of Object. Variable Name | Description -- | -- AssetBundle | An [AssetBundle](assetbundle.md), which is a type of custom object made in Unity. +Book | A [Book](book.md), which is the in-game Custom PDF object. +Browser | A [Browser](browser.md), which is the in-game Tablet object. Clock | A [Clock](clock.md), which is the in-game digital clock. Counter | A [Counter](counter.md), which is the in-game digital counter. RPGFigurine | An [RPGFigurine](rpgfigurine.md), which is an in-game animated figurine. @@ -125,6 +133,7 @@ These functions obtain information from an object. Function Name | Description | Return |   -- | -- | -- | -- +getAttachments() | Returns a table in the same format as [getObjects()](#getobjects) for containers. | [](types.md) | getColorTint() | Color tint. | [](types.md#color) | getCustomObject() | Returns a Table with the Custom Object information of a Custom Object. | [](types.md) | [](#getcustomobject) getDescription() | Description, also shows as part of Object's tooltip. | [](types.md) @@ -138,6 +147,7 @@ getObjects() | Returns a Table of Objects in the script zone/bag/deck. | [getQuantity() | How many objects are in the stack. Returns -1 if the Object is not a stack. | [](types.md) | getRotationValue() | Returns the current rotationValue. Rotation values are used to give value to different rotations (like dice). | [](types.md) | [](#getrotationvalue) getRotationValues() | Returns a Table of rotation values. Rotation values are used to give value to different rotations (like dice). | [](types.md) | [](#getrotationvalues) +getSelectingPlayers() | Returns a table of the player colors currently selecting the object. | [](types.md) getStateId() | Current [state](https://kb.tabletopsimulator.com/host-guides/creating-states/) ID (index) an object is in. Returns -1 if there are no other states. State ids (indexes) start at 1. | [](types.md) | getStates() | Returns a Table of information on the [states](https://kb.tabletopsimulator.com/host-guides/creating-states/) of an Object. | [](types.md) | [](#getstates) getValue() | Object value. What the value represents depends on what type of Object this function is used on. | [](types.md) | [](#getvalue) @@ -170,7 +180,14 @@ These functions perform general actions on objects. Function Name | Description | Return |   -- | -- | -- | -- -flip() | Flip Object over. | [](types.md) | +addAttachment([](types.md) Object) | The Object supplied as param is destroyed and becomes a dummy Object child. | [](types.md) +removeAttachment([](types.md) index) | Removes a child with the given index. Use [getAttachments()](#getattachments) to find out the index property. | [](types.md) +removeAttachments() | Detaches the children of this Object. Returns a table of object references | [](types.md) +destroyAttachment([](types.md) index) | Destroys an attachment with the given index. | [](types.md) +destroyAttachments() | Destroys all attachments. | [](types.md) +addToPlayerSelection([](types.md) player_color) | Adds object to player's selection. | [](types.md) +removeFromPlayerSelection([](types.md) player_color) | Removes object from player's selection. | [](types.md) +flip() | Flips Object over. | [](types.md) | clone([](types.md) parameters) | Copy/Paste this Object, returning a reference to the new Object. | [](types.md) | [](#clone) cut([](types.md) count) | Cuts (splits) a deck at the given card count. | [](types.md) | [](#cut) deal([](types.md) number, [](types.md) player_color, [](types.md) index) | Deals Objects. Will deal from decks/bags/stacks/individual items. | [](types.md) | [](#deal) @@ -941,10 +958,11 @@ If an Object is inside of a container, it does not exist in-game. As a result, y !!!info "Bag or Deck" Returns a Table of sub-Tables, each sub-Table containing data on 1 bagged item. Indexes start at 0. + * [](types.md) **index**: Index of the item, represents the item's order in the container. * [](types.md) **name**: Name of the item. * [](types.md) **description**: Description of the item. * [](types.md) **guid**: GUID of the item. - * [](types.md) **index**: Index of the item, represents the item's order in the container. + * [](types.md) **gm_notes**: GM Notes on the item. * [](types.md) **lua_script**: Any Lua scripting saved on the item. * [](types.md) **lua_script_state**: Any JSON save data on this item. * {>>nickname: A duplicate of the "name" field.<<} diff --git a/docs/player.md b/docs/player.md index cfd2fa73..777a1456 100644 --- a/docs/player.md +++ b/docs/player.md @@ -39,6 +39,7 @@ getHandTransform([](types.md) hand_index) | Re getPointerPosition() | Player's pointer coordinates. | [](types.md#vector) getPointerRotation() | Player's pointer rotation. | [](types.md#vector) getSelectedObjects() | Objects that the Player has selected with an area selection. | [](types.md) +clearSelectedObjects() | Clears a player's current selection. | [](types.md) kick() | Kicks Player out of the room. | [](types.md) lookAt([](types.md) parameters) | Moves a Player's camera, forcing 3'rd person camera mode. | [](types.md) | [](#lookat) mute() | Mutes or unmutes Player, preventing/allowing voice chat. | [](types.md) diff --git a/mkdocs.yml b/mkdocs.yml index 1e62f41a..cdbf9b2b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -69,10 +69,13 @@ nav: - Base: base.md - Object: object.md - AssetBundle: assetbundle.md + - Book: book.md + - Browser: browser.md - Clock: clock.md - Color: color.md - Component: component.md - Counter: counter.md + - Grid: grid.md - JSON: json.md - Lighting: lighting.md - Music Player: musicplayer.md From 2da9e8117ce897a32926368ae52e1f8ee51c70bb Mon Sep 17 00:00:00 2001 From: Zehir Date: Wed, 29 Apr 2020 18:36:55 +0200 Subject: [PATCH 33/48] Reorder to match ingame --- docs/grid.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/grid.md b/docs/grid.md index 9af01485..959d73f1 100644 --- a/docs/grid.md +++ b/docs/grid.md @@ -12,9 +12,9 @@ Variable | Description | Type show_lines | Visibility of the grid lines. | [](types.md) color | Color of the grid lines. | [](types.md) opacity | Opacity of the grid lines. | [](types.md) -thick_lines | Thickness of the grid lines. | [](types.md) +thick_lines | Thickness of the grid lines. false = Thin, true = Thick. | [](types.md) +snapping | Method of snapping objects to the grid. 1 = Off, 2 = Lines, 3 = Center, 4 = Both. | [](types.md) offsetX | X offset of the grid origin. | [](types.md) offsetY | Y offset of the grid origin. | [](types.md) sizeX | Width of the grid cells. | [](types.md) sizeY | Height of the grid cells. | [](types.md) -snapping | Method of snapping objects to the grid. 1 = Off, 2 = Lines, 3 = Center, 4 = Both. | [](types.md) From 9ff40891059fb3a8f7398774c757133c24a6f1a5 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Fri, 1 May 2020 03:24:42 +1000 Subject: [PATCH 34/48] The name property is not the same as getName() --- docs/object.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/object.md b/docs/object.md index f6c3dd21..7dec64b4 100644 --- a/docs/object.md +++ b/docs/object.md @@ -28,7 +28,7 @@ Variable | Description | Type is_face_down | If an Object is roughly face-down (like with cards). The face is the "top" of the Object, the direction of its positive Y coordinate. Read only. | [](types.md) loading_custom | If the Object's custom elements (images/models/etc) are loading. Read only. | [](types.md) mass | Mass. [Unity rigidbody property](https://docs.unity3d.com/2019.1/Documentation/Manual/class-Rigidbody.html). | [](types.md) -name | The Object's name. Read only, use `setName("")` to write to it. | [](types.md) +name | The Object's component name. Read only. | [](types.md) resting | If an Object is at rest. [Unity rigidbody property](https://docs.unity3d.com/2019.1/Documentation/Manual/RigidbodiesOverview.html). | [](types.md) script_code | The Lua Script on the Object. | [](types.md) script_state | The saved data on the object. See [onSave()](event.md#onsave). | [](types.md) From 6169ab4065982cc1deb0cc31ebbde96893bad48d Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Fri, 1 May 2020 03:50:26 +1000 Subject: [PATCH 35/48] More verbose description for object.name --- docs/object.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/object.md b/docs/object.md index 7dec64b4..d3c0a2d9 100644 --- a/docs/object.md +++ b/docs/object.md @@ -28,7 +28,7 @@ Variable | Description | Type is_face_down | If an Object is roughly face-down (like with cards). The face is the "top" of the Object, the direction of its positive Y coordinate. Read only. | [](types.md) loading_custom | If the Object's custom elements (images/models/etc) are loading. Read only. | [](types.md) mass | Mass. [Unity rigidbody property](https://docs.unity3d.com/2019.1/Documentation/Manual/class-Rigidbody.html). | [](types.md) -name | The Object's component name. Read only. | [](types.md) +name | Internal resource name for this Object. Read only, and only useful for [spawnObjectJSON()](base.md#spawnobjectjson). Generally, you want [getName()](#getname). | [](types.md) resting | If an Object is at rest. [Unity rigidbody property](https://docs.unity3d.com/2019.1/Documentation/Manual/RigidbodiesOverview.html). | [](types.md) script_code | The Lua Script on the Object. | [](types.md) script_state | The saved data on the object. See [onSave()](event.md#onsave). | [](types.md) From 8f862bc4cf91987b6f537d5bd6e30f5c4496462e Mon Sep 17 00:00:00 2001 From: omniraptorr <63944670+omniraptorr@users.noreply.github.com> Date: Thu, 30 Apr 2020 14:29:14 -0700 Subject: [PATCH 36/48] fixes issue tts-community/api#20. credit to discord user Thelo#0327 --- docs/css/theme.css | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/css/theme.css b/docs/css/theme.css index c4a52c0e..2d880fb2 100644 --- a/docs/css/theme.css +++ b/docs/css/theme.css @@ -87,13 +87,14 @@ color: #bb0c0d !important; } -/*anchor offset, see issue #20*/ +/*anchor offset*/ + +td {position: relative;} + .anchor { - content:""; - display:block; - padding-top: 72px; - margin:-72px 0 0; /* negative fixed header height */ - pointer-events: none; + position: absolute; + top: 0px; + margin: -48px 0 0; /* negative fixed header height */ } /*prevent left/right scrollbar From 008180f61d3a3c23ec812103ac303fae64fc9fe0 Mon Sep 17 00:00:00 2001 From: omniraptorr <63944670+omniraptorr@users.noreply.github.com> Date: Thu, 30 Apr 2020 20:23:46 -0700 Subject: [PATCH 37/48] added infobox about y-alignment of decks in putObject(). see issue tts-community/api#25 --- docs/object.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/object.md b/docs/object.md index d3c0a2d9..ca56de31 100644 --- a/docs/object.md +++ b/docs/object.md @@ -1367,11 +1367,14 @@ self.jointTo(obj, { [](types.md) Places an object into a container (chip stacks/bags/decks). If neither Object is a container, but they are able to be combined (like with 2 cards), then they form a deck/stack. -!!!info "putObject(put_object)" - * [](types.md) **put_object**: An Object to place into the container. +!!! info "putObject(put_object)" + * [](types.md) **put_object**: An Object to place into the container. -!!!info "Returned Object" - The container is returned as the Object reference. Either this is the container/deck/stack the other Object was placed into, or the deck/stack that was formed by the putObject action. +!!! info "Returned Object" + The container is returned as the Object reference. Either this is the container/deck/stack the other Object was placed into, or the deck/stack that was formed by the putObject action. + +!!! info "Putting Cards into Decks" + When you call this `putObject()` to put a card into a deck, the card goes into the end of the deck which is closest to it in Y elevation. So, if both the card and the deck are resting on the table, the card will be put at the bottom of the deck. if the card is hovering above the deck, it will be put at the top." ``` Lua -- Example of a script on a bag that places Object into itself From 7599bad1ac2ec7780803c4910995f51542e53775 Mon Sep 17 00:00:00 2001 From: Zehir Date: Fri, 1 May 2020 17:59:15 +0200 Subject: [PATCH 38/48] Split Spawnable Objects page --- docs/base.md | 6 +- docs/built-in-object.md | 154 ++++++++++++++ ...nableobjects.md => custom-game-objects.md} | 195 +----------------- docs/object.md | 4 +- mkdocs.yml | 4 +- 5 files changed, 171 insertions(+), 192 deletions(-) create mode 100644 docs/built-in-object.md rename docs/{spawnableobjects.md => custom-game-objects.md} (74%) diff --git a/docs/base.md b/docs/base.md index fa65660b..dca60f9e 100644 --- a/docs/base.md +++ b/docs/base.md @@ -18,7 +18,7 @@ getObjectFromGUID([](types.md) guid) | Returns group([](types.md) objects) | Groups objects together, like how the `G` key does for players. | [](types.md) | [](#group) paste([](types.md) parameters) | Pastes Objects in-game that were copied to the in-game clipboard. Works with [copy(...)](#copy). | [](types.md) | [](#paste) setLookingForPlayers([](types.md) lfp) | Enables/disables looking for group. This is visible in the server browsers, indicating if you are recruiting for a game. | [](types.md) | -spawnObject([](types.md) parameters) | Spawns an Object. View the [Spawnable Object](spawnableobjects.md) page for Objects that can be spawned. | [](types.md) | [](#spawnobject) +spawnObject([](types.md) parameters) | Spawns an Object. See [Built-in](built-in-object.md) and [Custom](custom-game-objects.md) Spawnable Object pages for further details. | [](types.md) | [](#spawnobject) spawnObjectJSON([](types.md) parameters) | Spawns an Object using a JSON string. Works with [getJSON()](object.md#getjson). | [](types.md) | [](#spawnobjectjson) startLuaCoroutine([](types.md) function_owner, [](types.md) function_name) | Start a coroutine. | [](types.md) | [](#startluacoroutine) stringColorToRGB([](types.md) player_color) | Converts a [Player Color](player-color.md) string into a Color Table for tinting. | [](types.md#color) | [](#stringcolortorgb) @@ -130,7 +130,7 @@ end ####spawnObject(...) -[](types.md) Spawn an Object. View the [Spawnable Objects](spawnableobjects.md) page for Objects that can be spawned. +[](types.md) Spawns an Object. See [Built-in](built-in-object.md) and [Custom](custom-game-objects.md) Spawnable Objects pages for details of specific spawnable objects. If you are spawning a **custom Object**, you should call [setCustomObject](object.md#setcustomobject) immediately after spawnObject to set its custom properties. @@ -139,7 +139,7 @@ If you are spawning a **custom Object**, you should call [setCustomObject](objec !!!info "spawnObject(parameters)" * [](types.md) **parameters**: A Table of parameters used to determine how spawnObject will act. - * [](types.md) **parameters.type**: [Spawnable Object](spawnableobjects.md) type. + * [](types.md) **parameters.type**: [Built-in](built-in-object.md) or [Custom](custom-game-objects.md) Game Object name. * [](types.md#vector) **parameters.position**: Position to place Object. * {>>Optional, defaults to {x=0, y=3, z=0}.<<} * [](types.md#vector) **parameters.rotation**: Rotation of the Object. diff --git a/docs/built-in-object.md b/docs/built-in-object.md new file mode 100644 index 00000000..98c6b0e1 --- /dev/null +++ b/docs/built-in-object.md @@ -0,0 +1,154 @@ + +Objects can be spawned by any script using the [spawnObject()](base.md#spawnobject) function. These are the `type` Strings used to designate the type of Object to spawn. + + +##Boards + +* backgammon_board +* CardBot_Board +* Checker_Board +* Chess_Board +* Chinese_Checkers_Board +* Go_Board +* Pachisi_Board +* reversi_board + +##Containers + +* Bag +* Bowl +* Cup +* go_game_bowl_black +* go_game_bowl_white +* Infinite_Bag + +##Figurines + +* Figurine_Card_Bot +* Figurine_Kimi_Kat +* Figurine_Knil +* Figurine_Mara +* Figurine_Sir_Loin +* Figurine_Zeke +* Figurine_Zomblor + +##Game Pieces + +* backgammon_piece_brown +* backgammon_piece_white +* BlockRectangle +* BlockSquare +* BlockTriangle +* Card +* Checker_black +* Checker_red +* Checker_white +* Chess_Bishop +* Chess_King +* Chess_Knight +* Chess_Pawn +* Chess_Queen +* Chess_Rook +* Chinese_Checkers_Piece +* Chip_10 +* Chip_50 +* Chip_100 +* Chip_500 +* Chip_1000 +* Deck +* Die_4 +* Die_6 +* Die_6_Rounded +* Die_8 +* Die_10 +* Die_12 +* Die_20 +* Die_Piecepack +* Domino +* go_game_piece_black +* go_game_piece_white +* Mahjong_Coin +* Mahjong_Stick +* Mahjong_Tile +* Metal Ball +* PiecePack_Arms +* PiecePack_Crowns +* PiecePack_Moons +* PiecePack_Suns +* PlayerPawn +* Quarter +* reversi_chip + +##RPG Figurines + +* rpg_BARGHEST +* rpg_BASILISK +* rpg_BEAR +* rpg_BLACK_DRAGON +* rpg_CENTAUR +* rpg_CERBERUS +* rpg_CHIMERA +* rpg_CRASC +* rpg_CYCLOP +* rpg_DARKNESS_WARLORD +* rpg_DRAGONIDE +* rpg_EVIL_WATCHER +* rpg_GHOUL +* rpg_GIANT_VIPER +* rpg_GOBLIN +* rpg_GOLEM +* rpg_GRIFFON +* rpg_HYDRA +* rpg_KNIGHT +* rpg_KOBOLD +* rpg_LIZARD_WARRIOR +* rpg_MAGE +* rpg_MANTICORA +* rpg_MUMMY +* rpg_OGRE +* rpg_ORC +* rpg_RANGER +* rpg_RAT +* rpg_SKELETON_KNIGHT +* rpg_TEMPLATE +* rpg_THIEF +* rpg_TREE_ENT +* rpg_TROLL +* rpg_VAMPIRE +* rpg_WARRIOR +* rpg_WEREWOLF +* rpg_WYVERN + +##Tilesets + +* Tileset_Barrel +* Tileset_Chair +* Tileset_Chest +* Tileset_Corner +* Tileset_Floor +* Tileset_Rock +* Tileset_Table +* Tileset_Tree +* Tileset_Wall + +##Tools + +* Calculator +* Counter +* Digital_Clock +* Notecard +* Tablet + +##Triggers + +* ScriptingTrigger + * A Scripting Zone, a zone used for scripting +* FogOfWarTrigger + * A [Hidden Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#hidden-zone) +* FogOfWar + * A [Fog of War Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone) + +##Other + +* 3DText + * The text that the [Text Tool](https://kb.tabletopsimulator.com/game-tools/text-tool/) spawns. diff --git a/docs/spawnableobjects.md b/docs/custom-game-objects.md similarity index 74% rename from docs/spawnableobjects.md rename to docs/custom-game-objects.md index b4ed9de3..284dd604 100644 --- a/docs/spawnableobjects.md +++ b/docs/custom-game-objects.md @@ -1,169 +1,8 @@ -Objects can be spawned by any script using the [spawnObject()](base.md#spawnobject) function. These are the `type` Strings used to designate the type of Object to spawn. - -##Built-in Game Objects - -###Boards - - -* backgammon_board -* CardBot_Board -* Checker_Board -* Chess_Board -* Chinese_Checkers_Board -* Go_Board -* Pachisi_Board -* reversi_board - -###Containers - -* Bag -* Bowl -* Cup -* go_game_bowl_black -* go_game_bowl_white -* Infinite_Bag - -###Figurines - -* Figurine_Card_Bot -* Figurine_Kimi_Kat -* Figurine_Knil -* Figurine_Mara -* Figurine_Sir_Loin -* Figurine_Zeke -* Figurine_Zomblor - -###Game Pieces - -* backgammon_piece_brown -* backgammon_piece_white -* BlockRectangle -* BlockSquare -* BlockTriangle -* Card -* Checker_black -* Checker_red -* Checker_white -* Chess_Bishop -* Chess_King -* Chess_Knight -* Chess_Pawn -* Chess_Queen -* Chess_Rook -* Chinese_Checkers_Piece -* Chip_10 -* Chip_50 -* Chip_100 -* Chip_500 -* Chip_1000 -* Deck -* Die_4 -* Die_6 -* Die_6_Rounded -* Die_8 -* Die_10 -* Die_12 -* Die_20 -* Die_Piecepack -* Domino -* go_game_piece_black -* go_game_piece_white -* Mahjong_Coin -* Mahjong_Stick -* Mahjong_Tile -* Metal Ball -* PiecePack_Arms -* PiecePack_Crowns -* PiecePack_Moons -* PiecePack_Suns -* PlayerPawn -* Quarter -* reversi_chip - -###RPG Figurines - -* rpg_BARGHEST -* rpg_BASILISK -* rpg_BEAR -* rpg_BLACK_DRAGON -* rpg_CENTAUR -* rpg_CERBERUS -* rpg_CHIMERA -* rpg_CRASC -* rpg_CYCLOP -* rpg_DARKNESS_WARLORD -* rpg_DRAGONIDE -* rpg_EVIL_WATCHER -* rpg_GHOUL -* rpg_GIANT_VIPER -* rpg_GOBLIN -* rpg_GOLEM -* rpg_GRIFFON -* rpg_HYDRA -* rpg_KNIGHT -* rpg_KOBOLD -* rpg_LIZARD_WARRIOR -* rpg_MAGE -* rpg_MANTICORA -* rpg_MUMMY -* rpg_OGRE -* rpg_ORC -* rpg_RANGER -* rpg_RAT -* rpg_SKELETON_KNIGHT -* rpg_TEMPLATE -* rpg_THIEF -* rpg_TREE_ENT -* rpg_TROLL -* rpg_VAMPIRE -* rpg_WARRIOR -* rpg_WEREWOLF -* rpg_WYVERN - -###Tilesets - -* Tileset_Barrel -* Tileset_Chair -* Tileset_Chest -* Tileset_Corner -* Tileset_Floor -* Tileset_Rock -* Tileset_Table -* Tileset_Tree -* Tileset_Wall - -###Tools - -* Calculator -* Counter -* Digital_Clock -* Notecard -* Tablet - -###Triggers - -* ScriptingTrigger - * A Scripting Zone, a zone used for scripting -* FogOfWarTrigger - * A [Hidden Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#hidden-zone) -* FogOfWar - * A [Fog of War Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone) - -###Other - -* 3DText - * The text that the [Text Tool](https://kb.tabletopsimulator.com/game-tools/text-tool/) spawns. - ---- - - - -##Custom Game Objects -You can also spawn [custom Objects](https://kb.tabletopsimulator.com/custom-content/about-custom-objects/) and then provide the custom content for them after spawning them by calling [setCustomObject()](object.md#setcustomobject). {>>See setCustomObject for usage<<} +You can spawn [custom Objects](https://kb.tabletopsimulator.com/custom-content/about-custom-objects/) and then provide the custom content for them after spawning them by calling [setCustomObject()](object.md#setcustomobject). {>>See setCustomObject for usage<<} You can also use setCustomObject along with [reload()](object.md#reload) to modify an existing custom Object. -###Custom AssetBundle +##Custom AssetBundle * Custom_Assetbundle @@ -189,9 +28,7 @@ You can also use setCustomObject along with [reload()](object.md#reload) to modi * **2**: Metal * **3**: Cardboard - - -###Custom Board +##Custom Board * Custom_Board @@ -199,11 +36,7 @@ You can also use setCustomObject along with [reload()](object.md#reload) to modi * [](types.md) **parameters**: A Table of parameters which determine the properties of the Object. * [](types.md) **image**: The path/url for the board. - - - - -###Custom Deck +##Custom Deck * DeckCustom @@ -224,10 +57,7 @@ You can also use setCustomObject along with [reload()](object.md#reload) to modi * [](types.md) **back_is_hidden**: If cards have a special face that shows up when hidden in a hand zone. * {>>Optional, defaults to false.<<} - - - -###Custom Dice +##Custom Dice * Custom_Dice @@ -243,9 +73,7 @@ You can also use setCustomObject along with [reload()](object.md#reload) to modi * **4**: 12-sided * **5**: 20-sided - - -###Custom Figurine +##Custom Figurine * Figurine_Custom @@ -255,9 +83,7 @@ You can also use setCustomObject along with [reload()](object.md#reload) to modi * [](types.md) **image_secondary**: The path/url for the custom figurine's back. * {>>Optional, defaults to "image".<<} - - -###Custom Model +##Custom Model * Custom_Model @@ -298,9 +124,7 @@ You can also use setCustomObject along with [reload()](object.md#reload) to modi * [](types.md) **cast_shadows**: If the Object casts shadows. * {>>Optional, defaults to true.<<} - - -###Custom Tile +##Custom Tile * Custom_Tile @@ -319,8 +143,7 @@ You can also use setCustomObject along with [reload()](object.md#reload) to modi * [](types.md) **stackable**: If these tiles stack together into a pile. * {>>Optional, defaults to false.<<} - -###Custom Token +##Custom Token * Custom_Token diff --git a/docs/object.md b/docs/object.md index ca56de31..bb720490 100644 --- a/docs/object.md +++ b/docs/object.md @@ -843,7 +843,7 @@ Removing an index instantly causes all other higher indexes to shift down 1. ####getCustomObject() -[](types.md) Returns a Table with the Custom Object information of a Custom Object. See the [Spawnable Objects](spawnableobjects.md) page for the kind of information returned. +[](types.md) Returns a Table with the Custom Object information of a Custom Object. See the [Custom Game Objects](custom-game-objects.md) page for the kind of information returned. ``` Lua -- Example returned Table for a custom token @@ -1119,7 +1119,7 @@ Tablet | Returns String of the current URL. [](types.md) Sets a custom Object's properties. It can be used after [spawnObject](base.md#spawnobject) or on an already existing custom Object. If used on an already existing custom Object, you must use [reload](#reload) on the object after setCustomObject for the changes to be displayed. !!!info "setCustomObject(parameters)" - The Table of parameters varies, depending on which type of custom Object it is. See the [Spawnable Object](spawnableobjects.md) page for the parameters needed. + The Table of parameters varies, depending on which type of custom Object it is. See the [Custom Game Objects](custom-game-objects.md) page for the parameters needed. ``` Lua -- Example of a custom token diff --git a/mkdocs.yml b/mkdocs.yml index cdbf9b2b..c014844c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -84,7 +84,9 @@ nav: - Player: player.md - Player Color: player-color.md - RPGFigurine: rpgfigurine.md - - Spawnable Objects: spawnableobjects.md + - Spawnable Objects: + - Built-in: built-in-object.md + - Custom: custom-game-objects.md - TextTool: texttool.md - Time: time.md - Timer: timer.md From 852e0a0e4d1bdcc442976c0bac49f2344e1abaf8 Mon Sep 17 00:00:00 2001 From: Eldinnie Date: Mon, 4 May 2020 00:54:54 +0200 Subject: [PATCH 39/48] Update object.md (tts-community/api#40) Fixes tts-community/api#39 --- docs/object.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/object.md b/docs/object.md index bb720490..29255b49 100644 --- a/docs/object.md +++ b/docs/object.md @@ -183,8 +183,8 @@ Function Name | Description | Return |   addAttachment([](types.md) Object) | The Object supplied as param is destroyed and becomes a dummy Object child. | [](types.md) removeAttachment([](types.md) index) | Removes a child with the given index. Use [getAttachments()](#getattachments) to find out the index property. | [](types.md) removeAttachments() | Detaches the children of this Object. Returns a table of object references | [](types.md) -destroyAttachment([](types.md) index) | Destroys an attachment with the given index. | [](types.md) -destroyAttachments() | Destroys all attachments. | [](types.md) +destroyAttachment([](types.md) index) | Destroys an attachment with the given index. | [](types.md) +destroyAttachments() | Destroys all attachments. | [](types.md) addToPlayerSelection([](types.md) player_color) | Adds object to player's selection. | [](types.md) removeFromPlayerSelection([](types.md) player_color) | Removes object from player's selection. | [](types.md) flip() | Flips Object over. | [](types.md) | From d19e29c538fdfcde5bc6d1785b09a731cbfb396e Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Wed, 6 May 2020 21:27:29 +1000 Subject: [PATCH 40/48] spawnObjectJSON() does not use sound or snap_to_grid --- docs/base.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/base.md b/docs/base.md index dca60f9e..4e37871b 100644 --- a/docs/base.md +++ b/docs/base.md @@ -197,10 +197,6 @@ Spawns an Object using a JSON string. Works with [getJSON()](object.md#getjson). * {>>Optional, defaults to JSON's value.<<} * [](types.md#vector) **parameters.scale**: Scale of the Object. * {>>Optional, defaults to JSON's value.<<} - * [](types.md) **parameters.sound**: If the spawned Object noise is played. - * {>>Optional, defaults to JSON's value.<<} - * [](types.md) **parameters.snap_to_grid**: If snap-to-grid is active on the Object. - * {>>Optional, defaults to JSON's value.<<} * [](types.md#function) **parameters.callback_function**: The function to activate after the Object has finished spawning into the scene. * {>>Optional, defaults to not being used.<<} * {>>A reference to the object spawned is always passed to callback_function. See the example for how to access it.<<} From 95ef727cee83cca126c7760a95d816a5ba517338 Mon Sep 17 00:00:00 2001 From: Zehir Date: Wed, 6 May 2020 19:01:44 +0200 Subject: [PATCH 41/48] Fix getPointerRotation return --- docs/player.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/player.md b/docs/player.md index 777a1456..bf7e2105 100644 --- a/docs/player.md +++ b/docs/player.md @@ -37,7 +37,7 @@ getHandTransform([](types.md) hand_index) | Re getHoldingObjects() | Objects a Player is holding in their hand. | [](types.md) getHoverObject() | Object that the Player's pointer is hovering over. | [](types.md) getPointerPosition() | Player's pointer coordinates. | [](types.md#vector) -getPointerRotation() | Player's pointer rotation. | [](types.md#vector) +getPointerRotation() | Player's pointer rotation on Y axis. | [](types.md) getSelectedObjects() | Objects that the Player has selected with an area selection. | [](types.md) clearSelectedObjects() | Clears a player's current selection. | [](types.md) kick() | Kicks Player out of the room. | [](types.md) From e54c9f77729ff1280e8b56a527ea516dd23faf31 Mon Sep 17 00:00:00 2001 From: Zehir Date: Wed, 6 May 2020 19:11:51 +0200 Subject: [PATCH 42/48] Replacing change-log page to patch-note page (tts-community/api#35) --- docs/changelog.md | 219 ---------------------------------------------- mkdocs.yml | 2 +- 2 files changed, 1 insertion(+), 220 deletions(-) delete mode 100644 docs/changelog.md diff --git a/docs/changelog.md b/docs/changelog.md deleted file mode 100644 index 26a12d5e..00000000 --- a/docs/changelog.md +++ /dev/null @@ -1,219 +0,0 @@ -This is an ongoing list of scripting changes that have been implemented to scripting and Custom UI side of Tabletop Simulator. - - -######4/3/19 - v11.2 -!!!info "" - * Lua: - * Added access to Components and Children of Unity objects. All details on this process are outlined on the new Component page. - - -######2/05/19 - v11.1 - -!!!info "" - * Lua: - * Added group(table). This allows you to group a table of objects, in the same way the "G" key would for a player! It returns a list of the grouped objects. - * Added addDecal(table), getDecals(), and setDecals(table). Now scripting can add decals into the game world. - * Added object.getJoints(). - * When a table of parameters for a joint is returned, it now includes joint_object_guid. This is the GUID for the object which is attached by the joint. - * Added desired_position to the list of parameters returned by .getCustomObject() when it is used on a Jigsaw Puzzle piece. This parameter is the "solved" position for the piece. - * New Time class added, used to easily fetch information like os.time(), but also other informations like time passed since last frame, total frames passed, etc. - pingTable(vector) added to the Player class. Now a script can emulate a player pinging. - * Added setComponentVar(componentName, varName, value) and getComponentVar(componentName, varName) as an object function. This allows you to access components that you have made part of your AssetBundle via scripting. For example, changing lights or colliders on the fly. These functions will also work on the components of default objects like "Collider" and "Light". - - - - -######11/06/18 - v11.0 - -!!!info "" - * Lua: - * Fog of War API elements added - * `object.getFogOfWarReveal()` and `object.setFogOfWarReveal(table)` to access an Object's ability to reveal Fog of War. - * `object.ignore_fog_of_war` member variable added (prevents object from being hidden) - * Play Area - * Change player area with `Physics.play_area` - * API Improvements - * Knowledge Base link added to left nav bar. - * Minor visual improvements - * Footer returns - - -######08/17/18 - v10.9 - -!!!info "" - * Lua: - * Updates to the new Wait class - * Added repetitions to Wait.time to better emulate Timer. Wait.time(func, time, number_repetitions). - * Using -1 will cause infinite repetitions - * Improvements to stop() so it should work more as expected. - * Returns from getObject and getStates improved to a common standard, includes: - * Name and Nickname - * Description - * Lua Script and Lua Script State - * New Object functions: - * `obj.drop()` causes the item, if held by a player, to be dropped. - * `setHiddenFrom(players)` Hides objects from a specific player/players. Uses "hand zone" hiding. - * `setInvisibleTo(players)` Hides objects from a specific player/players. Uses "hidden zone" hiding. - * `attachHider(...)` and `attachInvisibleHider(...)` are more advanced version of setHiddenFrom and setInvisibleTo, there to help handle complex situations easily. - * Old Object Functions (with new features!) - * `setRotationValues()` now allows you to start a name/value with a # and it won't display the value in the tooltip. - * `randomize(color)` Now an optional string can be added so that onObjectRandomized will trigger, indicating that player color triggered it. - * New base function: - * `get/setVectorLines()` Allows for lines to be placed via scripting using the new vector line tools` - * New Spawnable object: Custom Decks! - * Technically this was added before, but now it works and is documented! - * Spawn using spawnObject then set it using setCustomObject - * Clarifications to the Object class - * Some functions, let setSnapPoints or call, work on both Object and Global. - * To highlight which Object functions can be directed at the game world, they have been broken out on the Object page into a "Global Functions" section. - * New Object member Variables - * `use_rotation_value_flip` can be used to modify which direction objects flip. - * `is_face_down` determines if an object's "face" is pointed down (like with cards). The face is the direction that faces the positive Y value. - * `hide_when_face_down` hides an Object when it is face-down. Objects are hidden like if in a hidden zone. The face is the direction that faces the positive Y value. - * New Event - * `onObjectEnterContainer` has long been a requested event, and it is now available! - - - - - - -######7/9/18 - v10.8 - -!!!info "" - * Lua: - * putObject() now returns an Object. - * Using it to combine two cards will return an object reference to the newly formed deck - * Using it to put an object into a container/stack/deck will return the container/stack/deck it was made part of - * New class: **Notes** - * Contains notebook and set/getNotes functions - * Devalued the old "Base" versions of these functions - * {>>This means they are not in the documentation but will, for legacy reasons, still function.<<} - * New class: **Wait** - * This new class allows you to easily trigger functions after some form of delay - * Contains frames, time, condition, and stop functions - * Devalued Timer class entirely - * {>>This means Timer is removed from documentation but, for legacy reasons, still functions.<<} - * New Object functions: - * **obj.cut(int)** - Cuts a deck at the given card index - * **obj.split(int)** - Splits a deck in a number of stacks - * **obj.getRotationValue** - Returns the current rotationValue of an object (see: gizmo tool) - * This function existed previously, but was not documented. - * New Event functions: - * **onObjectPeeked(player, object)** - Triggers when peek is used by a player - * **onPeek(player)** - Triggers when a specific object is peeked - * **onRandomize(player)** - Triggers when randomize (R) is used on an object. - * Player Color strings convert automatically - * Example: printToAll("Hello", "Green") - * Snap points created on objects use Vectors local to the Object, rather than global - * This applies to both position and rotation - * Fix for optional parameters of spawnObjectJSON() - * New Object Member Variables - * loading_custom - Indicates if the assets of a custom element are being loaded. - * spawning - Indicates if any object is currently in the process of spawning. - * These are helpful to determine if elements are loaded into the game fully - * Especially useful with the new Wait class! - * Callback Changes - * Callback methods are being devalued (still work, but not documented) - * Being replaced with callback_function which directly triggers a function at the same time a callback would have been triggered. - * Done with takeObject, spawnObject(s) and webRequest(s). - * Custom UI: - * New Lua function: - * **UI.setValue(string id, string value)** - Updates the value that appears within element tags {>>(ex: THIS)<<} - * **UI.getValue(string id)** - Obtains the value that appears within element tags {>>(ex: THIS)<<} - * Both support Rich Text! - * New InputField attribute - * **placeholder** - Greyed out text that appears in the input if there is no text present. - * New Lua Function: - * **get/setCustomAssets()** - Allows you to obtain custom UI assets uploaded to the UI Assets window. Works on global or on object's assets. - - -######6/18/18 - v10.7 - -!!!info "" - * Custom UI: - * Visibility attribute now supports admin, host, and team names. - * Clicking button won't block your hotkeys anymore. - * Added getXmlTable() setXmlTable(). - * Fixed onValueChanged recursive event loop. - * Fixed setAttribute() not working if it thought there wasn't a change. - * Fixed not being able to setXml() with an empty string. - * Fix support for RichText in Get/SetXmlTable(). - * Fixed zombie Xml UI when opening File Browser. - * Lua: - * Added Player.getAvailableColors() and Player.getColors(). - * Added SetSnapPoints() and GetSnapPoints(). - * Added JointTo(). - * Lots of scripting improvements to make it easier to convert between Lua Tables and C# types. - * Fixed Hotseat crash when using scripting input fields. - * Fixed camera triggering scripting zone. - * Fixed Turns.getNextColor() returning name instead of color. - - - -######5/30/18 - v10.6.1 - -!!!info "" - * Custom UI: - * Added getXmlTable() and setXmlTable() for dealing with Xml easier with Lua tables. - * Changed setXml() from changing the actual Xml for the save file so everything is runtime changes only. - * Changed getXml() to return the current Xml string including any runtime changes from setAttribute(). - * Fixed event recursion causing a potential lock up. - * Fixed setXml() not working with empty string. - * Lua: - * Added a 'debug_external_api' console command to show logging for external api messages. - * Fixed logging an empty table throwing null. - -######5/25/18 - v10.6 - -!!!info "" - * Custom UI: - * 3D UI added for objects (simialar to createButton/Input) - * Each object can have its own assets (images) - * Point scripting towards an object UI with `object.UI.setAttribute(...)` - * Events called from an object's UI will automatically go to that object's Script. To override that feature and send it to Global, use `Global/functionName` for the attribute's name. - * `UI.getXml()` and `UI.setXml()` added: - * Allows for dynamic UI creation from a string - * This OVERWRITES THE CURRENT XML on the target Global/object!!! - * Click sounds added for inputs - * Text universal attributes outlined in attributes section - * setLookingForPlayers() added. - * FIXED: Player colors now match TTS colors. For example, "red" is now equivalent to the player color red exactly. - * FIXED: Dragging is improved so the element doesn't snap to its rectAlignment when dragged. - * FIXED: When changing active attribute from script visibility would sometimes not work correctly - - - -######5/9/18 - v10.5.1 - -!!!info "" - * Custom UI: - * Added UI.show(id) and UI.hide(id) for disabling and enabling ui with animations. - * Now support the Image tag for custom images. - * Supports overriding the look of the UI using this custom image support. - * Fixed visibility attribute not working correctly on elements with no id attribute or layout tag. - * Fixed offsetXY set/getAttribute() not working. - * Added Tooltip attribute for all objects - -######5/7/18 - v10.5 - -!!!info "" - * Addition of XML Custom UI and associated documentation as part of this documentation. - * onSearchStart/onSearchEnd/onObjectSearchStart/onObjectSearchEnd added to Events. - * The log() command's "label" and "tag" parameters were reversed to `log(object, label, tags)` - * Scripted object button changes - * The click_function of scripted object buttons now passes an argument for alt_click. This allows determining if anything besides left click was used on the button (like right click) - * hover_color and press_color added as optional parameters - * getJSON() and spawnObjectJSON() created. - * Turns global static class added - * Member variables for controlling how turns work - * New event trigger for player turns beginning (onPlayerTurn) - * Devalued previous onPlayerTurn events - * Changelog moved under Getting Started due to the fact that it applies to the UI API as well as the scripting API. But I guess you figured that out already, didn't ya. - * Added getJSON and spawnObjectJSON to Object/Base, respectively. - - -######3/26/18 - v10.4 Hotfix 2 - -!!!info "" - * New Tabletop Simulator Scripting Documentation is created. diff --git a/mkdocs.yml b/mkdocs.yml index c014844c..bfc5ade2 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -61,7 +61,7 @@ nav: - Learning Lua: learninglua.md - System Console: systemconsole.md - Virtual Reality: vr.md - - Changelog: changelog.md + - Patch Notes: https://www.tabletopsimulator.com/news/patch-notes - Scripting API: - Introduction: intro.md - Types: types.md From c291b216f924a0b5269765469095e3feb10ab09c Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Wed, 13 May 2020 18:49:29 +1000 Subject: [PATCH 43/48] motor_free_spin not motor_freeSpin --- docs/object.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/object.md b/docs/object.md index 29255b49..14fd6531 100644 --- a/docs/object.md +++ b/docs/object.md @@ -1356,7 +1356,7 @@ self.jointTo(obj, { ["break_torgue"] = 1000.0, ["motor_force"] = 100.0, ["motor_velocity"] = 10.0, - ["motor_freeSpin"] = true + ["motor_free_spin"] = true }) ``` From b7bf06eac2790b8a6dd6e96367df7416452959d6 Mon Sep 17 00:00:00 2001 From: omniraptorr <63944670+omniraptorr@users.noreply.github.com> Date: Fri, 15 May 2020 23:05:13 -0700 Subject: [PATCH 44/48] added details for filterObjectEnterContainer --- docs/event.md | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/event.md b/docs/event.md index 911bf2e5..9ebde8a3 100644 --- a/docs/event.md +++ b/docs/event.md @@ -69,21 +69,28 @@ onSearchEnd([](types.md) player_color) | Calle onSearchStart([](types.md) player_color) | Called when a player starts searching this Object. | [](#onsearchstart) +--- +##Function Details (Global & Object) +###filterObjectEnterContainer(...) +Called when an object attempts to enter a container. The object is prevented from entering unless "true" is returned. +!!!info "filterObjectEnter(container, enter_object)" + * [](types.md) **container**: The container the Object is trying to enter. + * [](types.md) **enter_object**: The Object entering the container. - - - - +``` Lua +function filterObjectEnterContainer(container, enter_object) + print(enter_object.getName()) -- Print entering object's name + return true -- Allows object to enter. +end +``` --- -##Function Details (Global & Object) - ###onChat(...) This function is called when a message is sent through the in-game chat. It does not trigger when global chat messages are sent. Using `#!lua return false` inside of this function prevents the chat message which triggered it to be suppressed. From 9008b1c89872c9061523080810e6af7e45a67f05 Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Thu, 4 Jun 2020 01:36:08 +1000 Subject: [PATCH 45/48] Object#drag_selectable is now persisted --- docs/object.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/object.md b/docs/object.md index 14fd6531..b3ae34b5 100644 --- a/docs/object.md +++ b/docs/object.md @@ -46,7 +46,7 @@ Variable | Description | Type value | The value of the object for summing up selected objects. Only works if the apropriate bits are set in `obj.value_flags` | [](types.md) !!! bug - The `drag_selectable`, `value_flags` and `value` member variables do not persist when the object is reloaded (such as loading a save and entering/exiting containers). + The `value_flags` and `value` member variables do not persist when the object is reloaded (such as loading a save and entering/exiting containers). These member variables are classes of their own, and have their own member variables. Each one is for a special type of Object. From 07d3ab26383e7eff56525fcd57699f42cddf8af5 Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Sun, 7 Jun 2020 09:49:10 -0400 Subject: [PATCH 46/48] added a spawnable names category + some fixes --- docs/built-in-object.md | 275 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 253 insertions(+), 22 deletions(-) diff --git a/docs/built-in-object.md b/docs/built-in-object.md index b6dff4dd..494cec9a 100644 --- a/docs/built-in-object.md +++ b/docs/built-in-object.md @@ -5,44 +5,46 @@ For Custom Objects, see [Custom Game Objects](custom-game-objects.md). Each item listed here is treated as a unique object type. (ie. A red checker tinted black will not stack on top of a regular black checker.) -## Boards +## Object Types + +### Game Boards All boards spawn locked by default. Type | Description | Notes -- | -- | -- Backgammon_Board | The fold-open board of Backgammon. | Includes snap-points along each triangle. -CardBot_Board | The main board and 4 player boards of CardBots, Build & Destroy. | Includes snap-points on each card and deck location. Not spawnable in the Objects->Components menu. +CardBot_Board | The main board and 4 player boards of CardBots, Build & Destroy. | Includes snap-points on each card and deck location. Checker_Board | The 8x8 board of Checkers. | Includes snap-points on each grid square. Chess_Board | The 8x8 board of Chess. | Includes snap-points on each grid square. Chinese_Checkers_Board | The 6-pointed board of Sternhalma, or Chinese Checkers. | Includes snap-points on each indent. -Go_Board | The 9-starred board of Go. | Includes snap-points on each line intersection. Not spawnable in the Objects->Components menu. -Pachisi_Board | A 6-player Pachisi board. | Includes snap-points on each indent. Not spawnable in the Objects->Components menu. -Reversi_Board | The 8x8 board of Reversi. | Includes snap-points on each grid square. Not spawnable in the Objects->Components menu. +Go_Board | The 9-starred board of Go. | Includes snap-points on each line intersection. +Pachisi_Board | A 6-player Pachisi board. | Includes snap-points on each indent. +Reversi_Board | The 8x8 board of Reversi. | Includes snap-points on each grid square. -## Containers +### Containers Type | Description | Notes -- | -- | -- Bag | A pouch that objects can be stored in and taken from. | -Bowl | A wooden bowl that obects can be dropped in. | The bowl does not have an inventory, objects merely rest within it visually. +Bowl | A wooden bowl that objects can be dropped in. | The bowl does not have an inventory, objects merely rest within it visually. Go_Game_Bowl_Black | A bowl that any number of [Black Go Stones](#Go_Game_Piece_Black) can be taken from and dropped back into. | Go_Game_Bowl_White | A bowl that any number of [White Go Stones](#Go_Game_Piece_White) can be taken from and dropped back into. | Infinite_Bag | A pouch that infinite copies of a single object can be taken from and dropped back into. | An object must be put into the bag to become the source object. -## Figurines +### Figures Type | Description | Notes -- | -- | -- -Figurine_Card_Bot | A rectagule-based figurine of a CardBot from CardBots, Build & Destroy. | Called "CardBot" in the in-game menu. Faces visually to the side. -Figurine_Kimi_Kat | A rectagule-based figurine of two sitting cats. | -Figurine_Knil | A baseless figurine of a sword-wielding knight in full-plate armor. | Called "Knight of Knil" in the in-game menu. +Figurine_Card_Bot | A rectangle-based figurine of a CardBot from CardBots, Build & Destroy. | Faces visually to the side. +Figurine_Kimi_Kat | A rectangle-based figurine of two sitting cats. | +Figurine_Knil | A baseless figurine of a sword-wielding knight in full-plate armor. | Figurine_Mara | A baseless figurine of a bearded man in slacks. | -Figurine_Sir_Loin | A rectagule-based figurine of a sword-wielding warrior with a shield on his back. | Faces visually backwards. -Figurine_Zeke | A baseless figurine of a cloaked character wielding a sword. | Called "Zeke Kodoku" in the in-game menu. +Figurine_Sir_Loin | A rectangle-based figurine of a sword-wielding warrior with a shield on his back. | Faces visually backwards. +Figurine_Zeke | A baseless figurine of a cloaked character wielding a sword. | Figurine_Zomblor | A baseless figurine of a zombified riot-officer with knives for hands, wearing a skirt. | -## Game Pieces +### Game Pieces Type | Description | Notes -- | -- | -- @@ -62,6 +64,7 @@ Type | Description | Notes Chess_Queen | A chrome Chess queen. | Chess_Rook | A chrome Chess rook. | Chinese_Checkers_Piece | A marble for use in Sternhalma, or Chinese Checkers. | +Metal Ball | A marble, identical to `Chinese_Checkers_Piece` aside from shading. | This object type has a space in it, not an underscore. Chip_10 | A blue poker chip worth $10 | Faces visually to the left. Chip_50 | A green poker chip worth $50 | Faces visually to the left. Chip_100 | A red poker chip worth $100 | Faces visually to the left. @@ -91,7 +94,7 @@ Metal Ball | A marble. | This type includes a space character and not an underli Quarter | An american quarter minted in 1942. | Spawns tails-up, facing to the right. Reversi_Chip | A dual-colored Reversi chip. | Spawns white-side up. -## RPG Figurines +### RPG Figurines Type | Description | Notes -- | -- | -- @@ -119,7 +122,7 @@ Type | Description | Notes rpg_MAGE | An animated figurine of a staff-wielding mage. | rpg_MANTICORA | An animated figurine of a mythical manticore. | This type is spelled with an A. rpg_MUMMY | An animated figurine of a living mummy. | -rpg_OGRE | An animated figurine of a large boily humanoid. | +rpg_OGRE | An animated figurine of a large boiled humanoid. | rpg_ORC | An animated figurine of an axe-wielding orc. | rpg_RANGER | An animated figurine of a bow-wielding ranger. | rpg_RAT | An animated figurine of a giant rat. | @@ -129,11 +132,11 @@ Type | Description | Notes rpg_TREE_ENT | An animated figurine of a large tree creature. | rpg_TROLL | An animated figurine of a large green humanoid. | rpg_VAMPIRE | An animated figurine of a large wingless bat. | -rpg_WARRIOR | An animated figurine of a stout beared axe-wielding warrior in scale mail. | +rpg_WARRIOR | An animated figurine of a stout, bearded, axe-wielding warrior in scale mail. | rpg_WEREWOLF | An animated figurine of a mythical werewolf. | rpg_WYVERN | An animated figurine of a mythical wyvern. | -## Tilesets +### Tilesets Type | Description | Notes -- | -- | -- @@ -147,17 +150,17 @@ Type | Description | Notes Tileset_Tree | A small tree for use in RPG Tilesets. | Tileset_Wall | A floor tile with a wall for use in RPG Tilesets. | -## Tools +### Devices Type | Description | Notes -- | -- | -- -Calculator | A useable calulator. | Faces visually backwards. +Calculator | A useable calculator. | Faces visually backwards. Counter | A useable digital counter. | Digital_Clock | A useable digital clock. | Notecard | An editable notecard. | Tablet | A tablet that displays a webpage. | -## Triggers +### Triggers Type | Description | Notes -- | -- | -- @@ -165,8 +168,236 @@ Type | Description | Notes FogOfWarTrigger | A [Hidden Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#hidden-zone) | FogOfWar | A [Fog of War Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone) | -## Other +### Other Type | Description | Notes -- | -- | -- 3DText | The text that the [Text Tool](https://kb.tabletopsimulator.com/game-tools/text-tool/) spawns. | + +## Spawnable Names + +### Blocks + +Name | Type | Differences +-- | -- | -- +Red Square | [`BlockSquare`](#BlockSquare) | +Blue Rectangle | [`BlockRectangle`](#BlockRectangle) | +Green Triangle | [`BlockTriangle`](#BlockTriangle) | + +### Boards + +Name | Type | Differences +-- | -- | -- +Backgammon Board | [`backgammon_board`](#backgammon_board) | Spawns at table level regardless of input Y position. +Checkers Board | [`Checker_Board`](#Checker_Board) | Spawns at table level regardless of input Y position. +Chess Board | [`Chess_Board`](#Chess_Board) | Spawns at table level regardless of input Y position. +Chinese Checkers Board | [`Chinese_Checkers_Board`](#Chinese_Checkers_Board) | Spawns at table level regardless of input Y position. +Custom Board | [`Custom_Board`](#Custom_Board) | Spawns at table level regardless of input Y position. + +### Cards + +Name | Type | Differences +-- | -- | -- +Standard Deck | [`Deck`](#Deck) | +Custom Deck | [`DeckCustom`](#DeckCustom) | +Random Card | [`Card`](#Card) | Random `CardID` value between `0` and `51` (inclusive). +Joker | [`Card`](#Card) | `CardID` value of `52`. +CardBots Main Deck | [`Deck_CardBot_Main`](#Deck_CardBot_Main) | +CardBots Head Deck | [`Deck_CardBot_Head`](#Deck_CardBot_Head) | + +### Checkers + +Type | Description +-- | -- +Red Checker | [`Checker_red`](#Checker_red) | +Black Checker | [`Checker_black`](#Checker_black) | +White Checker | [`Checker_white`](#Checker_white) | + +### Chess + +Name | Type | Differences +-- | -- | -- +Pawn Chrome | [`Chess_Pawn`](#Chess_Pawn) | `MaterialIndex` value of `0`. +Rook Chrome | [`Chess_Rook`](#Chess_Rook) | `MaterialIndex` value of `0`. +Knight Chrome | [`Chess_Knight`](#Chess_Knight) | `MaterialIndex` value of `0`. +Bishop Chrome | [`Chess_Bishop`](#Chess_Bishop) | `MaterialIndex` value of `0`. +Queen Chrome | [`Chess_Queen`](#Chess_Queen) | `MaterialIndex` value of `0`. +King Chrome | [`Chess_King`](#Chess_King) | `MaterialIndex` value of `0`. +Pawn Cast Iron | [`Chess_Pawn`](#Chess_Pawn) | `MaterialIndex` value of `1`. +Rook Cast Iron | [`Chess_Rook`](#Chess_Rook) | `MaterialIndex` value of `1`. +Knight Cast Iron | [`Chess_Knight`](#Chess_Knight) | `MaterialIndex` value of `1`. +Bishop Cast Iron | [`Chess_Bishop`](#Chess_Bishop) | `MaterialIndex` value of `1`. +Queen Cast Iron | [`Chess_Queen`](#Chess_Queen) | `MaterialIndex` value of `1`. +King Cast Iron | [`Chess_King`](#Chess_King) | `MaterialIndex` value of `1`. +Pawn Light Wood | [`Chess_Pawn`](#Chess_Pawn) | `MaterialIndex` value of `2`. +Rook Light Wood | [`Chess_Rook`](#Chess_Rook) | `MaterialIndex` value of `2`. +Knight Light Wood | [`Chess_Knight`](#Chess_Knight) | `MaterialIndex` value of `2`. +Bishop Light Wood | [`Chess_Bishop`](#Chess_Bishop) | `MaterialIndex` value of `2`. +Queen Light Wood | [`Chess_Queen`](#Chess_Queen) | `MaterialIndex` value of `2`. +King Light Wood | [`Chess_King`](#Chess_King) | `MaterialIndex` value of `2`. +Bishop Dark Wood | [`Chess_Bishop`](#Chess_Bishop) | `MaterialIndex` value of `3`. +King Dark Wood | [`Chess_King`](#Chess_King) | `MaterialIndex` value of `3`. +Knight Dark Wood | [`Chess_Knight`](#Chess_Knight) | `MaterialIndex` value of `3`. +Pawn Dark Wood | [`Chess_Pawn`](#Chess_Pawn) | `MaterialIndex` value of `3`. +Queen Dark Wood | [`Chess_Queen`](#Chess_Queen) | `MaterialIndex` value of `3`. +Rook Dark Wood | [`Chess_Rook`](#Chess_Rook) | `MaterialIndex` value of `3`. + +### Custom + +Name | Type | Differences +-- | -- | -- +Custom Model | [`Custom_Model`](#Custom_Model) | + +### Dice + +Name | Type | Differences +-- | -- | -- +D4 | [`Die_4`](#Die_4) | `MaterialIndex` value of `0`. +D6 | [`Die_6`](#Die_6) | `MaterialIndex` value of `0`. +D8 | [`Die_8`](#Die_8) | `MaterialIndex` value of `0`. +D10 | [`Die_10`](#Die_10) | `MaterialIndex` value of `0`. +D12 | [`Die_12`](#Die_12) | `MaterialIndex` value of `0`. +D20 | [`Die_20`](#Die_20) | `MaterialIndex` value of `0`. +D6 Black | [`Die_6_Rounded`](#Die_6_Rounded) | `MaterialIndex` value of `0`. +D6 Red | [`Die_6_Rounded`](#Die_6_Rounded) | `MaterialIndex` value of `1`. +D6 Green | [`Die_6_Rounded`](#Die_6_Rounded) | `MaterialIndex` value of `2`. +D6 Blue | [`Die_6_Rounded`](#Die_6_Rounded) | `MaterialIndex` value of `3`. +D4 Chrome | [`Die_4`](#Die_4) | `MaterialIndex` value of `1`, `AltSound` value of `true`. +D6 Chrome | [`Die_6`](#Die_6) | `MaterialIndex` value of `1`, `AltSound` value of `true`. +D8 Chrome | [`Die_8`](#Die_8) | `MaterialIndex` value of `1`, `AltSound` value of `true`. +D10 Chrome | [`Die_10`](#Die_10) | `MaterialIndex` value of `1`, `AltSound` value of `true`. +D12 Chrome | [`Die_12`](#Die_12) | `MaterialIndex` value of `1`, `AltSound` value of `true`. +D20 Chrome | [`Die_20`](#Die_20) | `MaterialIndex` value of `1`, `AltSound` value of `true`. + +### Figurines + +Name | Type | Differences +-- | -- | -- +Custom Figurine | [`Figurine_Custom`](#Figurine_Custom) | +Knight of Knil | [`Figurine_Knil`](#Figurine_Knil) | +Kimi Kat | [`Figurine_Kimi_Kat`](#Figurine_Kimi_Kat) | +Sir Loin | [`Figurine_Sir_Loin`](#Figurine_Sir_Loin) | +Mara | [`Figurine_Mara`](#Figurine_Mara) | +Zomblor | [`Figurine_Zomblor`](#Figurine_Zomblor) | +Zeke Kodoku | [`Figurine_Zeke`](#Figurine_Zeke) | +CardBot | [`Figurine_Card_Bot`](#Figurine_Card_Bot) | + +### Go + +Name | Type | Differences +-- | -- | -- +GO Piece White | [`go_game_piece_white`](#go_game_piece_white) | +GO Piece Black | [`go_game_piece_black`](#go_game_piece_black) | +GO Bowl White | [`go_game_bowl_white`](#go_game_bowl_white) | +GO Bowl Black | [`go_game_bowl_black`](#go_game_bowl_black) | + +### Marbles + +Name | Type | Differences +-- | -- | -- +White Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `0`. +Red Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `1`. +Yellow Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `2`. +Green Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `3`. +Blue Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `4`. +Pink Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `5`. +Black Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `6`. + +### Miscellaneous + +Name | Type | Differences +-- | -- | -- +Quarter | [`Quarter`](#Quarter) | +Reversi Chip | [`reversi_chip`](#reversi_chip) | +Random Domino | [`Domino`](#Domino) | Random `MeshIndex` value between `0` and `27` (inclusive). +Random Mahjong | [`Mahjong_Tile`](#Mahjong_Tile) | Random `MeshIndex` value between `0` and `35` (inclusive). +Brown Backgammon | [`backgammon_piece_brown`](#backgammon_piece_brown) | +White Backgammon | [`backgammon_piece_white`](#backgammon_piece_white) | + +### Piecepack + +Name | Type | Differences +-- | -- | -- +Arms Dice | [`Die_Piecepack`](#Die_Piecepack) | `MaterialIndex` value of `0`. +Crowns Dice | [`Die_Piecepack`](#Die_Piecepack) | `MaterialIndex` value of `1`. +Moons Dice | [`Die_Piecepack`](#Die_Piecepack) | `MaterialIndex` value of `2`. +Suns Dice | [`Die_Piecepack`](#Die_Piecepack) | `MaterialIndex` value of `3`. + +### Player Pawns + +Name | Type | Differences +-- | -- | -- +White Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `0`. +Red Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `1`. +Orange Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `2`. +Yellow Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `3`. +Green Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `4`. +Blue Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `5`. +Purple Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `6`. +Pink Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `7`. +Black Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `8`. + +### Poker Chips + +Name | Type | Differences +-- | -- | -- +Blue 10 | [`Chip_10`](#Chip_10) | +Green 50 | [`Chip_50`](#Chip_50) | +Red 100 | [`Chip_100`](#Chip_100) | +Silver 500 | [`Chip_500`](#Chip_500) | +Gold 1000 | [`Chip_1000`](#Chip_1000) | + +### RPG Kit + +Name | Type | Differences +-- | -- | -- +Bear | [`rpg_BEAR`](#rpg_BEAR) | +Giant Rat | [`rpg_RAT`](#rpg_RAT) | +Giant Viper | [`rpg_GIANT_VIPER`](#rpg_GIANT_VIPER) | +Wolf | [`rpg_WOLF`](#rpg_WOLF) | +Evil Watcher | [`rpg_EVIL_WATCHER`](#rpg_EVIL_WATCHER) | +Golem | [`rpg_GOLEM`](#rpg_GOLEM) | +Tree Ent | [`rpg_TREE_ENT`](#rpg_TREE_ENT) | +Dragonide | [`rpg_DRAGONIDE`](#rpg_DRAGONIDE) | +Hydra | [`rpg_HYDRA`](#rpg_HYDRA) | +Lizard Warrior | [`rpg_LIZARD_WARRIOR`](#rpg_LIZARD_WARRIOR) | +Wyvern | [`rpg_WYVERN`](#rpg_WYVERN) | +Ghoul | [`rpg_GHOUL`](#rpg_GHOUL) | +Mummy | [`rpg_MUMMY`](#rpg_MUMMY) | +Skeleton Knight | [`rpg_SKELETON_KNIGHT`](#rpg_SKELETON_KNIGHT) | +Vampire | [`rpg_VAMPIRE`](#rpg_VAMPIRE) | +Cyclops | [`rpg_CYCLOP`](#rpg_CYCLOP) | +Goblin | [`rpg_GOBLIN`](#rpg_GOBLIN) | +Kobold | [`rpg_KOBOLD`](#rpg_KOBOLD) | +Ogre | [`rpg_OGRE`](#rpg_OGRE) | +Orc | [`rpg_ORC`](#rpg_ORC) | +Troll | [`rpg_TROLL`](#rpg_TROLL) | +Chimera | [`rpg_CHIMERA`](#rpg_CHIMERA) | +Griffon | [`rpg_GRIFFON`](#rpg_GRIFFON) | +Manticora | [`rpg_MANTICORA`](#rpg_MANTICORA) | +Werewolf | [`rpg_WEREWOLF`](#rpg_WEREWOLF) | +Floor | [`Tileset_Floor`](#Tileset_Floor) | +Wall | [`Tileset_Wall`](#Tileset_Wall) | +Corner | [`Tileset_Corner`](#Tileset_Corner) | +Chest | [`Tileset_Chest`](#Tileset_Chest) | +Barrel | [`Tileset_Barrel`](#Tileset_Barrel) | +Table | [`Tileset_Table`](#Tileset_Table) | +Chair | [`Tileset_Chair`](#Tileset_Chair) | +Tree | [`Tileset_Tree`](#Tileset_Tree) | +Rock | [`Tileset_Rock`](#Tileset_Rock) | + +### Tools + +Name | Type | Differences +-- | -- | -- +Tablet | [`Tablet`](#Tablet) | +Digital Clock | [`Digital_Clock`](#Digital_Clock) | +Loot Bag | [`Bag`](#Bag) | + +### Unlisted + +Name | Type | Differences +-- | -- | -- +Go Board | [`Go_Board`](#Go_Board) | Spawns at table level regardless of input Y position. +Pachisi Board | [`Pachisi_board`](#Pachisi_board) | Spawns at table level regardless of input Y position. +Reversi Board | [`reversi_board`](#reversi_board) | Spawns at table level regardless of input Y position. From ad122702294080c45cfcf275a8498c4f5f4833a3 Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Sun, 31 Jan 2021 04:14:45 -0500 Subject: [PATCH 47/48] reorganized and added explanations changed the offset for anchor links to work better on many screen widths --- docs/built-in-object.md | 686 +++++++++++++++++++--------------------- docs/css/theme.css | 6 +- 2 files changed, 323 insertions(+), 369 deletions(-) diff --git a/docs/built-in-object.md b/docs/built-in-object.md index 494cec9a..47588799 100644 --- a/docs/built-in-object.md +++ b/docs/built-in-object.md @@ -1,403 +1,353 @@ -This page has information on each type of non-custom object, including the `type` strings used to designate the type of Object to spawn using the [spawnObject()](base.md#spawnobject) function. +This page has information on each type of non-custom object, including the internal names used in the object's save data, which can be used in the `json.Name`, `data.Name`, and `type` fields of [`spawnObjectJSON()`](base.md#spawnobjectjson), [`spawnObjectData()`](base.md#spawnobjectdata), and [`spawnObject()`](base.md#spawnobject) respectively. For Custom Objects, see [Custom Game Objects](custom-game-objects.md). -Each item listed here is treated as a unique object type. (ie. A red checker tinted black will not stack on top of a regular black checker.) - ## Object Types -### Game Boards - -All boards spawn locked by default. - -Type | Description | Notes --- | -- | -- -Backgammon_Board | The fold-open board of Backgammon. | Includes snap-points along each triangle. -CardBot_Board | The main board and 4 player boards of CardBots, Build & Destroy. | Includes snap-points on each card and deck location. -Checker_Board | The 8x8 board of Checkers. | Includes snap-points on each grid square. -Chess_Board | The 8x8 board of Chess. | Includes snap-points on each grid square. -Chinese_Checkers_Board | The 6-pointed board of Sternhalma, or Chinese Checkers. | Includes snap-points on each indent. -Go_Board | The 9-starred board of Go. | Includes snap-points on each line intersection. -Pachisi_Board | A 6-player Pachisi board. | Includes snap-points on each indent. -Reversi_Board | The 8x8 board of Reversi. | Includes snap-points on each grid square. - -### Containers - -Type | Description | Notes --- | -- | -- -Bag | A pouch that objects can be stored in and taken from. | -Bowl | A wooden bowl that objects can be dropped in. | The bowl does not have an inventory, objects merely rest within it visually. -Go_Game_Bowl_Black | A bowl that any number of [Black Go Stones](#Go_Game_Piece_Black) can be taken from and dropped back into. | -Go_Game_Bowl_White | A bowl that any number of [White Go Stones](#Go_Game_Piece_White) can be taken from and dropped back into. | -Infinite_Bag | A pouch that infinite copies of a single object can be taken from and dropped back into. | An object must be put into the bag to become the source object. - -### Figures - -Type | Description | Notes --- | -- | -- -Figurine_Card_Bot | A rectangle-based figurine of a CardBot from CardBots, Build & Destroy. | Faces visually to the side. -Figurine_Kimi_Kat | A rectangle-based figurine of two sitting cats. | -Figurine_Knil | A baseless figurine of a sword-wielding knight in full-plate armor. | -Figurine_Mara | A baseless figurine of a bearded man in slacks. | -Figurine_Sir_Loin | A rectangle-based figurine of a sword-wielding warrior with a shield on his back. | Faces visually backwards. -Figurine_Zeke | A baseless figurine of a cloaked character wielding a sword. | -Figurine_Zomblor | A baseless figurine of a zombified riot-officer with knives for hands, wearing a skirt. | - -### Game Pieces - -Type | Description | Notes --- | -- | -- -Backgammon_Piece_Brown | A brown Backgammon piece. | -Backgammon_Piece_White | A white Backgammon piece. | -BlockRectangle | A blue rectangular prism. | -BlockSquare | A red cube. | -BlockTriangle | A green triangular prism. | -Card | A card that is blank on both sides. | It is the size of a playing card, but will not stack into a deck. -Checker_Black | A black checker with a crown emblem on the top side. | -Checker_Red | A black checker with a crown emblem on the top side. | -Checker_White | A black checker with a crown emblem on the top side. | -Chess_Bishop | A chrome Chess bishop. | Faces visually to the left. -Chess_King | A chrome Chess King. | -Chess_Knight | A chrome Chess knight. | Faces visually backward (a common chess practice). -Chess_Pawn | A chrome Chess pawn. | -Chess_Queen | A chrome Chess queen. | -Chess_Rook | A chrome Chess rook. | -Chinese_Checkers_Piece | A marble for use in Sternhalma, or Chinese Checkers. | -Metal Ball | A marble, identical to `Chinese_Checkers_Piece` aside from shading. | This object type has a space in it, not an underscore. -Chip_10 | A blue poker chip worth $10 | Faces visually to the left. -Chip_50 | A green poker chip worth $50 | Faces visually to the left. -Chip_100 | A red poker chip worth $100 | Faces visually to the left. -Chip_500 | A silver poker chip worth $500 | Faces visually to the left. -Chip_1000 | A gold poker chip worth $1000 | Faces visually to the left. -Deck | A deck of the 52 standard playing cards. | Spawns face-up. Shuffles immediately when spawned. -Die_4 | A 4-sided die. | Spawns with 2 facing toward positive Z. -Die_6 | A 6-sided die with dots. | Spawns with 2 facing upwards. -Die_6_Rounded | A 6-sided die with dots and rounded corners. | Spawns with 1 facing upwards. -Die_8 | An 8-sided die. | Spawns with the edge between 6 and 7 facing upwards. -Die_10 | A 10-sided die. | Spawns with the edge between 3 and 4 facing upwards. -Die_12 | A 12-sided die. | Spawns with the corner between 7, 9 and 11 facing upwards. -Die_20 | A 20-sided die. | Spawns with the edge between 1 and 17 facing upwards. -Die_Piecepack | A wooden 6-sided die. | Spawns with 2 facing upwards. -Domino | A blank domino. | -Go_Game_Piece_Black | A black Go stone. | Spawned from a [black Go bowl](#Go_Game_Bowl_Black). -Go_Game_Piece_White | A white Go stone. | Spawned from a [white Go bowl](#Go_Game_Bowl_White). -Mahjong_Coin | A coin used in Mahjong. | -Mahjong_Stick | A stick used in Mahjong. | -Mahjong_Tile | A tile used in Mahjong. | -Metal Ball | A marble. | This type includes a space character and not an underline. -PiecePack_Arms | A wooden coin with a blue fleur-de-lis on the underside. | -PiecePack_Crowns | A wooden coin with a green crown on the underside. | -PiecePack_Moons | A wooden coin with a black moon on the underside. | -PiecePack_Suns | A wooden coin with a red sun on the underside. | -PlayerPawn | A small game piece representing a player. | -Quarter | An american quarter minted in 1942. | Spawns tails-up, facing to the right. -Reversi_Chip | A dual-colored Reversi chip. | Spawns white-side up. - -### RPG Figurines - -Type | Description | Notes --- | -- | -- -rpg_BARGHEST | An animated figurine of a mythical barghest. | -rpg_BASILISK | An animated figurine of a mythical basilisk (a.k.a. cockatrice). | -rpg_BEAR | An animated figurine of a bear. | -rpg_BLACK_DRAGON | An animated figurine of an eastern dragon. | -rpg_CENTAUR | An animated figurine of an armoured centaur. | -rpg_CERBERUS | An animated figurine of an infernal 3-headed dog. | -rpg_CHIMERA | An animated figurine of a mythical chimera. | -rpg_CRASC | An animated figurine of a one-eyed manta-like creature. | -rpg_CYCLOP | An animated figurine of a club-wielding cyclops. | -rpg_DARKNESS_WARLORD | An animated figurine of an armoured, morningstar-wielding orc. | -rpg_DRAGONIDE | An animated figurine of an armored humanoid lizard. | -rpg_EVIL_WATCHER | An animated figurine of a cycloptic scaled head with eye-stalks and bat-wings. | -rpg_GHOUL | An animated figurine of an undead humanoid | -rpg_GIANT_VIPER | An animated figurine of a large snake. | -rpg_GOBLIN | An animated figurine of a lightly-armored goblin with two knives. | -rpg_GOLEM | An animated figurine of a large earthen golem. | -rpg_GRIFFON | An animated figurine of a mythical griffon. | -rpg_HYDRA | An animated figurine of a large 3-headed lizard. | -rpg_KNIGHT | An animated figurine of a knight in full-plate armor wielding a sword and shield. | -rpg_KOBOLD | An animated figurine of a small helmeted humanoid. | -rpg_LIZARD_WARRIOR | An animated figurine of a sword-wielding lizard-like humanoid | -rpg_MAGE | An animated figurine of a staff-wielding mage. | -rpg_MANTICORA | An animated figurine of a mythical manticore. | This type is spelled with an A. -rpg_MUMMY | An animated figurine of a living mummy. | -rpg_OGRE | An animated figurine of a large boiled humanoid. | -rpg_ORC | An animated figurine of an axe-wielding orc. | -rpg_RANGER | An animated figurine of a bow-wielding ranger. | -rpg_RAT | An animated figurine of a giant rat. | -rpg_SKELETON_KNIGHT | An animated figurine of an armored living skeleton. | -rpg_TEMPLATE | The base of an RPG figurine. | It has the same animatable triggers as any other RPG Figurine, but no associated animations. -rpg_THIEF | An animated figurine of a cowled knife-wielding thief. | -rpg_TREE_ENT | An animated figurine of a large tree creature. | -rpg_TROLL | An animated figurine of a large green humanoid. | -rpg_VAMPIRE | An animated figurine of a large wingless bat. | -rpg_WARRIOR | An animated figurine of a stout, bearded, axe-wielding warrior in scale mail. | -rpg_WEREWOLF | An animated figurine of a mythical werewolf. | -rpg_WYVERN | An animated figurine of a mythical wyvern. | - -### Tilesets - -Type | Description | Notes --- | -- | -- -Tileset_Barrel | A small barrel for use in RPG Tilesets. | -Tileset_Chair | A small chair for use in RPG Tilesets. | -Tileset_Chest | A small chest for use in RPG Tilesets. | -Tileset_Corner | A floor tile with two walls for use in RPG Tilesets. | -Tileset_Floor | A floor tile for use in RPG Tilesets. | -Tileset_Rock | A small rock for use in RPG Tilesets. | -Tileset_Table | A small table for use in RPG Tilesets. | -Tileset_Tree | A small tree for use in RPG Tilesets. | -Tileset_Wall | A floor tile with a wall for use in RPG Tilesets. | - -### Devices - -Type | Description | Notes --- | -- | -- -Calculator | A useable calculator. | Faces visually backwards. -Counter | A useable digital counter. | -Digital_Clock | A useable digital clock. | -Notecard | An editable notecard. | -Tablet | A tablet that displays a webpage. | - -### Triggers - -Type | Description | Notes --- | -- | -- -ScriptingTrigger | A Scripting Zone, a zone used for scripting. | -FogOfWarTrigger | A [Hidden Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#hidden-zone) | -FogOfWar | A [Fog of War Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone) | - -### Other - -Type | Description | Notes --- | -- | -- -3DText | The text that the [Text Tool](https://kb.tabletopsimulator.com/game-tools/text-tool/) spawns. | - -## Spawnable Names +Each item listed below is treated as a unique object type. (ie. A red checker tinted black will not stack on top of a regular black checker.) ### Blocks -Name | Type | Differences --- | -- | -- -Red Square | [`BlockSquare`](#BlockSquare) | -Blue Rectangle | [`BlockRectangle`](#BlockRectangle) | -Green Triangle | [`BlockTriangle`](#BlockTriangle) | +Name | Tag | Description | Notes +-- | -- | -- | -- +BlockRectangle | `Block` | A blue rectangular prism. | +BlockSquare | `Block` | A red cube. | +BlockTriangle | `Block` | A green triangular prism. | ### Boards -Name | Type | Differences --- | -- | -- -Backgammon Board | [`backgammon_board`](#backgammon_board) | Spawns at table level regardless of input Y position. -Checkers Board | [`Checker_Board`](#Checker_Board) | Spawns at table level regardless of input Y position. -Chess Board | [`Chess_Board`](#Chess_Board) | Spawns at table level regardless of input Y position. -Chinese Checkers Board | [`Chinese_Checkers_Board`](#Chinese_Checkers_Board) | Spawns at table level regardless of input Y position. -Custom Board | [`Custom_Board`](#Custom_Board) | Spawns at table level regardless of input Y position. +All boards spawn locked by default. + +Name | Tag | Description | Notes +-- | -- | -- | -- +backgammon_board | `Board` | The fold-open board of Backgammon. | Includes snap-points along each triangle, totalling 120. +CardBot_Board | `Board` | The main board and 4 player boards of CardBots, Build & Destroy. | Includes snap-points on each card and deck location, totally 79. +Checker_Board | `Board` | The 8x8 board of Checkers. | Includes snap-points on each grid square, totalling 64. +Chess_Board | `Board` | The 8x8 board of Chess. | Includes snap-points on each grid square, totalling 64. +Chinese_Checkers_Board | `Board` | The 6-pointed board of Sternhalma, or Chinese Checkers. | Includes snap-points on each indent, totalling 121. +Go_Board | `Board` | The 9-starred board of Go. | Includes snap-points on each line intersection, totalling 361. +Pachisi_board | `Board` | A 6-player Pachisi board. | Includes snap-points on each indent, totall 133. +reversi_board | `Board` | The 8x8 board of Reversi. | Includes snap-points on each grid square, totalling 64. ### Cards -Name | Type | Differences --- | -- | -- -Standard Deck | [`Deck`](#Deck) | -Custom Deck | [`DeckCustom`](#DeckCustom) | -Random Card | [`Card`](#Card) | Random `CardID` value between `0` and `51` (inclusive). -Joker | [`Card`](#Card) | `CardID` value of `52`. -CardBots Main Deck | [`Deck_CardBot_Main`](#Deck_CardBot_Main) | -CardBots Head Deck | [`Deck_CardBot_Head`](#Deck_CardBot_Head) | +Name | Tag | Description | Notes +-- | -- | -- | -- +Card | `Card` | A blank card, standard playing card, or Cardbots card. | +Deck | `Deck` | A deck of the 52 standard playing cards. | Shuffles immediately when spawned. +Deck_CardBot_Head | `Deck` | A deck of the 10 head cards for CardBots, Build & Destroy. | Shuffles immediately when spawned. +Deck_CardBot_Main | `Deck` | A deck of the 152 main cards for CardBots, Build & Destroy. | Shuffles immediately when spawned. ### Checkers -Type | Description --- | -- -Red Checker | [`Checker_red`](#Checker_red) | -Black Checker | [`Checker_black`](#Checker_black) | -White Checker | [`Checker_white`](#Checker_white) | - -### Chess - -Name | Type | Differences --- | -- | -- -Pawn Chrome | [`Chess_Pawn`](#Chess_Pawn) | `MaterialIndex` value of `0`. -Rook Chrome | [`Chess_Rook`](#Chess_Rook) | `MaterialIndex` value of `0`. -Knight Chrome | [`Chess_Knight`](#Chess_Knight) | `MaterialIndex` value of `0`. -Bishop Chrome | [`Chess_Bishop`](#Chess_Bishop) | `MaterialIndex` value of `0`. -Queen Chrome | [`Chess_Queen`](#Chess_Queen) | `MaterialIndex` value of `0`. -King Chrome | [`Chess_King`](#Chess_King) | `MaterialIndex` value of `0`. -Pawn Cast Iron | [`Chess_Pawn`](#Chess_Pawn) | `MaterialIndex` value of `1`. -Rook Cast Iron | [`Chess_Rook`](#Chess_Rook) | `MaterialIndex` value of `1`. -Knight Cast Iron | [`Chess_Knight`](#Chess_Knight) | `MaterialIndex` value of `1`. -Bishop Cast Iron | [`Chess_Bishop`](#Chess_Bishop) | `MaterialIndex` value of `1`. -Queen Cast Iron | [`Chess_Queen`](#Chess_Queen) | `MaterialIndex` value of `1`. -King Cast Iron | [`Chess_King`](#Chess_King) | `MaterialIndex` value of `1`. -Pawn Light Wood | [`Chess_Pawn`](#Chess_Pawn) | `MaterialIndex` value of `2`. -Rook Light Wood | [`Chess_Rook`](#Chess_Rook) | `MaterialIndex` value of `2`. -Knight Light Wood | [`Chess_Knight`](#Chess_Knight) | `MaterialIndex` value of `2`. -Bishop Light Wood | [`Chess_Bishop`](#Chess_Bishop) | `MaterialIndex` value of `2`. -Queen Light Wood | [`Chess_Queen`](#Chess_Queen) | `MaterialIndex` value of `2`. -King Light Wood | [`Chess_King`](#Chess_King) | `MaterialIndex` value of `2`. -Bishop Dark Wood | [`Chess_Bishop`](#Chess_Bishop) | `MaterialIndex` value of `3`. -King Dark Wood | [`Chess_King`](#Chess_King) | `MaterialIndex` value of `3`. -Knight Dark Wood | [`Chess_Knight`](#Chess_Knight) | `MaterialIndex` value of `3`. -Pawn Dark Wood | [`Chess_Pawn`](#Chess_Pawn) | `MaterialIndex` value of `3`. -Queen Dark Wood | [`Chess_Queen`](#Chess_Queen) | `MaterialIndex` value of `3`. -Rook Dark Wood | [`Chess_Rook`](#Chess_Rook) | `MaterialIndex` value of `3`. - -### Custom - -Name | Type | Differences --- | -- | -- -Custom Model | [`Custom_Model`](#Custom_Model) | +Name | Tag | Description | Notes +-- | -- | -- | -- +Checker_black | `Checker` | A black checker with a crown emblem on the top side. | +Checker_red | `Checker` | A red checker with a crown emblem on the top side. | +Checker_white | `Checker` | A white checker with a crown emblem on the top side. | +Chinese_Checkers_Piece | `Checker` | A marble for use in Sternhalma, or Chinese Checkers. | + +### Chess Pieces + +Name | Tag | Description | Notes +-- | -- | -- | -- +Chess_Bishop | `Chess` | A chrome Chess bishop. | Faces visually to the left. +Chess_King | `Chess` | A chrome Chess king. | +Chess_Knight | `Chess` | A chrome Chess knight. | Faces visually backward (a common chess practice). +Chess_Pawn | `Chess` | A chrome Chess pawn. | +Chess_Queen | `Chess` | A chrome Chess queen. | +Chess_Rook | `Chess` | A chrome Chess rook. | + +### Chips + +Name | Tag | Description | Notes +-- | -- | -- | -- +Chip_10 | `Chip` | A blue casino chip worth $10 | Faces visually to the left. +Chip_50 | `Chip` | A green casino chip worth $50 | Faces visually to the left. +Chip_100 | `Chip` | A red casino chip worth $100 | Faces visually to the left. +Chip_500 | `Chip` | A silver casino chip worth $500 | Faces visually to the left. +Chip_1000 | `Chip` | A gold casino chip worth $1000 | Faces visually to the left. ### Dice -Name | Type | Differences --- | -- | -- -D4 | [`Die_4`](#Die_4) | `MaterialIndex` value of `0`. -D6 | [`Die_6`](#Die_6) | `MaterialIndex` value of `0`. -D8 | [`Die_8`](#Die_8) | `MaterialIndex` value of `0`. -D10 | [`Die_10`](#Die_10) | `MaterialIndex` value of `0`. -D12 | [`Die_12`](#Die_12) | `MaterialIndex` value of `0`. -D20 | [`Die_20`](#Die_20) | `MaterialIndex` value of `0`. -D6 Black | [`Die_6_Rounded`](#Die_6_Rounded) | `MaterialIndex` value of `0`. -D6 Red | [`Die_6_Rounded`](#Die_6_Rounded) | `MaterialIndex` value of `1`. -D6 Green | [`Die_6_Rounded`](#Die_6_Rounded) | `MaterialIndex` value of `2`. -D6 Blue | [`Die_6_Rounded`](#Die_6_Rounded) | `MaterialIndex` value of `3`. -D4 Chrome | [`Die_4`](#Die_4) | `MaterialIndex` value of `1`, `AltSound` value of `true`. -D6 Chrome | [`Die_6`](#Die_6) | `MaterialIndex` value of `1`, `AltSound` value of `true`. -D8 Chrome | [`Die_8`](#Die_8) | `MaterialIndex` value of `1`, `AltSound` value of `true`. -D10 Chrome | [`Die_10`](#Die_10) | `MaterialIndex` value of `1`, `AltSound` value of `true`. -D12 Chrome | [`Die_12`](#Die_12) | `MaterialIndex` value of `1`, `AltSound` value of `true`. -D20 Chrome | [`Die_20`](#Die_20) | `MaterialIndex` value of `1`, `AltSound` value of `true`. +Name | Tag | Description | Notes +-- | -- | -- | -- +Die_4 | `Dice` | A 4-sided die. | +Die_6 | `Dice` | A 6-sided die with dots. | +Die_6_Rounded | `Dice` | A 6-sided die with dots and rounded corners. | +Die_8 | `Dice` | An 8-sided die. | +Die_10 | `Dice` | A 10-sided die. | +Die_12 | `Dice` | A 12-sided die. | +Die_20 | `Dice` | A 20-sided die. | +Die_Piecepack | `Dice` | A wooden 6-sided die. | + +### Dominos + +Name | Tag | Description | Notes +-- | -- | -- | -- +Domino | `Domino` | A blank domino. | +Mahjong_Coin | `Domino` | A coin used in Mahjong. | +Mahjong_Stick | `Domino` | A stick used in Mahjong. | +Mahjong_Tile | `Domino` | A tile used in Mahjong. | ### Figurines -Name | Type | Differences --- | -- | -- -Custom Figurine | [`Figurine_Custom`](#Figurine_Custom) | -Knight of Knil | [`Figurine_Knil`](#Figurine_Knil) | -Kimi Kat | [`Figurine_Kimi_Kat`](#Figurine_Kimi_Kat) | -Sir Loin | [`Figurine_Sir_Loin`](#Figurine_Sir_Loin) | -Mara | [`Figurine_Mara`](#Figurine_Mara) | -Zomblor | [`Figurine_Zomblor`](#Figurine_Zomblor) | -Zeke Kodoku | [`Figurine_Zeke`](#Figurine_Zeke) | -CardBot | [`Figurine_Card_Bot`](#Figurine_Card_Bot) | - -### Go - -Name | Type | Differences --- | -- | -- -GO Piece White | [`go_game_piece_white`](#go_game_piece_white) | -GO Piece Black | [`go_game_piece_black`](#go_game_piece_black) | -GO Bowl White | [`go_game_bowl_white`](#go_game_bowl_white) | -GO Bowl Black | [`go_game_bowl_black`](#go_game_bowl_black) | - -### Marbles - -Name | Type | Differences --- | -- | -- -White Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `0`. -Red Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `1`. -Yellow Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `2`. -Green Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `3`. -Blue Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `4`. -Pink Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `5`. -Black Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` value of `6`. - -### Miscellaneous - -Name | Type | Differences --- | -- | -- -Quarter | [`Quarter`](#Quarter) | -Reversi Chip | [`reversi_chip`](#reversi_chip) | -Random Domino | [`Domino`](#Domino) | Random `MeshIndex` value between `0` and `27` (inclusive). -Random Mahjong | [`Mahjong_Tile`](#Mahjong_Tile) | Random `MeshIndex` value between `0` and `35` (inclusive). -Brown Backgammon | [`backgammon_piece_brown`](#backgammon_piece_brown) | -White Backgammon | [`backgammon_piece_white`](#backgammon_piece_white) | +Name | Tag | Description | Notes +-- | -- | -- | -- +Figurine_Card_Bot | `Figurine` | A rectangle-based figurine of a CardBot from CardBots, Build & Destroy. | Faces visually to the side. +Figurine_Kimi_Kat | `Figurine` | A rectangle-based figurine of two sitting cats. | +Figurine_Knil | `Figurine` | A baseless figurine of a sword-wielding knight in full-plate armor. | +Figurine_Mara | `Figurine` | A baseless figurine of a bearded man in slacks. | +Figurine_Sir_Loin | `Figurine` | A rectangle-based figurine of a sword-wielding warrior with a shield on his back. | Faces visually backwards. +Figurine_Zeke | `Figurine` | A baseless figurine of a cloaked character wielding a sword. | +Figurine_Zomblor | `Figurine` | A baseless figurine of a zombified riot-officer with knives for hands, wearing a skirt. | +Metal Ball | `Figurine` | A metallic marble. | This object's internal name includes a space character and not an underline. +PlayerPawn | `Figurine` | A small game piece representing a player. | + +### Go Pieces + +Name | Tag | Description | Notes +-- | -- | -- | -- +go_game_piece_black | `GoPiece` | A black Go stone. | Spawned from a [black Go bowl](#go_game_bowl_black). +go_game_piece_white | `GoPiece` | A white Go stone. | Spawned from a [white Go bowl](#go_game_bowl_white). +go_game_bowl_black | `GoPiece` | A bowl that any number of [Black Go Stones](#go_game_piece_black) can be taken from and dropped back into. | +go_game_bowl_white | `GoPiece` | A bowl that any number of [White Go Stones](#go_game_piece_white) can be taken from and dropped back into. | ### Piecepack -Name | Type | Differences --- | -- | -- -Arms Dice | [`Die_Piecepack`](#Die_Piecepack) | `MaterialIndex` value of `0`. -Crowns Dice | [`Die_Piecepack`](#Die_Piecepack) | `MaterialIndex` value of `1`. -Moons Dice | [`Die_Piecepack`](#Die_Piecepack) | `MaterialIndex` value of `2`. -Suns Dice | [`Die_Piecepack`](#Die_Piecepack) | `MaterialIndex` value of `3`. +Name | Tag | Description | Notes +-- | -- | -- | -- +PiecePack_Arms | `Piecepack` | A wooden coin with a blue fleur-de-lis on the underside. | +PiecePack_Crowns | `Piecepack` | A wooden coin with a green crown on the underside. | +PiecePack_Moons | `Piecepack` | A wooden coin with a black moon on the underside. | +PiecePack_Suns | `Piecepack` | A wooden coin with a red sun on the underside. | -### Player Pawns +### RPG Figurines -Name | Type | Differences --- | -- | -- -White Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `0`. -Red Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `1`. -Orange Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `2`. -Yellow Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `3`. -Green Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `4`. -Blue Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `5`. -Purple Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `6`. -Pink Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `7`. -Black Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` value of `8`. - -### Poker Chips - -Name | Type | Differences --- | -- | -- -Blue 10 | [`Chip_10`](#Chip_10) | -Green 50 | [`Chip_50`](#Chip_50) | -Red 100 | [`Chip_100`](#Chip_100) | -Silver 500 | [`Chip_500`](#Chip_500) | -Gold 1000 | [`Chip_1000`](#Chip_1000) | +Name | Tag | Description | Notes +-- | -- | -- | -- +rpg_BARGHEST | `rpgFigurine` | An animated figurine of a mythical barghest. | +rpg_BASILISK | `rpgFigurine` | An animated figurine of a mythical basilisk (a.k.a. cockatrice). | +rpg_BEAR | `rpgFigurine` | An animated figurine of a bear. | +rpg_BLACK_DRAGON | `rpgFigurine` | An animated figurine of an eastern dragon. | +rpg_CENTAUR | `rpgFigurine` | An animated figurine of an armoured centaur. | +rpg_CERBERUS | `rpgFigurine` | An animated figurine of an infernal 3-headed dog. | +rpg_CHIMERA | `rpgFigurine` | An animated figurine of a mythical chimera. | +rpg_CRASC | `rpgFigurine` | An animated figurine of a one-eyed manta-like creature. | +rpg_CYCLOP | `rpgFigurine` | An animated figurine of a club-wielding cyclops. | +rpg_DARKNESS_WARLORD | `rpgFigurine` | An animated figurine of an armoured, morningstar-wielding orc. | +rpg_DRAGONIDE | `rpgFigurine` | An animated figurine of an armored humanoid lizard. | +rpg_EVIL_WATCHER | `rpgFigurine` | An animated figurine of a cycloptic scaled head with eye-stalks and bat-wings. | +rpg_GHOUL | `rpgFigurine` | An animated figurine of an undead humanoid | +rpg_GIANT_VIPER | `rpgFigurine` | An animated figurine of a large snake. | +rpg_GOBLIN | `rpgFigurine` | An animated figurine of a lightly-armored goblin with two knives. | +rpg_GOLEM | `rpgFigurine` | An animated figurine of a large earthen golem. | +rpg_GRIFFON | `rpgFigurine` | An animated figurine of a mythical griffon. | +rpg_HYDRA | `rpgFigurine` | An animated figurine of a large 3-headed lizard. | +rpg_KNIGHT | `rpgFigurine` | An animated figurine of a knight in full-plate armor wielding a sword and shield. | +rpg_KOBOLD | `rpgFigurine` | An animated figurine of a small helmeted humanoid. | +rpg_LIZARD_WARRIOR | `rpgFigurine` | An animated figurine of a sword-wielding lizard-like humanoid | +rpg_MAGE | `rpgFigurine` | An animated figurine of a staff-wielding mage. | +rpg_MANTICORA | `rpgFigurine` | An animated figurine of a mythical manticore. | This type is spelled with an A. +rpg_MUMMY | `rpgFigurine` | An animated figurine of a living mummy. | +rpg_OGRE | `rpgFigurine` | An animated figurine of a large boiled humanoid. | +rpg_ORC | `rpgFigurine` | An animated figurine of an axe-wielding orc. | +rpg_RANGER | `rpgFigurine` | An animated figurine of a bow-wielding ranger. | +rpg_RAT | `rpgFigurine` | An animated figurine of a giant rat. | +rpg_SKELETON_KNIGHT | `rpgFigurine` | An animated figurine of an armored living skeleton. | +rpg_TEMPLATE | `rpgFigurine` | The base of an RPG figurine. | It has the same animatable triggers as any other RPG Figurine, but no associated animations. +rpg_THIEF | `rpgFigurine` | An animated figurine of a cowled knife-wielding thief. | +rpg_TREE_ENT | `rpgFigurine` | An animated figurine of a large tree creature. | +rpg_TROLL | `rpgFigurine` | An animated figurine of a large green humanoid. | +rpg_VAMPIRE | `rpgFigurine` | An animated figurine of a large wingless bat. | +rpg_WARRIOR | `rpgFigurine` | An animated figurine of a stout, bearded, axe-wielding warrior in scale mail. | +rpg_WEREWOLF | `rpgFigurine` | An animated figurine of a mythical werewolf. | +rpg_WYVERN | `rpgFigurine` | An animated figurine of a mythical wyvern. | + +### Tileset Pieces + +Name | Tag | Description | Notes +-- | -- | -- | -- +Tileset_Barrel | `Tileset` | A small barrel for use in RPG Tilesets. | +Tileset_Chair | `Tileset` | A small chair for use in RPG Tilesets. | +Tileset_Chest | `Tileset` | A small chest for use in RPG Tilesets. | +Tileset_Corner | `Tileset` | A floor tile with two walls for use in RPG Tilesets. | +Tileset_Floor | `Tileset` | A floor tile for use in RPG Tilesets. | +Tileset_Rock | `Tileset` | A small rock for use in RPG Tilesets. | +Tileset_Table | `Tileset` | A small table for use in RPG Tilesets. | +Tileset_Tree | `Tileset` | A small tree for use in RPG Tilesets. | +Tileset_Wall | `Tileset` | A floor tile with a wall for use in RPG Tilesets. | -### RPG Kit +### Other -Name | Type | Differences --- | -- | -- -Bear | [`rpg_BEAR`](#rpg_BEAR) | -Giant Rat | [`rpg_RAT`](#rpg_RAT) | -Giant Viper | [`rpg_GIANT_VIPER`](#rpg_GIANT_VIPER) | -Wolf | [`rpg_WOLF`](#rpg_WOLF) | -Evil Watcher | [`rpg_EVIL_WATCHER`](#rpg_EVIL_WATCHER) | -Golem | [`rpg_GOLEM`](#rpg_GOLEM) | -Tree Ent | [`rpg_TREE_ENT`](#rpg_TREE_ENT) | -Dragonide | [`rpg_DRAGONIDE`](#rpg_DRAGONIDE) | -Hydra | [`rpg_HYDRA`](#rpg_HYDRA) | -Lizard Warrior | [`rpg_LIZARD_WARRIOR`](#rpg_LIZARD_WARRIOR) | -Wyvern | [`rpg_WYVERN`](#rpg_WYVERN) | -Ghoul | [`rpg_GHOUL`](#rpg_GHOUL) | -Mummy | [`rpg_MUMMY`](#rpg_MUMMY) | -Skeleton Knight | [`rpg_SKELETON_KNIGHT`](#rpg_SKELETON_KNIGHT) | -Vampire | [`rpg_VAMPIRE`](#rpg_VAMPIRE) | -Cyclops | [`rpg_CYCLOP`](#rpg_CYCLOP) | -Goblin | [`rpg_GOBLIN`](#rpg_GOBLIN) | -Kobold | [`rpg_KOBOLD`](#rpg_KOBOLD) | -Ogre | [`rpg_OGRE`](#rpg_OGRE) | -Orc | [`rpg_ORC`](#rpg_ORC) | -Troll | [`rpg_TROLL`](#rpg_TROLL) | -Chimera | [`rpg_CHIMERA`](#rpg_CHIMERA) | -Griffon | [`rpg_GRIFFON`](#rpg_GRIFFON) | -Manticora | [`rpg_MANTICORA`](#rpg_MANTICORA) | -Werewolf | [`rpg_WEREWOLF`](#rpg_WEREWOLF) | -Floor | [`Tileset_Floor`](#Tileset_Floor) | -Wall | [`Tileset_Wall`](#Tileset_Wall) | -Corner | [`Tileset_Corner`](#Tileset_Corner) | -Chest | [`Tileset_Chest`](#Tileset_Chest) | -Barrel | [`Tileset_Barrel`](#Tileset_Barrel) | -Table | [`Tileset_Table`](#Tileset_Table) | -Chair | [`Tileset_Chair`](#Tileset_Chair) | -Tree | [`Tileset_Tree`](#Tileset_Tree) | -Rock | [`Tileset_Rock`](#Tileset_Rock) | - -### Tools - -Name | Type | Differences +Name | Tag | Description | Notes +-- | -- | -- | -- +backgammon_piece_brown | `Backgammon Piece` | A brown Backgammon piece. | +backgammon_piece_white | `Backgammon Piece` | A white Backgammon piece. | +Bag | `Bag` | A pouch that objects can be stored in and taken from. | +Bowl | `Generic` | A wooden bowl that objects can be dropped in. | The bowl does not have an inventory, objects merely rest within it visually. +Calculator | `Calculator` | An interactive calculator. | Faces visually backwards. +Counter | `Counter` | An interactive digital counter. | +Digital_Clock | `Clock` | An interactive digital clock. | +Infinite_Bag | A pouch that any number of copies of a single object can be taken from and dropped back into. | An object must be put into the bag to become the source object. +Notecard | `Notecard` | An editable notecard. | +Quarter | `Coin` | An american quarter minted in 1942. | Spawns tails-up, facing to the right. +reversi_chip | `Generic` | A dual-colored Reversi chip. | Spawns white-side up. +Tablet | `Tablet` | A tablet that displays a webpage. | + +### Scripting + +Name | Description | Notes -- | -- | -- -Tablet | [`Tablet`](#Tablet) | -Digital Clock | [`Digital_Clock`](#Digital_Clock) | -Loot Bag | [`Bag`](#Bag) | +ScriptingTrigger | A Scripting Zone. | +FogOfWarTrigger | A [Hidden Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#hidden-zone) | +FogOfWar | A [Fog of War Zone](https://kb.tabletopsimulator.com/game-tools/zone-tools/#fog-of-war-zone) | +3DText | The text that the [Text Tool](https://kb.tabletopsimulator.com/game-tools/text-tool/) spawns. | + +## Spawnable Names -### Unlisted +When using [`spawnObject()`](base.md#spawnobject), the `type` parameter can be any of the above object types, or any of the below names, which spawns an object of a certain type, and with certain properties different from default. -Name | Type | Differences +Alternate Name | Object | Differences -- | -- | -- -Go Board | [`Go_Board`](#Go_Board) | Spawns at table level regardless of input Y position. -Pachisi Board | [`Pachisi_board`](#Pachisi_board) | Spawns at table level regardless of input Y position. -Reversi Board | [`reversi_board`](#reversi_board) | Spawns at table level regardless of input Y position. +Arms Dice | [`Die_Piecepack`](#Die_Piecepack) | `MaterialIndex` of `0`. +Backgammon Board | [`backgammon_board`](#backgammon_board) | Snaps to table level immediately upon spawn. +Barrel | [`Tileset_Barrel`](#Tileset_Barrel) | *(none)* +Bear | [`rpg_BEAR`](#rpg_BEAR) | *(none)* +Bishop Cast Iron | [`Chess_Bishop`](#Chess_Bishop) | `MaterialIndex` of `1`. +Bishop Chrome | [`Chess_Bishop`](#Chess_Bishop) | `MaterialIndex` of `0`. +Bishop Dark Wood | [`Chess_Bishop`](#Chess_Bishop) | `MaterialIndex` of `3`. +Bishop Light Wood | [`Chess_Bishop`](#Chess_Bishop) | `MaterialIndex` of `2`. +Black Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` of `6`. +Black Checker | [`Checker_black`](#Checker_black) | *(none)* +Black Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` of `8`. +Blue 10 | [`Chip_10`](#Chip_10) | *(none)* +Blue Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` of `4`. +Blue Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` of `5`. +Blue Rectangle | [`BlockRectangle`](#BlockRectangle) | *(none)* +Brown Backgammon | [`backgammon_piece_brown`](#backgammon_piece_brown) | *(none)* +CardBot | [`Figurine_Card_Bot`](#Figurine_Card_Bot) | *(none)* +CardBots Head Deck | [`Deck_CardBot_Head`](#Deck_CardBot_Head) | *(none)* +CardBots Main Deck | [`Deck_CardBot_Main`](#Deck_CardBot_Main) | *(none)* +Chair | [`Tileset_Chair`](#Tileset_Chair) | *(none)* +Checkers Board | [`Checker_Board`](#Checker_Board) | Snaps to table level immediately upon spawn. +Chess Board | [`Chess_Board`](#Chess_Board) | Snaps to table level immediately upon spawn. +Chest | [`Tileset_Chest`](#Tileset_Chest) | *(none)* +Chimera | [`rpg_CHIMERA`](#rpg_CHIMERA) | *(none)* +Chinese Checkers Board | [`Chinese_Checkers_Board`](#Chinese_Checkers_Board) | Snaps to table level immediately upon spawn. +Corner | [`Tileset_Corner`](#Tileset_Corner) | *(none)* +Crowns Dice | [`Die_Piecepack`](#Die_Piecepack) | `MaterialIndex` of `1`. +Custom Board | [`Custom_Board`](#Custom_Board) | Snaps to table level immediately upon spawn. +Custom Deck | [`DeckCustom`](#DeckCustom) | *(none)* +Custom Figurine | [`Figurine_Custom`](#Figurine_Custom) | *(none)* +Custom Model | [`Custom_Model`](#Custom_Model) | *(none)* +Cyclops | [`rpg_CYCLOP`](#rpg_CYCLOP) | *(none)* +D10 | [`Die_10`](#Die_10) | `MaterialIndex` of `0`. +D10 Chrome | [`Die_10`](#Die_10) | `MaterialIndex` of `1`, `AltSound` of `true`. +D12 | [`Die_12`](#Die_12) | `MaterialIndex` of `0`. +D12 Chrome | [`Die_12`](#Die_12) | `MaterialIndex` of `1`, `AltSound` of `true`. +D20 | [`Die_20`](#Die_20) | `MaterialIndex` of `0`. +D20 Chrome | [`Die_20`](#Die_20) | `MaterialIndex` of `1`, `AltSound` of `true`. +D4 | [`Die_4`](#Die_4) | `MaterialIndex` of `0`. +D4 Chrome | [`Die_4`](#Die_4) | `MaterialIndex` of `1`, `AltSound` of `true`. +D6 | [`Die_6`](#Die_6) | `MaterialIndex` of `0`. +D6 Black | [`Die_6_Rounded`](#Die_6_Rounded) | `MaterialIndex` of `0`. +D6 Blue | [`Die_6_Rounded`](#Die_6_Rounded) | `MaterialIndex` of `3`. +D6 Chrome | [`Die_6`](#Die_6) | `MaterialIndex` of `1`, `AltSound` of `true`. +D6 Green | [`Die_6_Rounded`](#Die_6_Rounded) | `MaterialIndex` of `2`. +D6 Red | [`Die_6_Rounded`](#Die_6_Rounded) | `MaterialIndex` of `1`. +D8 | [`Die_8`](#Die_8) | `MaterialIndex` of `0`. +D8 Chrome | [`Die_8`](#Die_8) | `MaterialIndex` of `1`, `AltSound` of `true`. +Digital Clock | [`Digital_Clock`](#Digital_Clock) | *(none)* +Dragonide | [`rpg_DRAGONIDE`](#rpg_DRAGONIDE) | *(none)* +Evil Watcher | [`rpg_EVIL_WATCHER`](#rpg_EVIL_WATCHER) | *(none)* +Floor | [`Tileset_Floor`](#Tileset_Floor) | *(none)* +Ghoul | [`rpg_GHOUL`](#rpg_GHOUL) | *(none)* +Giant Rat | [`rpg_RAT`](#rpg_RAT) | *(none)* +Giant Viper | [`rpg_GIANT_VIPER`](#rpg_GIANT_VIPER) | *(none)* +Go Board | [`Go_Board`](#Go_Board) | Snaps to table level immediately upon spawn. +GO Bowl Black | [`go_game_bowl_black`](#go_game_bowl_black) | *(none)* +GO Bowl White | [`go_game_bowl_white`](#go_game_bowl_white) | *(none)* +GO Piece Black | [`go_game_piece_black`](#go_game_piece_black) | *(none)* +GO Piece White | [`go_game_piece_white`](#go_game_piece_white) | *(none)* +Goblin | [`rpg_GOBLIN`](#rpg_GOBLIN) | *(none)* +Gold 1000 | [`Chip_1000`](#Chip_1000) | *(none)* +Golem | [`rpg_GOLEM`](#rpg_GOLEM) | *(none)* +Green 50 | [`Chip_50`](#Chip_50) | *(none)* +Green Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` of `3`. +Green Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` of `4`. +Green Triangle | [`BlockTriangle`](#BlockTriangle) | *(none)* +Griffon | [`rpg_GRIFFON`](#rpg_GRIFFON) | *(none)* +Hydra | [`rpg_HYDRA`](#rpg_HYDRA) | *(none)* +Joker | [`Card`](#Card) | `CardID` of `52`. +Kimi Kat | [`Figurine_Kimi_Kat`](#Figurine_Kimi_Kat) | *(none)* +King Cast Iron | [`Chess_King`](#Chess_King) | `MaterialIndex` of `1`. +King Chrome | [`Chess_King`](#Chess_King) | `MaterialIndex` of `0`. +King Dark Wood | [`Chess_King`](#Chess_King) | `MaterialIndex` of `3`. +King Light Wood | [`Chess_King`](#Chess_King) | `MaterialIndex` of `2`. +Knight Cast Iron | [`Chess_Knight`](#Chess_Knight) | `MaterialIndex` of `1`. +Knight Chrome | [`Chess_Knight`](#Chess_Knight) | `MaterialIndex` of `0`. +Knight Dark Wood | [`Chess_Knight`](#Chess_Knight) | `MaterialIndex` of `3`. +Knight Light Wood | [`Chess_Knight`](#Chess_Knight) | `MaterialIndex` of `2`. +Knight of Knil | [`Figurine_Knil`](#Figurine_Knil) | *(none)* +Kobold | [`rpg_KOBOLD`](#rpg_KOBOLD) | *(none)* +Lizard Warrior | [`rpg_LIZARD_WARRIOR`](#rpg_LIZARD_WARRIOR) | *(none)* +Loot Bag | [`Bag`](#Bag) | *(none)* +Manticora | [`rpg_MANTICORA`](#rpg_MANTICORA) | *(none)* +Mara | [`Figurine_Mara`](#Figurine_Mara) | *(none)* +Moons Dice | [`Die_Piecepack`](#Die_Piecepack) | `MaterialIndex` of `2`. +Mummy | [`rpg_MUMMY`](#rpg_MUMMY) | *(none)* +Ogre | [`rpg_OGRE`](#rpg_OGRE) | *(none)* +Orange Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` of `2`. +Orc | [`rpg_ORC`](#rpg_ORC) | *(none)* +Pachisi Board | [`Pachisi_board`](#Pachisi_board) | Snaps to table level immediately upon spawn. +Pawn Cast Iron | [`Chess_Pawn`](#Chess_Pawn) | `MaterialIndex` of `1`. +Pawn Chrome | [`Chess_Pawn`](#Chess_Pawn) | `MaterialIndex` of `0`. +Pawn Dark Wood | [`Chess_Pawn`](#Chess_Pawn) | `MaterialIndex` of `3`. +Pawn Light Wood | [`Chess_Pawn`](#Chess_Pawn) | `MaterialIndex` of `2`. +Pink Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` of `5`. +Pink Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` of `7`. +Purple Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` of `6`. +Quarter | [`Quarter`](#Quarter) | *(none)* +Queen Cast Iron | [`Chess_Queen`](#Chess_Queen) | `MaterialIndex` of `1`. +Queen Chrome | [`Chess_Queen`](#Chess_Queen) | `MaterialIndex` of `0`. +Queen Dark Wood | [`Chess_Queen`](#Chess_Queen) | `MaterialIndex` of `3`. +Queen Light Wood | [`Chess_Queen`](#Chess_Queen) | `MaterialIndex` of `2`. +Random Card | [`Card`](#Card) | Random `CardID` between `0` and `51` (inclusive). +Random Domino | [`Domino`](#Domino) | Random `MeshIndex` between `0` and `27` (inclusive). +Random Mahjong | [`Mahjong_Tile`](#Mahjong_Tile) | Random `MeshIndex` between `0` and `35` (inclusive). +Red 100 | [`Chip_100`](#Chip_100) | *(none)* +Red Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` of `1`. +Red Checker | [`Checker_red`](#Checker_red) | *(none)* +Red Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` of `1`. +Red Square | [`BlockSquare`](#BlockSquare) | *(none)* +Reversi Board | [`reversi_board`](#reversi_board) | Snaps to table level immediately upon spawn. +Reversi Chip | [`reversi_chip`](#reversi_chip) | *(none)* +Rock | [`Tileset_Rock`](#Tileset_Rock) | *(none)* +Rook Cast Iron | [`Chess_Rook`](#Chess_Rook) | `MaterialIndex` of `1`. +Rook Chrome | [`Chess_Rook`](#Chess_Rook) | `MaterialIndex` of `0`. +Rook Dark Wood | [`Chess_Rook`](#Chess_Rook) | `MaterialIndex` of `3`. +Rook Light Wood | [`Chess_Rook`](#Chess_Rook) | `MaterialIndex` of `2`. +Silver 500 | [`Chip_500`](#Chip_500) | *(none)* +Sir Loin | [`Figurine_Sir_Loin`](#Figurine_Sir_Loin) | *(none)* +Skeleton Knight | [`rpg_SKELETON_KNIGHT`](#rpg_SKELETON_KNIGHT) | *(none)* +Standard Deck | [`Deck`](#Deck) | *(none)* +Suns Dice | [`Die_Piecepack`](#Die_Piecepack) | `MaterialIndex` of `3`. +Table | [`Tileset_Table`](#Tileset_Table) | *(none)* +Tree | [`Tileset_Tree`](#Tileset_Tree) | *(none)* +Tree Ent | [`rpg_TREE_ENT`](#rpg_TREE_ENT) | *(none)* +Troll | [`rpg_TROLL`](#rpg_TROLL) | *(none)* +Vampire | [`rpg_VAMPIRE`](#rpg_VAMPIRE) | *(none)* +Wall | [`Tileset_Wall`](#Tileset_Wall) | *(none)* +Werewolf | [`rpg_WEREWOLF`](#rpg_WEREWOLF) | *(none)* +White Backgammon | [`backgammon_piece_white`](#backgammon_piece_white) | *(none)* +White Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` of `0`. +White Checker | [`Checker_white`](#Checker_white) | *(none)* +White Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` of `0`. +Wolf | [`rpg_WOLF`](#rpg_WOLF) | *(none)* +Wyvern | [`rpg_WYVERN`](#rpg_WYVERN) | *(none)* +Yellow Ball | [`Chinese_Checkers_Piece`](#Chinese_Checkers_Piece) | `MaterialIndex` of `2`. +Yellow Pawn | [`PlayerPawn`](#PlayerPawn) | `MaterialIndex` of `3`. +Zeke Kodoku | [`Figurine_Zeke`](#Figurine_Zeke) | *(none)* +Zomblor | [`Figurine_Zomblor`](#Figurine_Zomblor) | *(none)* diff --git a/docs/css/theme.css b/docs/css/theme.css index 2d880fb2..ccbf0699 100644 --- a/docs/css/theme.css +++ b/docs/css/theme.css @@ -94,7 +94,7 @@ td {position: relative;} .anchor { position: absolute; top: 0px; - margin: -48px 0 0; /* negative fixed header height */ + margin: -4.8rem 0 0; /* negative fixed header height */ } /*prevent left/right scrollbar @@ -122,3 +122,7 @@ disabled due to lack of need currently, but works*/ left:1.3rem; top:-0.5rem; } + +code { + white-space: nowrap; + } From 1907706dd659b38122b613e91923b877ea04e538 Mon Sep 17 00:00:00 2001 From: Riley Froude Date: Sun, 31 Jan 2021 06:00:18 -0500 Subject: [PATCH 48/48] cleaning dirty files before PR --- .gitignore | 1 - docs/CNAME | 1 + docs/object.md | 3 --- mkdocs.yml | 2 +- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index cee13065..c0830248 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ site/ mkdocs/ -.vscode/ diff --git a/docs/CNAME b/docs/CNAME index e69de29b..52a8a6e5 100644 --- a/docs/CNAME +++ b/docs/CNAME @@ -0,0 +1 @@ +api.tabletopsimulator.com diff --git a/docs/object.md b/docs/object.md index 6a3b3327..b3ae34b5 100644 --- a/docs/object.md +++ b/docs/object.md @@ -259,10 +259,7 @@ setSnapPoints([](types.md) parameters) | Spawn setTable([](types.md) func_name, [](types.md) data) | Creates/updates a variable in another entity's script. Only used for tables. | [](types.md) | setVar([](types.md) func_name, [](types.md) data) | Creates/updates a variable in another entity's script. Cannot set a table. | [](types.md) | setVectorLines([](types.md) parameters) | Spawns Vector Lines from a list of parameters on this entity. | [](types.md) | [](#setvectorlines) -<<<<<<< HEAD -======= ->>>>>>> official/master --- diff --git a/mkdocs.yml b/mkdocs.yml index 72b4bf6e..43a88876 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -39,7 +39,7 @@ markdown_extensions: permalink: "\u0020" repo_name: 'GitHub Source' -repo_url: 'https://github.com/tts-community/api' +repo_url: 'https://github.com/Berserk-Games/Tabletop-Simulator-API' extra: