Back to Guides

Visual Scripting Blocks Reference

This section provides a comprehensive list of all the blocks available in visual scripting. It serves as a quick reference guide to help you understand the functionality and usage of each block, enabling you to create complex game behaviors and logic with ease.

Asset Manager :

Get Asset ID’s

Get Asset IDs

The "Get Asset IDs" block retrieves the primary keys of all assets included in the asset list.

Inputs

Asset List: A list of assets from which to extract the primary keys.

Usage

When to Use

Use this block when you need to retrieve the unique identifiers of assets for further processing or reference.

Common Use Cases:

Extracting IDs to manage or reference assets in other parts of the script.

Passing asset IDs to other blocks for operations like filtering or updating.

Get Location Assets

Get Location Assets

The "Get Location Assets" block retrieves all assets currently in a specified location.

Inputs

Location PK: The primary key of the location from which to retrieve assets.

Usage

When to Use

Use this block to gather all assets present in a particular location, useful for managing scene elements or interactions.

Common Use Cases:

Loading assets for a specific game scene.

Checking for available resources or characters in a location.

Get Model

Get Model

The "Get Model" block retrieves the model instance based on an attribute.

Inputs

Model Class: The class of the model to retrieve.

Identifier: The attribute used to identify the model instance.

Usage

When to Use

Use this block when you need to fetch a specific model instance using an attribute.

Common Use Cases:

Retrieving a character or item model based on a unique attribute.

Accessing model data for updates or reference.

Get Model Attribute

Get Model Attribute

The "Get Model Attribute" block retrieves the attributes of a model.

Inputs

Model: The model from which to get attributes.

Key Name: The name of the attribute to retrieve.

Usage

When to Use

Use this block to access specific attributes of a model for display or further processing.

Common Use Cases:

Displaying character stats or item details.

Using model attributes in conditional logic or calculations.

Character Manager:

Get Character

Get Character

The "Get Character" block retrieves a character object based on the provided primary key and scene object.

Inputs

Primary Key (pk): The unique identifier for the character.

Scene: The scene object where the character is located.

Usage

When to Use

Use this block to fetch a specific character's details using its primary key within a particular scene.

Common Use Cases:

Accessing a character's attributes for updates or interactions.

Retrieving character data for display or processing in the game logic.

Initialise Character

Initialise Character

The "Initialise Character" block initializes a character object based on the provided primary key and scene object.

Inputs

Primary Key (pk): The unique identifier for the character.

Scene: The scene object where the character is to be initialized.

Usage

When to Use

Use this block to set up a character in a scene, ensuring it's ready for interactions or game events.

Common Use Cases:

Initializing characters when a new scene is loaded.

Setting up characters for specific events or interactions within the game.


Asset Blocks

Character:

Dialogue

Dialogue

The "Dialogue" block generates a dialogue response from the character based on the user response and current context in the game.

Inputs

Chain (chain): Optional. The specific dialogue chain to use.

Tools (tools): Optional. Whether to include additional dialogue tools (default is True).

Usage

When to Use

Use this block to create dynamic dialogue interactions between characters and players.

Common Use Cases:

Generating character responses during conversations.

Get Character Context Window

Get Character Context Window

The "Get Character Context Window" block retrieves the context window of a character based on the user response and the context manager.

Inputs

None: This block does not require any specific inputs.

Usage

When to Use

Use this block to fetch the context window for a character, which includes relevant data about their current situation and interactions.

Common Use Cases:

Accessing character context during gameplay to adjust behavior or dialogue.

Monitoring character state for debugging or game development purposes.

Get Custom Value

Get Custom Value

The "Get Custom Value" block retrieves the custom value of a character based on the provided key.

Inputs

Key (key): The key representing the custom value to retrieve.

Usage

When to Use

Use this block to access specific custom attributes or values associated with a character.

Common Use Cases:

Fetching character-specific data like health, stamina, or inventory items.

Using custom values in game logic or conditions

Retrieve Current Context

Retrieve Current Context

The "Retrieve Current Context" block retrieves the current context of the character based on the scene context, location object, and assets in the scene.

Inputs

None:

This block does not require any specific inputs.

Usage

When to Use

Use this block to gather comprehensive information about the character's current context in the game world.

Common Use Cases:

