# new RezDynamicLink()
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.
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
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 |
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 |
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.
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 |