Class

RezDecision

RezDecision()

Constructor

# 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.

View Source rez_decision.js, line 5

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

View Source rez_decision.js, line 30

# static data() → {object}

Returns the data object that was passed to the constructor or added via setData

View Source rez_decision.js, line 117

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

View Source rez_decision.js, line 193

this decision instance for method chaining

RezDecision

# static defaultYes() → {RezDecision}

Makes a positive decision using the default value (indicates no explicit choice was made)

View Source rez_decision.js, line 150

this decision instance for method chaining

RezDecision

# static explain() → {string}

Returns a descriptive string explaining the decision result, reason, and visibility

View Source rez_decision.js, line 232

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

View Source rez_decision.js, line 221

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.

View Source rez_decision.js, line 178

# static isHidden() → {boolean}

Indicates whether this decision was made with the hide() method

View Source rez_decision.js, line 97

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

View Source rez_decision.js, line 163

this decision instance for method chaining

RezDecision

# static purpose() → {string}

Returns the purpose string that describes what this decision is about

View Source rez_decision.js, line 47

the purpose or description of this decision

string

# static reason() → {string}

Returns the reason string provided when making a no decision

View Source rez_decision.js, line 107

the reason provided for negative decisions

string

# static result() → {boolean}

Returns true for yes decisions, false for no decisions

View Source rez_decision.js, line 67

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

View Source rez_decision.js, line 208

this decision instance for method chaining

RezDecision

# static usedDefault() → {boolean}

Indicates whether this decision was made using defaultYes() or defaultNo()

View Source rez_decision.js, line 127

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

View Source rez_decision.js, line 57

true if a decision has been made

boolean

# static wasNo() → {boolean}

Convenience method that returns true if the decision result was negative

View Source rez_decision.js, line 87

true if the decision was no

boolean

# static wasYes() → {boolean}

Convenience method that returns true if the decision result was positive

View Source rez_decision.js, line 77

true if the decision was yes

boolean

# static yes() → {RezDecision}

Makes a positive decision explicitly

View Source rez_decision.js, line 137

this decision instance for method chaining

RezDecision