Understanding character state for decision-making and interactions.

Update Custom Value

Update Custom Value

The "Update Custom Value" block updates the custom value of a character based on the provided key.

Inputs

Key (key): The key representing the custom value to update.

Value (value): The new value to assign to the custom attribute.

Usage

When to Use

Use this block to modify specific custom attributes or values associated with a character.

Common Use Cases:

Changing character attributes like health, experience, or status effects.

Dynamically updating character data based on in-game events and actions.

Location:

Calculate Character Probability

Calculate Character Probability

The "Calculate Character Probability" block calculates the probability of a player encountering a character at a location and returns a list of characters if they have been discovered.

Inputs

None: This block does not require any specific inputs.

Usage

When to Use

Use this block to determine the likelihood of a player meeting a character in a specific location.

Common Use Cases:

Returning a list of characters that have been encountered.

Calculate Item Probability

Calculate Item Probability

The "Calculate Item Probability" block calculates the probability of a player encountering an item at a location and returns a list of items if they have been discovered.

Inputs

None: This block does not require any specific inputs.

Usage

When to Use

Use this block to determine the chances of a player finding items in a specific location.

Common Use Cases:

Returning a list of items that have been found.

Generate Character Discovery Log

Generate Character Discovery Log

The "Generate Character Discovery Log" block generates an AI-generated bit of text alerting the player that a character was discovered.

Inputs

Characters (characters): The characters that were discovered.

Usage

When to Use

Use this block to create logs or records when players encounter new characters.

Common Use Cases:

Keeping track of player encounters with characters.

Triggering events or updates based on character discoveries.

Alerting players with generated text about new character discoveries.

Generate Item Discovery Log

Generate Item Discovery Log

The "Generate Item Discovery Log" block generates an AI-generated bit of text alerting the player that an item was discovered.

Inputs

Items (items): The items that were discovered.

Usage

When to Use

Use this block to log player discoveries of items.

Common Use Cases:

Recording item pickups for player statistics.

Triggering in-game events or rewards based on item discoveries.

Alerting players with generated text about new item discoveries.

Generate Exploration Log

Generate Exploration Log

The "Generate Exploration Log" block generates an AI-generated bit of text alerting the player that a location was explored.

Inputs

None: This block does not require any specific inputs.

Usage

When to Use

Use this block to log player exploration activities.

Common Use Cases:

Alerting players with generated text about exploration activities.

Get All characters

Get All Characters

The "Get All Characters" block returns all characters at a location.

Inputs

None:

This block does not require any specific inputs.

Usage

When to Use

Use this block to retrieve a list of all characters present at a specific location.

Common Use Cases:

Managing interactions with all characters in a scene.

Displaying character information to the player.

Get Random Character

Get Random Character

The "Get Random Character" block returns a random character from the location.

Inputs

None: This block does not require any specific inputs.

Usage

When to Use

Use this block to select a random character from those present at a location.

Common Use Cases:

Creating dynamic encounters with random characters.

Adding variety to character interactions.

Get Random Item

Get Random Item

The "Get Random Item" block returns a random item from a location.

Inputs

None: This block does not require any specific inputs.

Usage

When to Use

Use this block to select a random item from those available at a location.

Common Use Cases:

Randomizing item pickups for the player.

Ensuring varied gameplay by changing available items.


Scene Manager:

Change Game State

Change Game State

The "Change Game State" block changes the current game mode to another specified mode.

Inputs

New State (new_state): The new game state to transition to.

Usage

When to Use

Use this block to switch the game's mode or state during gameplay.

Common Use Cases:

Transitioning from exploration mode to combat mode.

Changing to a different game state based on player actions or events.

Scene:

Add Assets to Window

The "Add Assets to Window" block adds a list of assets to the current asset window based on the specified classification and asset IDs.

Inputs

Classification: The type or category of assets to be added to the window. Tis can be item, character or location

Asset_ids:

A list of unique identifiers for the assets to be added. Each ID corresponds to a specific asset within the classification.

Usage

When to Use

Use this block when you need to dynamically add assets to an asset window based on their classification and IDs.

Common Use Cases:

Populating an asset window with items, characters, or other assets during game initialization or during specific events.

Updating the asset window with new assets based on player actions or game progression.

Clear View Assets

