### Get Server Started Time Source: https://meta.denizenscript.com/Docs/Tags/util.started_time Retrieves the time when the server was started. This tag returns a TimeTag. ```DenizenScript - flag server myflag expire: ``` -------------------------------- ### Get List Size Source: https://meta.denizenscript.com/Docs/Tags This example demonstrates how to get the number of elements in a list. ```DenizenScript - narrate ``` -------------------------------- ### Handle Specific Paths and Methods Source: https://meta.denizenscript.com/Docs/Events/webserver%20web%20request This example demonstrates how to supply a manual HTML response to specific paths ('/', '/index', '/index.html') for GET requests on port 8080. It sets the HTTP response code, content type, and the HTML content. ```Denizen Script # This example supplies a manual response to any of the "/", "/index", or "/index.html" paths. my_world_script: type: world data: index: - - Welcome to my site -

Hi!

events: on webserver web request port:8080 path:/|/index|/index.html method:get: - determine code:200 passively - determine headers:[Content-Type=text/html] passively - determine raw_text_content:]> ``` -------------------------------- ### Start WebServer Source: https://meta.denizenscript.com/Docs/Commands/webserver Use to start a webserver on a specific port. The port defaults to 8080 if not specified. ```denizenscript - webserver start port:8081 ``` -------------------------------- ### Denizen Script goto Command Usage Example Source: https://meta.denizenscript.com/Docs/Commands/goto Illustrates how to use the 'goto' command to jump forward to a location marked by 'Command:mark'. This example is intended for advanced scripters. ```denizenscript # Use to jump forward to a location. - goto potato ``` -------------------------------- ### Denizen Script Formats Example Source: https://meta.denizenscript.com/Docs/Languages/Script%20Formats Demonstrates how to define direct formats and reference separate format scripts using the 'formats' key in a Denizen task. This example shows how the 'debug' command's output can be customized. ```yaml my_project_task: type: task formats: # A direct format debug: [MyProject] <[text]> # A separate format script error_script: my_project_error script: - if > 20: # Will be formatted by the 'my_project_error' format script. - debug error "The system has been running for over 20 hours! Please restart!" - else: # Will print "[MyProject] The system does not need a restart yet." - debug "The system does not need a restart yet." ``` -------------------------------- ### Get Queue Started Time Source: https://meta.denizenscript.com/Docs/Tags Returns the time a queue was started as a duration. Useful for calculating elapsed time or setting expirations. ```DenizenScript - flag server myflag expire: ``` -------------------------------- ### Resource Pack Status Event Example Source: https://meta.denizenscript.com/Docs/Events/resource%20pack%20status This example demonstrates how to trigger a script based on the resource pack status event. It shows how to check the player and potentially use the status context. ```denizenscript on resource pack status: # Example: Check if the player accepted the resource pack if : "You accepted the resource pack!" ``` -------------------------------- ### Get Delta Time Since Start (Deprecated) Source: https://meta.denizenscript.com/Docs/Tags Retrieves the time elapsed since the server started. This tag is deprecated; use 'util.delta_time_since_start' instead. ```Denizen Script ``` -------------------------------- ### MythicMobs Targeter Example: DenizenEntity with ProcScript Source: https://meta.denizenscript.com/Docs/Languages Example of using the @DenizenEntity targeter to execute a Denizen ProcScript. ```Denizen @DenizenEntity{tag=} ``` -------------------------------- ### Repeat Loop with Custom Starting Index Source: https://meta.denizenscript.com/Docs/Commands/repeat This snippet demonstrates using the 'repeat' command with a 'from' argument to specify a starting index for the loop. The loop will run 5 times, with the counter starting at 21. ```Denizen Script # Use to announce the numbers: 21, 22, 23, 24, 25. - repeat 5 from:21: - announce "Announce Number <[value]>" ``` -------------------------------- ### Start Fishing at Player's Cursor Source: https://meta.denizenscript.com/Docs/Commands/fish Use this snippet to make an NPC start fishing at the player's current cursor location with a 50% chance of catching fish. Ensure the 'Citizens' plugin is installed. ```Denizen Script # Makes the NPC throw their fishing line out to where the player is looking, with a 50% chance of catching fish. - fish catch:fish chance:50 ``` -------------------------------- ### Get Command Plugin Name Source: https://meta.denizenscript.com/Docs/Tags Retrieves the name of the command plugin. This is a basic example of accessing server information. ```Denizen Script narrate ``` -------------------------------- ### Raid Spawns Wave Event Example Source: https://meta.denizenscript.com/Docs/Events/raid%20spawns%20wave This example demonstrates how to use the 'raid spawns wave' event to execute a script when a new wave of raiders spawns. It shows how to access raid data, the patrol leader, and the list of new raiders. ```denizenscript after raid spawns wave: <context.raid>.set_flag("last_wave_spawned") <context.leader>.damage(100) <context.new_raiders>.add(player) ``` ```denizenscript on raid spawns wave: <context.raid>.set_flag("last_wave_spawned") <context.leader>.damage(100) <context.new_raiders>.add(player) ``` -------------------------------- ### MythicMobs Targeter Example: DenizenLocation Source: https://meta.denizenscript.com/Docs/Languages Example of using the @DenizenLocation targeter to find a random sample of surface blocks within a radius. ```Denizen @DenizenLocation{tag=} ``` -------------------------------- ### MythicMobs Targeter Example: DenizenEntity Source: https://meta.denizenscript.com/Docs/Languages Example of using the @DenizenEntity targeter to find players within a radius that have a specific flag. ```Denizen @DenizenEntity{tag=} ``` -------------------------------- ### Get Server Gamerules Source: https://meta.denizenscript.com/Docs/Tags Returns a list of all available gamerules on the server. ```DenizenScript ``` -------------------------------- ### Sit Command Usage Example Source: https://meta.denizenscript.com/Docs/Commands/Sit This snippet demonstrates how to use the 'sit' command to make an NPC sit at the player's current cursor location. Ensure the 'Citizens' plugin is installed. ```denizenscript # Make the linked NPC sit at the player's cursor location. - sit ``` -------------------------------- ### Source: https://meta.denizenscript.com/Docs/Tags Returns the script that started this queue. ```APIDOC ## ### Description Returns the script that started this queue. ### Returns ScriptTag ### Generated Example ``` - narrate ``` ``` -------------------------------- ### MythicMobs Condition Example: DenizenCondition Source: https://meta.denizenscript.com/Docs/Languages Example of using a DenizenCondition to check if there are players within a radius, negating an empty check. ```Denizen denizencondition{tag=} ``` -------------------------------- ### Denizen Script goto Command Example Source: https://meta.denizenscript.com/Docs/Commands/goto Demonstrates the basic usage of the 'goto' command to jump to a marked location. The code after the 'goto' command will not be executed if the mark is reached. ```denizenscript - goto potato - narrate "This will never show" - mark potato ``` -------------------------------- ### Connect to SQL Server Source: https://meta.denizenscript.com/Docs/Commands/sql Connects to a MySQL server. Use '~sql' to hold the command until the connection is established. ```Denizen Script - ~sql id:name connect:localhost:3306/test username:space password: ``` -------------------------------- ### Get the Year from a TimeTag Source: https://meta.denizenscript.com/Docs/Tags Returns the year of this TimeTag, for example, '2020'. ```DenizenScript - narrate "the number value is " ``` -------------------------------- ### PlaceholderAPI Bridge Example: Denizen Tag Placeholder Source: https://meta.denizenscript.com/Docs/Languages Example of how to access Denizen tags using PlaceholderAPI by prefixing the tag with 'denizen_'. ```PlaceholderAPI %denizen_% ``` -------------------------------- ### Get Delta Time Since Start Source: https://meta.denizenscript.com/Docs/Tags Returns the duration of delta time since the server started, calculated based on server ticks. Use Tag:util.real_time_since_start for real time. ```DenizenScript - flag server myflag expire: ``` -------------------------------- ### Serve Favicon with Caching Source: https://meta.denizenscript.com/Docs/Events/webserver%20web%20request This example shows how to serve a favicon file from the local file path 'plugins/Denizen/webroot/favicon.ico'. It utilizes RAM caching for efficiency and responds to requests for '/favicon.ico' on any open web ports. ```Denizen Script # This example serves a favicon from the local file path "plugins/Denizen/webroot/favicon.ico" with RAM caching to any open web ports. on webserver web request path:/favicon.ico: - determine code:200 passively - determine cached_file:favicon.ico ``` -------------------------------- ### Get Range of Elements from List (Start to End) Source: https://meta.denizenscript.com/Docs/Tags Retrieves a range of elements from a list, specified by a start and end index. Supports both positive and negative indexing, as well as the 'last' keyword. ```denizenscript - narrate ``` ```denizenscript - narrate ``` ```denizenscript - narrate ``` -------------------------------- ### Get Server Real Time Since Start Source: https://meta.denizenscript.com/Docs/Tags Retrieves the duration of real time that has passed since the server was started. This is based on the system clock and may be affected by system clock changes. ```DenizenScript - flag server myflag expire: ``` -------------------------------- ### Copy an Existing World Source: https://meta.denizenscript.com/Docs/Commands/createworld This example shows how to create a new world ('dungeon3') by copying the files from an existing world ('dungeon_template'). The '~' prefix indicates that the command is waitable. ```denizenscript - ~createworld dungeon3 copy_from:dungeon_template ``` -------------------------------- ### Using the ~Waitable Prefix Source: https://meta.denizenscript.com/Docs/Languages/~waitable Demonstrates how to use the '~' prefix with a command to indicate it is waitable. This allows the command to execute without freezing the server queue. ```Denizen Script - ~run MySlowScript ``` -------------------------------- ### Create World on Server Prestart Source: https://meta.denizenscript.com/Docs/Events/server%20prestart This snippet demonstrates how to create a new world when the server prestart event is triggered. Use with caution as it executes very early in the server startup process. ```yaml on server prestart: - createworld my_extra_world ``` -------------------------------- ### NPCTag.waypoint_provider Source: https://meta.denizenscript.com/Docs/Tags Gets the NPC's current Waypoint Provider type. Common types include 'linear', 'wander', and 'guided'. ```APIDOC ## NPCTag.waypoint_provider ### Description Returns the NPC's current Waypoint Provider type (default types: linear, wander, guided). ### Returns ElementTag ### Mechanism NPCTag.waypoint_provider ### Generated Example ``` - narrate ``` ``` -------------------------------- ### Get Queue Time Ran Source: https://meta.denizenscript.com/Docs/Tags Returns the duration for which a queue has been running. This is calculated from the queue's start time to the current time. ```DenizenScript - ratelimit ``` -------------------------------- ### show_demo Source: https://meta.denizenscript.com/Docs/Mechanisms Shows the player the demo screen. ```APIDOC ## adjust show_demo ### Description Shows the player the demo screen. ### Method adjust ### Endpoint PlayerTag.show_demo ### Parameters None ### Request Example ``` - adjust show_demo ``` ``` -------------------------------- ### Get Glow Squid Dark Duration Source: https://meta.denizenscript.com/Docs/Tags Retrieves the remaining duration before a glow squid starts glowing. Useful for rate-limiting or timed actions. ```DenizenScript - ratelimit ``` -------------------------------- ### Decompress Binary Data with zlib Source: https://meta.denizenscript.com/Docs/Tags/BinaryTag.zlib_decompress Demonstrates how to compress and then decompress binary data using BinaryTag.zlib_compress and BinaryTag.zlib_decompress. Ensure the decompressed data matches the original hex representation to verify functionality. ```Denizen Script - define data - define compressed <[data].zlib_compress> - define decompressed <[data].zlib_decompress> - if <[decompressed].to_hex> == <[data].to_hex>: - narrate "Everything works!" ``` -------------------------------- ### Get Ellipsoid Center Location Source: https://meta.denizenscript.com/Docs/Tags Retrieves the central location of the ellipsoid. The example uses this to place a debug block at the ellipsoid's center. ```denizenscript - debugblock ``` -------------------------------- ### Show Workbench GUI Source: https://meta.denizenscript.com/Docs/Mechanisms Opens a workbench GUI for the player at a specified location. ```denizenscript - adjust show_workbench: ``` -------------------------------- ### Get Start of Year from TimeTag Source: https://meta.denizenscript.com/Docs/Tags Resets the date and time components to the first day of the year at midnight. Useful for setting yearly expiry times. ```DenizenScript - flag server myflag expire: ``` -------------------------------- ### Brewing Recipe Example Source: https://meta.denizenscript.com/Docs/Languages/item%20script%20containers Defines a brewing recipe. Requires a base item and an ingredient. Supports advanced matchers for input/ingredient on 1.20+. ```yaml type: brewing input: ItemTag ingredient: ItemTag ``` -------------------------------- ### Get Start of Month from TimeTag Source: https://meta.denizenscript.com/Docs/Tags Resets the date and time components to the first day of the month at midnight. Useful for setting monthly expiry times. ```DenizenScript - flag server myflag expire: ``` -------------------------------- ### Show Demo Screen Source: https://meta.denizenscript.com/Docs/Mechanisms Opens the demo screen for the player. ```denizenscript - adjust show_demo ``` -------------------------------- ### Get Current Tick Source: https://meta.denizenscript.com/Docs/Tags Returns the number of ticks since the server started. Note that this is not an accurate indicator of real server uptime due to potential lag. ```DenizenScript - narrate "the number value is " ``` -------------------------------- ### Command Syntax with List Input Source: https://meta.denizenscript.com/Docs/Languages Demonstrates how to specify an argument that accepts a list of inputs, indicated by '|...'. ```Denizen Script [|...] ``` -------------------------------- ### Get Script Container Type Source: https://meta.denizenscript.com/Docs/Tags Returns the type of script container associated with the ScriptTag object. Use this to determine if the script is a 'task' or 'world' script, for example. ```DenizenScript - narrate ``` -------------------------------- ### Get Substring After Last Occurrence Source: https://meta.denizenscript.com/Docs/Tags Returns the portion of an element that appears after the last occurrence of a specified element. For example, 'abcabc .after_last[b]' returns 'c'. ```DenizenScript abcabc .after_last[b] ``` -------------------------------- ### Get Substring After First Occurrence Source: https://meta.denizenscript.com/Docs/Tags Returns the portion of an element that appears after the first occurrence of a specified element. For example, 'HelloWorld .after[Hello]' returns 'World'. ```DenizenScript HelloWorld .after[Hello] ``` -------------------------------- ### Connect to MySQL Server Source: https://meta.denizenscript.com/Docs/Commands Connects to a MySQL server using specified credentials. It's recommended to hold the command to ensure the connection is established before proceeding. ```DenizenScript - ~sql id:name connect:localhost:3306/test username:space password: ``` ```DenizenScript - ~sql id:name connect:localhost:3306/test username:space password: ssl:true ``` ```DenizenScript - ~sql id:name connect:localhost:3306/test?characterEncoding=utf8 username:space password: ``` -------------------------------- ### Get Start of Day from TimeTag Source: https://meta.denizenscript.com/Docs/Tags Resets the time components (hour, minute, second, millisecond) to midnight of the current day. Useful for setting daily expiry times. ```DenizenScript - flag server myflag expire: ``` -------------------------------- ### Give an Item to a Specific Slot Source: https://meta.denizenscript.com/Docs/Commands/give This example shows how to use the 'give' command to place an item into a specific inventory slot. If the slot is occupied, the command will attempt to find the next available slot. ```Denizen Script # Use to give an item and place it in a specific slot if possible. - give WATCH slot:5 ``` -------------------------------- ### Get Noted Ellipsoid Name Source: https://meta.denizenscript.com/Docs/Tags Retrieves the name of a noted EllipsoidTag. Returns null if the ellipsoid is not noted. The example shows how to handle cases where the ellipsoid might not be noted. ```denizenscript - narrate "The ellipsoid you are currently in is noted as: !" ``` -------------------------------- ### show_workbench Source: https://meta.denizenscript.com/Docs/Mechanisms Shows the player a workbench GUI corresponding to a given location. ```APIDOC ## adjust show_workbench [LOCATION] ### Description Shows the player a workbench GUI corresponding to a given location. ### Method adjust ### Endpoint PlayerTag.show_workbench ### Parameters #### Path Parameters - **LOCATION** (LocationTag) - Required - The location for the workbench GUI. ### Request Example ``` - adjust show_workbench: ``` ``` -------------------------------- ### Denizen Script: Basic Clickable with Narrate Source: https://meta.denizenscript.com/Docs/Commands/clickable Generates a clickable message that narrates 'Hello there!' when clicked. The generated command is saved and can be referenced later. ```denizenscript - clickable save:my_clickable: - narrate "Hello there!" - narrate "Click ]>!" ``` -------------------------------- ### Get Biome Base Temperature Source: https://meta.denizenscript.com/Docs/Tags Retrieve the base temperature of a biome, which is crucial for calculating per-location temperatures. For example, plains biomes typically have a base temperature of '0.8'. ```DenizenScript # In a plains biome, this fills with '0.8'. - narrate "Stay warm! In a plains biome, the base temperature is !" ``` -------------------------------- ### Command Syntax with Prefix:Value Pair Source: https://meta.denizenscript.com/Docs/Languages Shows an example of an optional argument with a prefix and value, such as 'repeats:<#>'. ```Denizen Script (repeats:<#>) ``` -------------------------------- ### Get NPC Waypoint Provider Type Source: https://meta.denizenscript.com/Docs/Tags/NPCTag.waypoint_provider Retrieves the NPC's current Waypoint Provider type. Default types include linear, wander, and guided. ```Denizen Script - narrate ``` -------------------------------- ### Connect to SQL Server with SSL Source: https://meta.denizenscript.com/Docs/Commands/sql Connects to a MySQL server using an SSL-encrypted connection. Use '~sql' to hold the command until the connection is established. ```Denizen Script - ~sql id:name connect:localhost:3306/test username:space password: ssl:true ``` -------------------------------- ### playerpoints.leaders Source: https://meta.denizenscript.com/Docs/Tags Returns a list of all players known to PlayerPoints, sorted in order of point value. Use like, for example, '' to get the top 10. ```APIDOC ## playerpoints.leaders ### Description Returns a list of all players known to PlayerPoints, sorted in order of point value. Use like, for example, '' to get the top 10. ### Returns ListTag(PlayerTag) ### Example ``` - foreach as:entry: - narrate "found <[entry]>" ``` ``` -------------------------------- ### Trigger on Specific System Time with Delayed Action Source: https://meta.denizenscript.com/Docs/Events/system%20time This example demonstrates triggering a script at a specific time and then performing a delayed action, like scheduling a server restart. ```Denizen Script on system time 03:00: - announce "Daily restart in 5 minutes!" - wait 5m - adjust server restart ``` -------------------------------- ### Get Area Effect Cloud Wait Time Source: https://meta.denizenscript.com/Docs/Tags Retrieves the duration before an Area Effect Cloud starts applying potion effects. Use this to control or check the timing of effect application. ```denizenscript - ratelimit ``` -------------------------------- ### Get Raw Flag Data Source: https://meta.denizenscript.com/Docs/Languages Retrieves raw flag data for specified flags, useful for synchronizing data across servers. This example shows how to define a player's flag data. ```dScript # Gather the original data - define playerdata ``` -------------------------------- ### Send Discord Message and Save Result Source: https://meta.denizenscript.com/Docs/Commands/discordmessage This snippet sends a message and uses 'save:sent' to record the resulting DiscordMessageTag. This allows you to reference the sent message later, for example, to get its ID. ```yaml # Use to message a Discord channel and record the new message ID. - ~discordmessage id:mybot channel:1234 "Hello world!" save:sent - announce "Sent as " ``` -------------------------------- ### Gzip Compress and Decompress Binary Data Source: https://meta.denizenscript.com/Docs/Tags Demonstrates compressing binary data using gzip and then decompressing it. This snippet verifies that the compression and decompression cycle works correctly. ```denizenscript - define data - define compressed <[data].gzip_compress> - define decompressed <[data].gzip_decompress> - if <[decompressed].to_hex> == <[data].to_hex>: - narrate "Everything works!" ``` -------------------------------- ### Set Biome Water Fog Color Source: https://meta.denizenscript.com/Docs/Mechanisms/BiomeTag.water_fog_color Sets the water fog color for a specific biome. This is useful for visually altering underwater environments. The example uses a server start event to ensure the change is persistent. ```DenizenScript on server start: - adjust water_fog_color:fuchsia ``` -------------------------------- ### Teleport Player to Location with World Change Source: https://meta.denizenscript.com/Docs/Tags This example demonstrates how to teleport a player to a location while ensuring the world context is correctly maintained. It uses the 'with_world' method to explicitly set the world. ```DenizenScript - teleport ]> ``` -------------------------------- ### Command Syntax Explanation Source: https://meta.denizenscript.com/Docs/Languages Illustrates the structure of Denizen command syntax, explaining the meaning of brackets, parentheses, braces, angle brackets, and other special notations. ```Denizen Script - animatechest [] ({open}/close) (sound:{true}/false) ``` -------------------------------- ### Run a script later with a delay Source: https://meta.denizenscript.com/Docs/Commands/runlater Schedules a script named 'example' to run 3 days from the current time. ```Denizen Script - runlater example delay:3d ``` -------------------------------- ### Get WorldGuard Region World Source: https://meta.denizenscript.com/Docs/Tags Gets the WorldTag this WorldGuard region is in. Requires Depenizen and WorldGuard. ```denizenscript ``` -------------------------------- ### Global If Argument Example Source: https://meta.denizenscript.com/Docs/Languages Shows the usage of the global 'if:' meta-argument, which can be applied to any command to conditionally execute it. ```Denizen Script - stop if: ``` -------------------------------- ### Ratelimit Player by Interpolation Start Source: https://meta.denizenscript.com/Docs/Tags Applies a ratelimit to a player based on their interpolation start delay. ```DenizenScript - ratelimit ``` -------------------------------- ### Denizen Script: Choose with Default Case Source: https://meta.denizenscript.com/Docs/Commands/choose This example shows how to use the 'choose' command with a 'default' case. The default case executes if none of the other specified cases match the input option, providing a fallback mechanism. ```denizenscript # Use to choose the default case. - choose 2: - case 1: - debug log "Failure!" - default: - debug log "Success!" ``` -------------------------------- ### MobArena Arena Starts Source: https://meta.denizenscript.com/Docs/Events Triggered when a MobArena starts. Provides context for the arena. This event is cancellable. ```Denizen on mobarena arena starts: # Example usage send "A new arena has begun!" ``` -------------------------------- ### Stonecutting Recipe Example Source: https://meta.denizenscript.com/Docs/Languages/item%20script%20containers Defines a stonecutting recipe, which requires exactly one input item. ```yaml type: stonecutting input: ItemTag ``` -------------------------------- ### Source: https://meta.denizenscript.com/Docs/Tags Returns a list of all registered command names in Bukkit. ```APIDOC ## ### Description Returns a list of all registered command names in Bukkit. ### Returns ListTag ``` -------------------------------- ### Get WorldGuard Region Parent Source: https://meta.denizenscript.com/Docs/Tags Gets the parent region of this WorldGuard region, if any. Requires Depenizen and WorldGuard. ```denizenscript ``` -------------------------------- ### Smithing Recipe Example Source: https://meta.denizenscript.com/Docs/Languages/item%20script%20containers Defines a smithing recipe. For versions 1.20+, includes a template item. Optionally specifies which item properties to retain. ```yaml type: smithing template: ItemTag base: ItemTag retain: display|enchantments upgrade: ItemTag ``` -------------------------------- ### Get WorldGuard Region ID Source: https://meta.denizenscript.com/Docs/Tags Gets the ID name of a WorldGuard region. Requires Depenizen and WorldGuard. ```denizenscript ``` -------------------------------- ### Get WorldGuard Region Children Source: https://meta.denizenscript.com/Docs/Tags Gets a list of all children of a WorldGuard region. Requires Depenizen and WorldGuard. ```denizenscript ``` -------------------------------- ### Set Knowledge Book Recipes Source: https://meta.denizenscript.com/Docs/Mechanisms Sets the item's knowledge book recipe list. Recipes should be in the Namespace:Key format, for example 'minecraft:gold_nugget'. ```denizenscript - adjust knowledge_book_recipes:"minecraft:iron_sword,minecraft:stone_pickaxe" ``` -------------------------------- ### Get Plugin Name Source: https://meta.denizenscript.com/Docs/Tags Retrieves the name of the plugin. This is a straightforward way to get the plugin's identifier. ```DenizenScript - narrate ``` -------------------------------- ### Load a YAML File Source: https://meta.denizenscript.com/Docs/Commands/yaml Loads a YAML file from disk into memory. Use the '~' prefix for waitable syntax to avoid server lockup during file I/O. The file path is relative to the 'plugins/Denizen' directory. An ID is required to reference this object. ```yaml - ~yaml load:myfile.yml id:myfile ``` -------------------------------- ### Get Material Heights (Deprecated) Source: https://meta.denizenscript.com/Docs/Tags Deprecated property to get material heights. Use 'sides' instead. ```DenizenScript - foreach as:entry: - narrate "found <[entry]>" ``` -------------------------------- ### Sort List with Context Source: https://meta.denizenscript.com/Docs/Tags This example shows how to sort a list while providing additional context to the sorting procedure. Refer to ListTag.sort for general sorting details. ```DenizenScript # Narrates "a|b", then "c|d", then "e|f" ``` ```DenizenScript - foreach as:sublist: ``` ```DenizenScript - narrate <[sublist]> ``` -------------------------------- ### Get Ellipsoid Size Source: https://meta.denizenscript.com/Docs/Tags Retrieves the size of an ellipsoid as a LocationTag. Use this to get the dimensions of a defined ellipsoid. ```denizenscript - narrate "The size of the ellipsoid 'my_ellipsoid' is: !" ``` -------------------------------- ### Denizen Format Script Container Example Source: https://meta.denizenscript.com/Docs/Languages/Format%20Script%20Containers Defines a basic format script container named 'Format_Script_Name'. It specifies the 'format' key, which uses '<[text]>' to hold the message content being sent, prefixed by '[MyProject]'. ```yaml Format_Script_Name: type: format # The only key is the format. The format can use '<[text]>' as a special def to contain the message being sent. # | All format scripts MUST have this key! format: [MyProject] <[text]> ``` -------------------------------- ### Interact Script Container Example Source: https://meta.denizenscript.com/Docs/Languages Handles NPC triggers and interactions. It requires a 'steps' key, with the first step defined as '1', 'default', or containing a '*'. Commands within steps may have a delay unless overridden. ```yaml Interact_Script_Name: type: interact steps: 1: click trigger: script: - some commands # Other triggers here ``` -------------------------------- ### Get Knowledge Book Recipes Source: https://meta.denizenscript.com/Docs/Tags Iterates through and narrates the recipes unlocked by a knowledge book item. Recipes are in Namespace:Key format. ```DenizenScript - foreach as:entry: - narrate "found <[entry]>" ``` -------------------------------- ### ListTag.random Source: https://meta.denizenscript.com/Docs/Tags Gets a random item or multiple random items from the list. Optionally, specify a number to get multiple random entries. ```APIDOC ## )]> ### Description Gets a random item in the list and returns it. Optionally, add [<#>] to instead get a list of multiple randomly chosen list entries. ### Method ListTag.random ### Parameters #### Path Parameters - **(Optional) <#>** (Integer) - The number of random items to select. ### Response #### Success Response (200) - **ObjectTag** - A randomly selected item or a list of randomly selected items. ### Example ``` # Narrates EITHER "one" OR "two" - different each time! - narrate "" ``` ### Example ``` # Could narrate "one|two", "two|three", OR "one|three" - different each time! - narrate "" ``` ### Example ``` # Could narrate "one|two|three", "one|three|two", "two|one|three", "two|three|one", "three|two|one", OR "three|one|two" - different each time! - narrate "" ``` ``` -------------------------------- ### 2x2 Shaped Recipe Example Source: https://meta.denizenscript.com/Docs/Languages/item%20script%20containers Defines a shaped crafting recipe using a 2x2 grid. ```yaml type: shaped input: - ItemTag|ItemTag - ItemTag|ItemTag ``` -------------------------------- ### Task Script Container Example Source: https://meta.denizenscript.com/Docs/Languages A simple task script demonstrating the 'type: task' declaration and basic script entries with 'narrate' commands. ```yaml a haiku script: type: task script: - narrate "A simple script," - narrate "with a key value relationship." - narrate "Oh look, a list!" ``` -------------------------------- ### Get WorldGuard Region Members Source: https://meta.denizenscript.com/Docs/Tags Gets a list of all members of a WorldGuard region. Members are permitted to build, etc. Requires Depenizen and WorldGuard. ```denizenscript ``` -------------------------------- ### Get Entity Eye Height Source: https://meta.denizenscript.com/Docs/Tags Returns the height of the entity's eyes above its location. Use this to get a numerical value for eye height. ```DenizenScript - narrate "the number value is " ``` -------------------------------- ### Execute Denizen Script Source: https://meta.denizenscript.com/Docs/Languages Use '/ex' to run a Denizen script. Each execution creates a new queue, so definitions are lost immediately. For sustained queues, use '/exs'. ```bash /ex flag test_flag:! ``` ```bash /ex run npc_walk_script ``` ```bash /ex narrate player:<[aplayer]> 'Your health is .' ``` ```bash /ex walk npc:<[some_npc]> ``` -------------------------------- ### Get Player Client Options Source: https://meta.denizenscript.com/Docs/Tags Retrieves a map of the player's client options, including settings like server listings, chat visibility, locale, and skin parts. Requires Paper. ```denizenscript - foreach key:key as:val: - narrate "<[key]> is set as <[val]>" ``` -------------------------------- ### Get Key Value from Redis Source: https://meta.denizenscript.com/Docs/Commands/Redis Use to retrieve the value of a key from the Redis server using the 'get' command. The result is saved. ```Denizen Script - ~redis id:name "command:get my_key" save:result ``` -------------------------------- ### Set Display Entity Interpolation Start Delay Source: https://meta.denizenscript.com/Docs/Mechanisms/entitytag. Sets the delay between a display entity receiving an update to an interpolated value and it starting its interpolation. ```denizenscript - adjust interpolation_start:1m ``` -------------------------------- ### Format Script Container Example Source: https://meta.denizenscript.com/Docs/Languages Used for formatting messages, this script container requires a 'format' key. It allows embedding the message content using '<[text]>'. ```yaml Format_Script_Name: type: format format: [MyProject] <[text]> ``` -------------------------------- ### Shapeless Recipe Example Source: https://meta.denizenscript.com/Docs/Languages/item%20script%20containers Defines a shapeless crafting recipe. Optionally specifies a category like 'misc', 'building', 'redstone', or 'equipment'. ```yaml type: shapeless category: misc input: ItemTag|... ``` -------------------------------- ### Start Sneaking Source: https://meta.denizenscript.com/Docs/Commands/sneak Use this snippet to make the linked NPC start sneaking. This command directly affects the entity's state. ```yaml # Make the linked NPC start sneaking. - sneak ``` -------------------------------- ### Source: https://meta.denizenscript.com/Docs/Tags Returns a list of commands waiting in the queue. ```APIDOC ## ### Description Returns a list of commands waiting in the queue. ### Returns ListTag ### Generated Example ``` - foreach as:entry: - narrate "found <[entry]>" ``` ``` -------------------------------- ### Get NPC Distance Margin Source: https://meta.denizenscript.com/Docs/Tags Retrieves the NPC's current pathfinding distance margin. This defines how close the NPC needs to get to its destination. ```DenizenScript - narrate "the decimal value is " ``` -------------------------------- ### Get Last Element(s) of a List Source: https://meta.denizenscript.com/Docs/Tags Returns the last element(s) in the list. If the list is empty, returns null. Optionally specify a number of entries to get. ```DenizenScript # Narrates "three" - narrate ``` ```DenizenScript # Narrates a list of "two" and "three" - narrate ``` ```DenizenScript # Narrates a list of "one", "two", and "three" - narrate ``` ```DenizenScript # Causes an error, as the list is empty. - narrate ``` -------------------------------- ### Defining Secrets in secrets.secret File Source: https://meta.denizenscript.com/Docs/ObjectTypes/secrettag This is an example of how to define secret keys and their corresponding values in the 'secrets.secret' file. The '!SECRETS_FILE' prefix is mandatory. Comments can be added using '#'. ```yaml !SECRETS_FILE my_bot_token: abc123.123abc my_api_key: 1a2b3c4d5e6f ``` -------------------------------- ### Control Entity Interpolation Source: https://meta.denizenscript.com/Docs/Languages Start or control interpolation for entity properties like scale, translation, and rotation. Set the duration and start delay as needed. ```DenizenScript - define my_entity - inject my_entity.interpolation_start[1s] - inject my_entity.interpolation_duration[5s] - inject my_entity.scale[1.5] - inject my_entity.translation[0,1,0] - inject my_entity.shadow_radius[0.5] - inject my_entity.shadow_strength[0.8] - inject my_entity.opacity[0.5] - inject my_entity.left_rotation[0,0,0] - inject my_entity.right_rotation[0,0,0] ``` -------------------------------- ### Denizen Script While Loop Example Source: https://meta.denizenscript.com/Docs/Commands/while This snippet demonstrates how to use the 'while' command to loop until a player stops sneaking and remains online. It includes a delay and narration within the loop. Note that 'waituntil' is often a more suitable alternative for such scenarios. ```denizenscript # Use to loop until a player sneaks, or the player goes offline. (Note: generally use 'waituntil' for this instead) - while ! && : - narrate "Waiting for you to sneak..." - wait 1s ``` -------------------------------- ### Create Ellipsoid at Location with Size Source: https://meta.denizenscript.com/Docs/Tags This example creates an EllipsoidTag centered at the player's current location with a specified size defined by X, Y, and Z values. ```DenizenScript - ]> ``` -------------------------------- ### Start Typing Indicator Source: https://meta.denizenscript.com/Docs/Commands/discord Use this snippet to make the bot start typing in a specific Discord channel. This requires specifying the target channel. ```yaml # Use to start typing in a specific channel. - ~discord id:mybot start_typing channel:<[channel]> ``` -------------------------------- ### server.gamerules Source: https://meta.denizenscript.com/Docs/Tags Returns a list of all available gamerules on the server. ```APIDOC ## server.gamerules ### Description Returns a list of all available gamerules on the server. ### Returns ListTag ``` -------------------------------- ### Get WorldGuard Region Owners Source: https://meta.denizenscript.com/Docs/Tags Gets a list of all owners of a WorldGuard region. Owners are permitted to build, edit settings, etc. Requires Depenizen and WorldGuard. ```denizenscript ``` -------------------------------- ### Potion Effect Format Example Source: https://meta.denizenscript.com/Docs/Languages Provides an example of how potion effects are represented as a map tag in DenizenScript. This includes effect type, amplifier, duration, and particle/icon settings. ```DenizenScript [effect=speed;amplifier=2;duration=10s;ambient=false;particles=true;icon=true] ``` -------------------------------- ### Iterate SQL Connections Source: https://meta.denizenscript.com/Docs/Tags Iterates through a list of all SQL connections opened by Command:sql. ```DenizenScript - foreach as:entry: - narrate "found <[entry]>" ``` -------------------------------- ### Get Note Block Tone Source: https://meta.denizenscript.com/Docs/Tags Retrieves the tone of the note played from a note block, represented as a letter (A-F) possibly with a sharp (#). Use this to get the musical tone name. ```DenizenScript - narrate ``` -------------------------------- ### Furnace Recipe Example Source: https://meta.denizenscript.com/Docs/Languages/item%20script%20containers Defines a furnace recipe with optional cook time, category, and experience reward. Supports furnace, blast, smoker, and campfire types. ```yaml type: furnace cook_time: 1s category: misc experience: 5 input: ItemTag ``` -------------------------------- ### Base64 Encoded Texture Data Example Source: https://meta.denizenscript.com/Docs/Languages/Player%20Entity%20Skins%20%28Skin%20Blobs%29 This is an example of the Base64 encoded 'texture' data found within a skin blob. It represents a JSON object containing skin details. ```text eyJ0aW1lc3RhbXAiOjE1NjU1NjUyNDA4NTMsInByb2ZpbGVJZCI6IjQ2MGU5NmI5N2EwZTQxNmRiMmMzNDUwODE2NGI4YjFiIiwicHJvZmlsZU5hbWUiOiJtY21vbmtleTRldmEiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2ZkMzRiM2UyN2EzZmU1MzgyN2IzN2FkNTk1NmFjY2EwOGYyODYzYzY5MjZjYzk3MTE2ZGRhMzM0ODY5N2E1YTkifX19 ``` -------------------------------- ### Create MapTag Definitions Source: https://meta.denizenscript.com/Docs/Commands/define Definitions support nested MapTags, allowing you to create structured data. This example defines a root map and then sets values for keys within it, demonstrating access and key listing. ```Denizen Script # Use to make a MapTag definition and set the value of a key inside. - define myroot.mykey MyValue - define myroot.myotherkey MyOtherValue - narrate "The main value is <[myroot.mykey]>, and the map's available key set is <[myroot].keys>" ``` -------------------------------- ### Define and Reuse Script Arguments Source: https://meta.denizenscript.com/Docs/Commands/define Store script arguments in definitions for repeated use within a single script. This example defines the first argument and then checks its value against 'hello' and 'goodbye'. ```Denizen Script # Use to keep the value of a tag that you might use many times within a single script. - define arg1 - if <[arg1]> == hello: - narrate Hello! - else if <[arg1]> == goodbye: - narrate Goodbye! ``` -------------------------------- ### Delta Time Event Trigger Example Source: https://meta.denizenscript.com/Docs/Events/delta%20time This example shows how to trigger a Denizen script event based on the delta time in seconds. The 'every' switch can be used to control the frequency of the trigger. ```Denizen Script on delta time secondly: # Your script logic here ``` ```Denizen Script on delta time secondly every:5: # Your script logic here, runs every 5 seconds ``` -------------------------------- ### Define and Access Script Definition Source: https://meta.denizenscript.com/Docs/Tags Demonstrates defining a variable 'x' and accessing it. The tag can read definitions from the current queue, returning the most-valid type. ```DenizenScript - define x 3 - \@debug <[x]> ``` -------------------------------- ### Get Entity Size or Pufferfish State Source: https://meta.denizenscript.com/Docs/Tags Returns the size of a slime-type entity or a Phantom (1-120). For PufferFish, it returns the puff state (0-3). Use this to get numerical data about the entity's state. ```DenizenScript - narrate "the number value is " ``` -------------------------------- ### Add Mobs to Team Source: https://meta.denizenscript.com/Docs/Commands/team This example demonstrates adding multiple mobs within a certain radius to a team. ```denizenscript # Use to add some mob to a team. - team name:blue add: ``` -------------------------------- ### Get NPC Path Distance Margin Source: https://meta.denizenscript.com/Docs/Tags Retrieves the NPC's current pathfinding distance margin, which defines how close the NPC needs to get to individual points along its path. This affects pathfinding precision. ```DenizenScript - narrate "the decimal value is " ``` -------------------------------- ### Query SQL Server - Select All Source: https://meta.denizenscript.com/Docs/Commands/sql Executes a SELECT query on the SQL server and saves the results. Use '~sql' to hold the command until the query is complete. ```Denizen Script - ~sql id:name "query:SELECT id,column_name1,column_name2 FROM things;" save:saveName - narrate ``` -------------------------------- ### Apply Hex Rainbow Colors to Text Source: https://meta.denizenscript.com/Docs/Tags Applies RGB rainbow colors to an element. Optionally specify the length for color repetition. If the element starts with a hex color code, it's used as the starting color. ```DenizenScript - narrate ``` -------------------------------- ### Serve Favicon from Local Path Source: https://meta.denizenscript.com/Docs/Events Handles requests for '/favicon.ico' by serving it from the local file system with RAM caching. This is useful for providing a consistent favicon across web requests. ```DenizenScript on webserver web request path:/favicon.ico: - determine code:200 passively - determine cached_file:favicon.ico ``` -------------------------------- ### Create Clickable Text (Command) Source: https://meta.denizenscript.com/Docs/Tags Generates clickable text that executes a command when clicked. The command should start with '/' for execution, otherwise it will be displayed as chat. This tag must be followed by an <&end_click> tag. ```DenizenScript - narrate "You can <&click[wow]>click here<&end_click> to say wow!" ``` ```DenizenScript - narrate "You can <&click[/help]>click here<&end_click> for help!" ``` -------------------------------- ### Execute Bungee Command Source: https://meta.denizenscript.com/Docs/Commands Runs a command on the Bungee proxy server or as a specific player. Works similarly to 'execute as_server'. ```Denizen - bungeeexecute "alert Network restart in 5 minutes..." ``` -------------------------------- ### Custom Script Container Example Source: https://meta.denizenscript.com/Docs/Languages Defines a custom script container with optional 'inherit', 'tags', and 'mechanisms' keys. Use 'tags' for scripted tags and 'mechanisms' for scripted mechanisms. Tags and mechanisms should not change external state. ```yaml Custom_Script_Name: type: custom inherit: some_object some_field: some_value tags: my_tag: - determine 3 mechanisms: my_mech: - adjust true_value: save:new_val - determine ```