# new RezDecision()
Represents a decision that can be made by user-written filters in the Rez game engine. This is a simplified abstraction of RezDynamicLink that allows code to make yes/no decisions with optional reasons and data. Decisions can be made explicitly or use default values.
Example
// Create a decision and make a choice
const decision = new RezDecision("Filter Item");
if(item.isAllowed) {
decision.yes();
} else {
decision.no("Item not permitted");
}
Methods
# static constructor(purpose, data)
Creates a new decision with the specified purpose and optional data
Parameters:
| Name | Type | Description |
|---|---|---|
purpose |
string
|
description of what this decision is for |
data |
object
|
optional data object to associate with this decision |
# static data() → {object}
Returns the data object that was passed to the constructor or added via setData
the data object associated with this decision
object
# static defaultNo(reason) → {RezDecision}
Makes a negative decision using the default value with an optional reason
Parameters:
| Name | Type | Description |
|---|---|---|
reason |
string
|
optional reason for the negative decision |
this decision instance for method chaining
# static defaultYes() → {RezDecision}
Makes a positive decision using the default value (indicates no explicit choice was made)
this decision instance for method chaining
# static explain() → {string}
Returns a descriptive string explaining the decision result, reason, and visibility
a human-readable explanation of the decision
string
# static getData(key) → {object}
Returns the object stored in the decision under the specified key
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string
|
the data key to retrieve |
the value for the key
object
# static hide()
Makes a negative decision that should be hidden from the user. Sets the decision as made, result to false, reason to "hidden", and marks it as hidden.
# static isHidden() → {boolean}
Indicates whether this decision was made with the hide() method
true if this decision should be hidden from the user
boolean
# static no(reason) → {RezDecision}
Makes a negative decision explicitly with an optional reason
Parameters:
| Name | Type | Description |
|---|---|---|
reason |
string
|
optional reason for the negative decision |
this decision instance for method chaining
# static purpose() → {string}
Returns the purpose string that describes what this decision is about
the purpose or description of this decision
string
# static reason() → {string}
Returns the reason string provided when making a no decision
the reason provided for negative decisions
string
# static result() → {boolean}
Returns true for yes decisions, false for no decisions
the boolean result of the decision
boolean
# static setData(key, value) → {RezDecision}
Sets a key-value pair in the decision's data object
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string
|
the data key to set |
value |
*
|
the value to associate with the key |
this decision instance for method chaining
# static usedDefault() → {boolean}
Indicates whether this decision was made using defaultYes() or defaultNo()
true if a default decision method was used
boolean
# static wasMade() → {boolean}
Indicates whether any decision method (yes, no, hide, or default variants) has been called
true if a decision has been made
boolean
# static wasNo() → {boolean}
Convenience method that returns true if the decision result was negative
true if the decision was no
boolean
# static wasYes() → {boolean}
Convenience method that returns true if the decision result was positive
true if the decision was yes
boolean
# static yes() → {RezDecision}
Makes a positive decision explicitly
this decision instance for method chaining