Clear View Assets

The "Clear View Assets" block clears a specific category of assets from the view.

Inputs

Classification: The type or category of assets to be cleared from the view.

Usage

When to Use

Use this block to remove assets from the asset window when they are no longer needed or to refresh the view.

Common Use Cases:

Clearing out old or used items from the view.

Resetting the asset window before adding new assets.

Parse Context Update Request

Parse Context Update Request

The "Parse Context Update Request" block parses a context update request to insert asset names or concatenated sublists into a log string.

Inputs

Asset Names (asset_names): The names of the assets to be inserted.

Log String (log_str): The log string where asset names or sublists will be inserted.

Usage

When to Use

Use this block to process context update requests and format them into a log string for display or recording.

Common Use Cases:

Creating detailed logs of context updates for debugging or player feedback.

Formatting asset names into a readable string for in-game messages.

Update Game Context

Update Game Context

The "Update Game Context" block updates the context window with a context update.

Inputs

Context Update (context_update): The context update to be applied to the context window.

Usage

When to Use

Use this block to apply changes or updates to the game context, ensuring that the context window reflects the latest game state.

Common Use Cases:

Updating the context window after significant events or player actions.

Keeping the game context current for accurate game logic and player feedback.


Narrative Manager:

Complete Objective

Complete Objective

The "Complete Objective" block completes an objective in the game.

Inputs

Objective (objective): The objective to be completed.

Usage

When to Use

Use this block to mark an objective as completed within the game.

Common Use Cases:

Progressing the game narrative when a player completes a task.

Updating the game state to reflect completed objectives.

Create Artificial Checkpoint

Create Artificial Checkpoint

The "Create Artificial Checkpoint" block creates a new checkpoint/sequence of game events based off the game's context.

Inputs

Checkpoint Schema (checkpoint_schema): The schema defining the new checkpoint.

Usage

When to Use

Use this block to generate new checkpoints dynamically based on the current game context.

Common Use Cases:

Introducing new game events or challenges.

Create Narrative Entry

Create Narrative Entry

The "Create Narrative Entry" block creates a narrative entry for the game based on the current context.

Inputs

Context (context): The current game context.

Usage

When to Use

Use this block to add new entries to the game's narrative log.

Common Use Cases:

Documenting significant events in the game.

Providing players with a record of their journey.

Evaluate Narrative Progression

Evaluate Narrative Progression

The "Evaluate Narrative Progression" block evaluates if the player has successfully reached a point in the game where the queued event makes sense to happen. It also evaluates if the player has achieved an objective.

Inputs

Context (context): The current game context.

Event (event): The event to be evaluated.

Usage

When to Use

Use this block to check if the narrative can progress based on the player's actions and the current game state.

Common Use Cases:

Determining the appropriate timing for narrative events.

Ensuring game events occur logically within the story.

Generate Interim Message

Generate Interim Message

The "Generate Interim Message" block generates an interim message to bridge the gap between the current event and the next checkpoint.

Inputs

Context (context): The current game context.

Current Event (current_event): The current event in progress.

Usage

When to Use

Use this block to provide players with updates or information during transitions between events.

Common Use Cases:

Keeping players informed about their progress.

Offering hints or story elements between major events.

Generate Status Message

Generate Status Message

The "Generate Status Message" block generates a status message for the player to understand the current event they are experiencing.

Inputs

First (first): Indicates if this is the first status message.

Message (message): Optional. Custom message content.

Usage

When to Use

Use this block to update players on their current status or situation within the game.

Common Use Cases:

Providing players with real-time updates.

Clarifying current objectives or game states.

Retrieve Current Context

Retrieve Current Context

The "Retrieve Current Context" block retrieves the current context of the game for the narrative manager.

Inputs

None: This block does not require any specific inputs.

Usage

When to Use

Use this block to get the current game context for narrative decisions and updates.

Common Use Cases:

Accessing the latest game state for narrative processing.

Ensuring narrative elements are based on up-to-date information.

UI Parser:

Construct Message

Construct Message

The "Construct Message" block constructs a message based on the component type and provided keyword arguments.

Inputs

Component Type (component_type): The type of message component to construct.

Data 1-10 (data_1, data_2, ... , data_10): Optional. Up to ten keyword arguments for constructing the message.

