... | @@ -8,7 +8,7 @@ Free and Pro-tier developers only have access to in-play scripting. Enterprise c |
... | @@ -8,7 +8,7 @@ Free and Pro-tier developers only have access to in-play scripting. Enterprise c |
|
|
|
|
|
The simplest way to try custom scripting is through the custom javascript action in the effect builder.
|
|
The simplest way to try custom scripting is through the custom javascript action in the effect builder.
|
|
|
|
|
|
To use it, use the custom javascript action. All javascript is executed in the context of that action. Custom javascript action can be executed either client side or server side. Server side execution effects the logic of the game while client-side execution effects the rendering and visuals on the client. Even if your game doesn't have a server the logic of the game is still server-side with a local server.
|
|
All javascript is executed in the context of that action. Custom javascript action can be executed either client side or server side. Server side execution effects the logic of the game while client-side execution effects the rendering and visuals on the client. Even if your game doesn't have a server, the logic of the game is still server-side with a local server.
|
|
|
|
|
|
Examples of custom javascript commands on the server:
|
|
Examples of custom javascript commands on the server:
|
|
|
|
|
... | @@ -81,8 +81,7 @@ A string that is the name of the effect. Typically saved by assign variable. Sho |
... | @@ -81,8 +81,7 @@ A string that is the name of the effect. Typically saved by assign variable. Sho |
|
|
|
|
|
*context* parameter
|
|
*context* parameter
|
|
|
|
|
|
Optional. Default thisCard.
|
|
Optional. Context object, default thisCard.
|
|
|
|
|
|
|
|
|
|
#### runEffectFromAnotherAction(*effect*, *callback*)
|
|
#### runEffectFromAnotherAction(*effect*, *callback*)
|
|
|
|
|
... | @@ -111,7 +110,9 @@ Specify the match. Should always be "thisMatch". |
... | @@ -111,7 +110,9 @@ Specify the match. Should always be "thisMatch". |
|
|
|
|
|
Optional.
|
|
Optional.
|
|
|
|
|
|
#### getIndexFromEffectName(*effectName*)
|
|
|
|
|
|
setStat(thisMatch, newValue, playerProperty, localPlayerNumber)
|
|
|
|
|
|
|
|
|
|
#### effectAfterAction()
|
|
#### effectAfterAction()
|
|
|
|
|
... | @@ -147,18 +148,15 @@ stringVariableReplacement("This card is called $title. It has an attack power of |
... | @@ -147,18 +148,15 @@ stringVariableReplacement("This card is called $title. It has an attack power of |
|
|
|
|
|
`function (selectedCards)`
|
|
`function (selectedCards)`
|
|
|
|
|
|
| key | description | type |
|
|
selectedCards may a string error message, `fail cancel`, `failed`, or an array of ciids.
|
|
| ------ | ------ | ------ |
|
|
|
|
| ciid | The ciid of the card you're executing. | int |
|
|
|
|
| effectIndex | The index of the effect you're executing on the target card. | int |
|
|
|
|
|
|
|
|
#### dulstError(*errorMessage*)
|
|
#### dulstError(*errorMessage*)
|
|
|
|
|
|
|
|
Prints a dulst error in the logs. Does not stop the game.
|
|
|
|
|
|
*errorMessage* parameter
|
|
*errorMessage* parameter
|
|
|
|
|
|
| key | description | type |
|
|
String explaining the error.
|
|
| ------ | ------ | ------ |
|
|
|
|
| errorMessage | Some text explaining the error. | string |
|
|
|
|
|
|
|
|
#### thisMatch.getRandom()
|
|
#### thisMatch.getRandom()
|
|
|
|
|
... | @@ -166,13 +164,23 @@ Dulst safe random generator. Never use your own random. |
... | @@ -166,13 +164,23 @@ Dulst safe random generator. Never use your own random. |
|
|
|
|
|
Returns float like `Math.random()`
|
|
Returns float like `Math.random()`
|
|
|
|
|
|
#### thisMatch.sample(*population*, *n*)
|
|
#### thisMatch.shuffle(*collection*)
|
|
|
|
|
|
|
|
Dulst safe random shuffler. Never use your own random shuffler.
|
|
|
|
|
|
|
|
Returns shuffled collection.
|
|
|
|
|
|
|
|
*collection* parameter
|
|
|
|
|
|
|
|
Array to shuffle.
|
|
|
|
|
|
|
|
#### thisMatch.sample(*collection*, *n*)
|
|
|
|
|
|
Dulst safe random sampling. Never use your own random sample.
|
|
Dulst safe random sampling. Never use your own random sample.
|
|
|
|
|
|
Returns array.
|
|
Returns array.
|
|
|
|
|
|
*population* parameter
|
|
*collection* parameter
|
|
|
|
|
|
Array of possible choices.
|
|
Array of possible choices.
|
|
|
|
|
... | | ... | |