Class

RezDynamicLink

RezDynamicLink()

Constructor

Represents a conditional link that can be shown, hidden, or disabled based on game state.

Dynamic links are used in templates to create links whose appearance and behavior depend on runtime conditions. A link can be:

  • Allowed: Shown as a clickable link that triggers an action
  • Denied: Shown as inactive/greyed out text (optionally as a non-clickable link)
  • Hidden: Not displayed at all

This is typically used for choice-based navigation where some options may not be available based on player stats, inventory, or story progress.

View Source rez_dynamic_link.js, line 5

Example
// In a card's event handler
const link = new RezDynamicLink(this);
if(player.hasKey) {
  link.allow("Open the door", "card_behind_door");
} else {
  link.deny("The door is locked", false);
}
return link.markup;

Members

Object

# card

The card this link belongs to.

View Source rez_dynamic_link.js, line 60

boolean

# choosen

Whether a choice has been made (allow, deny, or hide).

View Source rez_dynamic_link.js, line 76

boolean

# display

Whether this link should be displayed.

View Source rez_dynamic_link.js, line 84

string

# inactiveClass

The CSS class applied to inactive/denied links.

View Source rez_dynamic_link.js, line 68

string

# markup

The HTML markup for this link.

View Source rez_dynamic_link.js, line 92

Methods

# allow(response, targetId)

Makes this link active and clickable.

Parameters:
Name Type Description
response string | function

Either the link text, or a function that returns custom markup

targetId string

The ID of the target card to navigate to when clicked

View Source rez_dynamic_link.js, line 110

Examples
// Simple text link
link.allow("Go north", "card_north_room");
// Custom markup via function
link.allow(() => `<a href="#" data-event="custom">Custom action</a>`, null);

# deny(text, asLinkopt)

Makes this link inactive/disabled.

The link text is shown but cannot be clicked. Useful for showing options that exist but are currently unavailable.

Parameters:
Name Type Attributes Default Description
text string

The text to display

asLink boolean <optional>
true

If true, renders as an inactive link; if false, renders as a span

View Source rez_dynamic_link.js, line 136

Examples
// Show as greyed-out link
link.deny("Locked door (requires key)");
// Show as plain text
link.deny("Not available", false);

# hide()

Hides this link completely.

The link will not be displayed at all. Use this when an option should not even be visible to the player.

View Source rez_dynamic_link.js, line 158

Example
// Hide the secret passage unless discovered
if(!player.foundSecretPassage) {
  link.hide();
}

# static constructor(card)

Creates a new dynamic link.

Parameters:
Name Type Description
card Object

The card this link belongs to

View Source rez_dynamic_link.js, line 41