Usage

When to Use

Use this block to create custom messages for various UI components in your game.

Common Use Cases:

Displaying dynamic game information to the player.

Constructing notifications or alerts based on game events

Get Model Data

Get Model Data

The "Get Model Data" block gets data from an inputted model class and model ID.

Inputs

Model Class (model_class): The class of the model to retrieve data from.

Model ID (model_id): The ID of the model to retrieve.

Element Type (element_type): The type of element to retrieve from the model.

Usage

When to Use

Use this block to fetch specific data from a model for use in the UI or game logic.

Common Use Cases:

Retrieving character stats or item details for display.

Accessing specific attributes of game models for processing.

Get Multiple Model Data

Get Multiple Model Data

The "Get Multiple Model Data" block gets data from inputted model class and model IDs.

Inputs

Model Class (model_class): The class of the models to retrieve data from.

Model IDs (model_ids): The IDs of the models to retrieve.

Element Type (element_type): The type of element to retrieve from the models.

Usage

When to Use

Use this block to fetch data from multiple models simultaneously.

Common Use Cases:

Displaying a list of items or characters.

Comparing attributes across multiple models.

Update UI Component

Update UI Component

The "Update UI Component" block updates a UI component with new data.

Inputs

Component Target (component_target): The target UI component to update.

New Data (new_data): The new data to apply to the UI component.

Usage

When to Use

Use this block to refresh or update parts of the UI with new information.

Common Use Cases:

Updating health bars, score displays, or inventory lists.

Reflecting changes in game state within the UI.


Operator Blocks

Conditional Operator :

Calculate Probability

Calculate Probability

The "Calculate Probability" block calculates the probability of an event occurring and returns true or false based on the strike range.

Inputs

Strike Range (strike_range): The range to determine the probability.

Usage

When to Use

Use this block to determine the likelihood of an event occurring within the game.

Common Use Cases:

Random event generation.

Probability-based decisions in game logic.

Conditional Behavior:

If true, links to another game mode, executes the linked game chain, and then returns to the parent chain to continue executing.

Contains

Contains

The "Contains" block compares two values to see if the first value is greater than the second value and returns true or false.

Inputs

Input Data (input_data): The first value to compare.

Comparison Value (comparison_value): The second value to compare against.

Usage

When to Use

Use this block to check if one value contains or exceeds another.

Common Use Cases:

Validating inventory limits.

Checking resource availability.

Conditional Behavior:

If true, links to another game mode, executes the linked game chain, and then returns to the parent chain to continue executing.

Equals

Equals

The "Equals" block compares two values to see if they are equal and returns true or false.

Inputs

Input Data (input_data): The first value to compare.

Comparison Value (comparison_value): The second value to compare against.

Usage

When to Use

Use this block to determine if two values are identical.

Common Use Cases:

Checking for specific game states.

Validating player inputs.

Conditional Behavior:

If true, links to another game mode, executes the linked game chain, and then returns to the parent chain to continue executing.

Greater Than

Greater Than

The "Greater Than" block compares two values to see if the first value is greater than the second value and returns true or false.

Inputs

Input Data (input_data): The first value to compare.

Comparison Value (comparison_value): The second value to compare against.

Usage

When to Use

Use this block to check if one value is greater than another.

Common Use Cases:

Validating score thresholds.

Checking if resource levels exceed a certain amount.

Conditional Behavior:

If true, links to another game mode, executes the linked game chain, and then returns to the parent chain to continue executing.

Is Empty

Is Empty

The "Is Empty" block checks if the input data is empty and returns true or false.

Inputs

Input Data (input_data): The data to check for emptiness.

Usage

When to Use

Use this block to verify if a data set or collection is empty.

Common Use Cases:

Checking if inventory slots are available.

Validating if required inputs are missing.

Conditional Behavior:

If true, links to another game mode, executes the linked game chain, and then returns to the parent chain to continue executing.

Is Not Empty

Is Not Empty

The "Is Not Empty" block checks if the input data is not empty and returns true or false.

Inputs

Input Data (input_data): The data to check for non-emptiness.

Usage

When to Use

Use this block to verify if a data set or collection is not empty.

Common Use Cases:

Ensuring inventory has items.

Confirming required inputs are present.

Conditional Behavior:

