Binds a small standard library of helpful external functions so that ink
stories can interact with foundry. These must be declared at the top of your
ink script using the EXTERNAL statement.
Even with Bind Foundry External Functions enabled in Module Settings, you
cannot use these external functions without an EXTERNAL statement. A
benefit of this behaviour is that you can only declare the functions you
want to use, and can create functions with the names of the others (for
example, you might write === function ROLL(die) === instead of using
rolls from foundry.)
- See:
Methods
(inner) ACTOR(name, propertyString)
- See:
Queries properties of an actor.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | the name of the actor to access. |
propertyString |
String | the property key locating the desired
value in Actor.data. |
(inner) ITEM(name, propertyString)
- See:
Queries properties of an item.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | the name of the item to access. |
propertyString |
String | the property key locating the desired
value in Item.data. |
(inner) JOURNAL(name)
- See:
Loads the raw content of a journal entry (including html tags).
Rendering that html is not easy, due to renderTemplate requiring
const arguments.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | the name of the scene to activate. |
(inner) MACRO(name)
Runs a Macro in foundry. While testing, it seemed that inkjs may not perfectly implement ink's external API, so your macro may be called prospectively. It may be triggered multiple times before that part of your story is displayed to the players. As such, I recommend you have some code to prevent it from being called at inappropriate times.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | the name of the macro to execute. |
(inner) PRELOAD(name)
Preloads a scene in foundry. Using this in an earlier knot or stitch before SCENE will ensure even players with slow computers switch at about the same time as you.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | the name of the scene to preload. |
(inner) ROLL(formula)
Binds to foundry's rolling API, allowing ink to get roll results as an integer total.
Parameters:
| Name | Type | Description |
|---|---|---|
formula |
String | the dice formula to roll. |
(inner) SCENE(name)
- See:
Switches scenes in foundry. While testing, it seemed that inkjs may not perfectly implement ink's external API, so your scene might switch before that part of your story is displayed to the players. This will be observed further until the bug is confirmed resolved.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | the name of the scene to activate. |