If true, links to another game mode, executes the linked game chain, and then returns to the parent chain to continue executing.

Less Than

Less Than

The "Less Than" block compares two values to see if the first value is less than the second value and returns true or false.

Inputs

Input Data (input_data): The first value to compare.

Comparison Value (comparison_value): The second value to compare against.

Usage

When to Use

Use this block to check if one value is less than another.

Common Use Cases:

Validating if player stats are below a threshold.

Checking if resource levels are insufficient.

Conditional Behavior:

If true, links to another game mode, executes the linked game chain, and then returns to the parent chain to continue executing.

Objects Empty

Objects Empty

The "Objects Empty" block checks if all input objects are empty and returns true or false.

Inputs

Input Data (input_data): The objects to check for emptiness.

Usage

When to Use

Use this block to verify if multiple objects or collections are empty.

Common Use Cases:

Validating if multiple inventories are empty.

Checking if all required inputs are missing.

Conditional Behavior:

If true, links to another game mode, executes the linked game chain, and then returns to the parent chain to continue executing.

Basic Operator:

Addition

Addition

The "Addition" block adds two numbers together.

Inputs

Number 1 (number1): The first number to add.

Number 2 (number2): The second number to add.

Usage

When to Use

Use this block to perform addition operations between two numbers.

Common Use Cases:

Calculating total values.

Summing scores or points.

Build String

Build String

The "Build String" block builds a string using the provided asset names and log string.

Inputs

Asset Names (asset_names): The names of the assets to include in the string.

Log String (log_str): The log string to construct.

Usage

When to Use

Use this block to create custom strings for logs, messages, or other outputs.

Common Use Cases:

Constructing dynamic text for player notifications.

Creating logs with asset names for debugging.

Division

Division

The "Division" block divides the first number by the second number.

Inputs

Number 1 (number1): The number to be divided.

Number 2 (number2): The number to divide by.

Usage

When to Use

Use this block to perform division operations between two numbers.

Common Use Cases:

Calculating ratios or proportions.

Determining averages or per-unit values.

Generate Random Number

Generate Random Number

The "Generate Random Number" block generates a random number between the specified range.

Inputs

Minimum Value (min_value): The minimum value of the range.

Maximum Value (max_value): The maximum value of the range.

Usage

When to Use

Use this block to generate random numbers within a specified range.

Common Use Cases:

Creating random events or outcomes.

Randomizing values for game mechanics.

Multiplication

Multiplication

The "Multiplication" block multiplies two numbers together.

Inputs

Number 1 (number1): The first number to multiply.

Number 2 (number2): The second number to multiply.

Usage

When to Use

Use this block to perform multiplication operations between two numbers.

Common Use Cases:

Calculating product values.

Scaling values for game mechanics.

Subtraction

Subtraction

The "Subtraction" block subtracts the second number from the first number.

Inputs

Number 1 (number1): The number to subtract from.

Number 2 (number2): The number to subtract.

Usage

When to Use

Use this block to perform subtraction operations between two numbers.

Common Use Cases:

Calculating differences or remaining values.

Reducing quantities or scores.


Item Manager

Get Item by Name

Get Item by Name

The "Get Item by Name" block gets an item by the item primary key (PK).

Inputs

Primary Key (pk): The unique identifier for the item.

Scene (scene): Optional. The scene object where the item is located.

Usage

When to Use

Use this block to retrieve a specific item using its primary key.

Common Use Cases:

Accessing item details for display or processing.

Fetching item data for inventory management.

Item

Get Item Attribute

Get Item Attribute

The "Get Item Attribute" block gets an attribute of the item by the attribute name.

Inputs

Attribute ID (attribute_id): The ID of the attribute to retrieve.

Usage

When to Use

Use this block to access specific attributes of an item.

Common Use Cases:

Displaying item characteristics or stats.

Using item attributes in game logic or conditions.


Cache and LLM Operator Blocks

Persistent Cache

Representation

Representation

The "Representation" block returns a string representation of the PersistentCache object.

Inputs

None: This block does not require any specific inputs.

Usage

When to Use

Use this block to get a string representation of the current state of the PersistentCache.

Common Use Cases:

Debugging the cache content.

Displaying cache information for logging.

Add to Cache List

Add to Cache List

The "Add to Cache List" block adds an element to a list under the specified key, creating a new list if necessary.

Inputs

Key (key): The key under which the element will be added.

Value (value): The value to be added to the list.

Timeout (timeout): Optional. The timeout value for the element.

Usage

When to Use

Use this block to add elements to a list in the cache.

Common Use Cases:

Storing multiple related values.

Managing a list of temporary data.

Decrement Timeouts

Decrement Timeouts

The "Decrement Timeouts" block decreases the timeout value of all elements and removes those with a timeout of zero.

Inputs

None: This block does not require any specific inputs.

Usage

When to Use

Use this block to manage the lifecycle of cached elements by decreasing their timeout values.

Common Use Cases:

Automatically cleaning up expired cache entries.

Managing time-sensitive data.

Get Cache Element

Get Cache Element

The "Get Cache Element" block retrieves a cache element's value based on the key.

Inputs

Key (key): The key of the element to retrieve.

Usage

When to Use

Use this block to access specific cached values.

Common Use Cases:

Retrieving stored data for processing.

Accessing configuration or state information.

Get Entire Cache list

Get Entire Cache List

The "Get Entire Cache List" block retrieves the entire list of items based on the key.

Inputs

Key (key): The key of the list to retrieve.

Usage

When to Use

Use this block to access all elements in a cached list.

Common Use Cases:

Processing or displaying all cached items.

Managing a collection of related data.

Get From Cache List

Get from Cache List

The "Get from Cache List" block retrieves a specific item from a list based on the key and index.

Inputs

Key (key): The key of the list to access.

Index (index): The index of the item to retrieve.

Usage

When to Use

Use this block to access specific items within a cached list.

Common Use Cases:

Retrieving individual elements for processing.

Accessing indexed data in a list.

Remove Cache element

Remove Cache Element

The "Remove Cache Element" block removes a cache element based on the key.

Inputs

Key (key): The key of the element to remove.

Usage

When to Use

Use this block to delete specific cache entries.

Common Use Cases:

Cleaning up unused or obsolete data.

Managing cache size by removing elements.

Remove From Cache List

Remove from Cache List

The "Remove from Cache List" block removes a specific item from a list based on the key and index.

Inputs

Key (key): The key of the list to access.

Index (index): The index of the item to remove.

Usage

When to Use

Use this block to delete specific items from a cached list.

Common Use Cases:

Removing elements that are no longer needed.

Managing the content of cached lists.

Set Cache Element

Set Cache Element

The "Set Cache Element" block sets a cache element with the specified key, value, and optional timeout.

Inputs

Key (key): The key of the element to set.

Value (value): The value to be stored.

Timeout (timeout): Optional. The timeout value for the element.

Usage

When to Use

Use this block to store or update values in the cache.

Common Use Cases:

Caching frequently accessed data.

Temporarily storing values with a timeout.

LLM Operator

Generate Image

Generate Image

The "Generate Image" block generates an image from a prompt and returns a URL.

Inputs

Prompt (prompt): The prompt describing the image to generate.

Usage

When to Use

Use this block to create images dynamically based on textual descriptions.

Common Use Cases:

Generating visual content for game scenes.

Creating dynamic images for storytelling or events.

Get LLM Decision

Get LLM Decision

The "Get LLM Decision" block returns a list of actions based on the prompt and provided context.

Inputs

Prompt (prompt): The prompt describing the context.

Options (options): A list of options to consider.

Temperature (temperature): The creativity level for the decision-making process.

Usage

When to Use

Use this block to get decision suggestions from the language model based on a given context.

Common Use Cases:

Determining possible actions for game characters.

Generating choices for player interactions.

Get LLM response

Get LLM Response

The "Get LLM Response" block returns a response from the language model.

Inputs

Input Data (input_data): The data to be processed.

Temperature (temperature): The creativity level for the response.

System Instructions (system_instructions): Instructions for the language model.

Tokens (tokens): Optional. The maximum number of tokens for the response (default is 500).

Usage

When to Use

Use this block to generate text responses from the language model based on input data.

Common Use Cases:

Creating dialogue or narrative content.

Generating descriptions or explanations within the game.

Using to make prompts to give the Image Generation Block


Can't find what you are looking for?

Join our community and get help