### Instruction Formatting (Denizen) Source: https://guide.denizenscript.com/_sources/guides/put-it-together/kill-quest.md This example shows a custom format for instructional text in Denizen, making it visually distinct. It uses color and italic tags to apply formatting to enclosed text, improving the readability and presentation of instructions to the player. ```denizenscript instruction_format: type: format # Light Gray + Italic # Can also be written like format: <&7><&o>[<[text]><&7><&o>] ``` -------------------------------- ### Good Denizen Script Example Source: https://guide.denizenscript.com/_sources/guides/this-guide/sample-scripts.md This is a 'Good' script, indicated by a green outline. It is ready to be used in a server as-is, though its practical utility may vary. It demonstrates basic Denizen task script syntax. ```dscript_green my_good_script: type: task script: - narrate "This script can be dropped in!" ``` -------------------------------- ### Good Denizen Script Example Source: https://guide.denizenscript.com/guides/this-guide/sample-scripts This is a 'Good' script, indicated by a green outline. It is ready to be used on a server as-is, though its functionality might be limited. It demonstrates a basic 'narrate' command in Denizen scripting language. ```yaml my_good_script: type: task script: - narrate "This script can be dropped in!" ``` -------------------------------- ### Denizen Base Tags Source: https://guide.denizenscript.com/_sources/guides/first-steps/tags.md Shows examples of Denizen base tags, which form the starting point of any tag. These tags retrieve fundamental objects or information, such as player data or server details. ```Denizen ``` -------------------------------- ### Execute Denizen Command In-Game Source: https://guide.denizenscript.com/_sources/guides/first-steps/ex-command.md The `/ex` server command allows you to run Denizen commands directly from the in-game chat. This is useful for testing and simple command execution. It processes the rest of your input as a Denizen command. For example, `/ex narrate "hi "` will output 'hi' followed by the player's name to their chat. ```plaintext /ex narrate "hi " ``` -------------------------------- ### Denizen Basic 'warp' Command Example Source: https://guide.denizenscript.com/guides/basics/player-commands An example of a simple Denizen command script. This script defines a 'warp' command that, when executed, narrates a predefined message to the player. It demonstrates filling out the required fields for a command script. ```yaml warp_command: type: command name: warp description: Warps you to magical places. usage: /warp permission: dscript.warp script: - narrate "<&[base]>This is where my command will go!" ``` -------------------------------- ### Correct Constructor Tag Usage Example Source: https://guide.denizenscript.com/guides/troubleshooting/common-mistakes Demonstrates the correct application of constructor tags for specifying object types when necessary, such as in the 'note' command. ```Denizen - note as:my_inv_ ``` -------------------------------- ### Get Selection Tool (Denizen Convenience Script) Source: https://guide.denizenscript.com/guides/advanced/notables Gives the player the 'magic wand' tool used with the area selection convenience script. This tool allows for interactive selection of areas by left-clicking to start and right-clicking to expand. ```Denizen /seltool ``` -------------------------------- ### Opening an Inventory Menu (Denizen) Source: https://guide.denizenscript.com/guides/put-it-together/inventory-guis Demonstrates how to open a defined inventory script using the `/ex` command in Denizen. This allows players to interact with the created GUI. ```plaintext /ex inventory open d:my_inventory_script ``` -------------------------------- ### Denizen Tag Example: Teleport NPC Source: https://guide.denizenscript.com/guides/first-steps/tags Provides an example of a Denizen script line using tags to teleport an NPC to the player's location. It combines the '' tag to identify the NPC and '' to get the player's coordinates. ```Denizen Script - teleport ``` -------------------------------- ### Give Item to Noted Inventory Source: https://guide.denizenscript.com/guides/advanced/notables Items can be added to a noted inventory using commands like 'give'. This example adds a stick to the inventory noted as 'my_inv_note'. ```denizen /ex give stick to:my_inv_note ``` -------------------------------- ### Build Denizen using Maven Source: https://guide.denizenscript.com/guides/contributing/building This command initiates the build process for the Denizen project using Maven. After cloning the repository and opening it in IntelliJ IDEA, this step compiles the project and generates the necessary JAR file. The output JAR will be located in the 'target' folder. ```bash mvn clean install -DskipTests ``` -------------------------------- ### Build Spigot using BuildTools Source: https://guide.denizenscript.com/guides/contributing/building This command builds Spigot using the BuildTools utility. It's essential for ensuring compatibility and proper integration with Denizen. Ensure you have Java and BuildTools.jar available. The --rev argument specifies the Spigot version, and --remapped ensures proper class remapping. ```shell java -jar BuildTools.jar --rev 1.21.1 --remapped ``` -------------------------------- ### Adjust Noted Inventory Title Source: https://guide.denizenscript.com/guides/advanced/notables The 'adjust' command allows modification of properties of an existing noted object. This example changes the title of a previously noted inventory. ```denizen /ex adjust title:NewTitle ``` -------------------------------- ### Bash Command Syntax Example Source: https://guide.denizenscript.com/_sources/guides/this-guide/dev-faq.md Demonstrates the command-line syntax of Bash, where a command is followed by arguments, and special characters like '$' indicate variable lookups. ```bash ls -la $FOLDER ``` -------------------------------- ### DenizenScript Item Script with Custom Model Data Source: https://guide.denizenscript.com/guides/non-denizen/resource-packs An example of a DenizenScript item script that assigns a custom_model_data value to a 'wooden_sword' material, linking it to a custom model. ```yaml UberSword: type: item material: wooden_sword mechanisms: custom_model_data: 1 ``` -------------------------------- ### Denizen Task Script Example: Queue Demo Source: https://guide.denizenscript.com/_sources/guides/basics/queues.md A Denizen task script demonstrating the behavior of queues. This script defines a task that generates a random number, narrates information about the queue and the chosen number, waits for 5 seconds, and then narrates again. It highlights how each queue instance will have its own ID and unique random number. ```dscript_green queue_demo: type: task script: - define choice - narrate " is an instance of and chose <[choice]>" - wait 5s - narrate " remembers that it chose <[choice]>" ``` -------------------------------- ### Quest Giver Assignment Script Source: https://guide.denizenscript.com/guides/put-it-together/item-quest This script defines how the quest giver NPC is assigned and what triggers activate its interaction. It includes triggers for when a player clicks, chats with, or gets close to the NPC. ```yaml item_questgiver_assign: type: assignment actions: on assignment: - trigger name:click state:true - trigger name:chat state:true - trigger name:proximity state:true radius:10 interact scripts: - item_questgiver_interact ``` -------------------------------- ### Registering a Basic Tag in Java Source: https://guide.denizenscript.com/_sources/guides/contributing/property-dev.md Demonstrates how to register a custom tag in Java for Denizen. It explains the `registerTag` method, its parameters, and provides a simple 'Hello, world!' example. This is foundational for adding new tag functionality. ```java tagProcessor.registerTag(ElementTag.class, "tag_name", (attribute, object) -> { return new ElementTag("Hello, world!"); }); ``` -------------------------------- ### Compare Items Using '.material.name' in Denizen Source: https://guide.denizenscript.com/_sources/guides/troubleshooting/common-mistakes.md This example shows how to safely compare items by checking their '.material.name' property, which is guaranteed to return only the material name. This method is robust against changes in item identification format. ```dscript_blue - if == diamond_sword: - narrate "You have a diamond sword!" ``` -------------------------------- ### Java Example: Registering Player UUID Tag with Meta Documentation Source: https://guide.denizenscript.com/_sources/guides/contributing/property-dev.md This Java code demonstrates how to register a custom tag for Denizen scripts, including its meta documentation. It shows how to define the tag's attribute, return type, and description, and how to implement the tag's logic. ```java // <--[tag] // @attribute )]> // @returns ElementTag // @description // Returns the UUID of the player in uppercase. // Optionally specify whether the UUID should be repeated once. // --> tagProcessor.registerTag(ElementTag.class, "uuid_uppercase", (attribute, object) -> { String uuid = object.getUUID().toString().toUpperCase(); if (attribute.hasParam() && attribute.getParamElement().asBoolean()) { uuid = uuid + " " + uuid; } return new ElementTag(uuid); }); ``` -------------------------------- ### Give Custom Item using /ex Command (DenizenScript) Source: https://guide.denizenscript.com/_sources/guides/non-denizen/resource-packs.md This command demonstrates how to directly give a custom item with specific NBT data to yourself or another player using the DenizenScript '/ex' command. It's useful for testing and one-off item acquisitions. ```text /ex give wooden_sword[custom_model_data=1] ``` -------------------------------- ### Raw object comparison in Denizen Source: https://guide.denizenscript.com/_sources/guides/troubleshooting/common-mistakes.md An example of raw object comparison in Denizen, where an item in hand is compared directly to a specific item type. This method is prone to errors due to changing item properties. ```dscript - if == i@diamond_sword: - narrate "You have a diamond sword!" ``` -------------------------------- ### Opening an Inventory GUI Menu with /ex Command Source: https://guide.denizenscript.com/_sources/guides/put-it-together/inventory-guis.md Demonstrates how to open a Denizen inventory GUI menu using the '/ex' command. It specifies the 'inventory open' command with the 'd:' (destination) tag pointing to the inventory script name. ```dscript_blue /ex inventory open d:my_inventory_script ``` -------------------------------- ### Quest Counter Initialization (Denizen) Source: https://guide.denizenscript.com/_sources/guides/put-it-together/kill-quest.md This code demonstrates initializing a quest counter flag in Denizen. It sets a player-specific flag, 'kill_zombie_quest_count', to zero when a quest is accepted, providing a starting point for tracking quest progress. ```denizenscript - flag player kill_zombie_quest_count:0 ``` -------------------------------- ### Denizen Script Generic Inventory Constructor Example Source: https://guide.denizenscript.com/_sources/guides/advanced/notables.md Illustrates the usage of a generic inventory constructor to create an inventory with a size of 27 and the title 'MyInv'. This is a less verbose alternative to inventory scripts for quick testing. ```dscript ``` -------------------------------- ### Procedure Script Example: Extracting Fruits from a Sentence Source: https://guide.denizenscript.com/_sources/guides/basics/procedures.md This DScript Green procedure defines a script named 'get_fruits' that performs the same logic as the task version: splitting a message and filtering for fruits. The 'proc_example' event then directly calls this procedure on player chat, retrieving a random fruit from the returned list and narrating it. This demonstrates the simpler syntax for procedures when a return value is the primary goal. ```dscript_green get_fruits: type: procedure definitions: message script: - determine <[message].split.filter[is_in[orange|apple|banana]]> proc_example: type: world events: on player chats: # read out the sentence - narrate "No way, I like too!" ``` -------------------------------- ### Denizen Tag Fallback Examples Source: https://guide.denizenscript.com/_sources/guides/troubleshooting/common-mistakes.md Demonstrates how to use fallbacks with Denizen tags to handle expected failures or provide default values. Fallbacks like `.if_null` and `.exists` can prevent errors and ensure smooth script execution. ```dscript - if <[target]> == null: # Handle case of invalid player input - if : # Check if player's held item is scripted ``` -------------------------------- ### Using Basic Denizen Tags Source: https://guide.denizenscript.com/_sources/guides/first-steps/tags.md Demonstrates fundamental tag usage in Denizen scripts, including accessing player names and locations, and teleporting entities. These examples illustrate how tags dynamically insert information into commands. ```Denizen - ex narrate "hi " - teleport ``` -------------------------------- ### DenizenScript Interact Script Example Source: https://guide.denizenscript.com/_sources/guides/npcs/interact-scripts.md A sample DenizenScript interact script demonstrating a click trigger and multi-step interaction. It uses 'chat' to send messages to the player and 'zap' to navigate between steps. This script is designed to be assigned to an NPC. ```dscript_green my_assignment: type: assignment actions: on assignment: - trigger name:click state:true interact scripts: - my_interact my_interact: type: interact steps: 1: click trigger: script: - chat "Hello, !" - zap 2 2: click trigger: script: - chat "Hello part 2, !" - zap * ``` -------------------------------- ### Denizen Task Script Example: Queue Demonstration Source: https://guide.denizenscript.com/guides/basics/queues This Denizen task script demonstrates the concept of queues by defining a sequence of actions. It includes defining a random choice, narrating queue and script information, and waiting for a duration. This script is intended to be run multiple times rapidly to observe independent queue execution. ```Denizen queue_demo: type: task script: - define choice - narrate " is an instance of and chose <[choice]>" - wait 5s - narrate " remembers that it chose <[choice]>" ``` -------------------------------- ### Denizen Proximity Trigger Script Example Source: https://guide.denizenscript.com/_sources/guides/npcs/proximity-trigger.md A sample Denizen script demonstrating the implementation of proximity triggers within an assignment and interact script. It includes actions for player entry, exit, and movement within a specified radius. ```dscript my_assignment: type: assignment actions: on assignment: - trigger name:proximity state:true radius:10 interact scripts: - my_interact my_interact: type: interact steps: 1: proximity trigger: entry: script: - chat "Hello, !" exit: script: - chat "Farewell, !" move: script: - ratelimit 10s - chat "Still hanging around, ?" ``` -------------------------------- ### Denizen Command Syntax Example Source: https://guide.denizenscript.com/_sources/guides/this-guide/dev-faq.md Illustrates Denizen's Command+Tag syntax, showing a command ('narrate') followed by arguments and a tag lookup for targets, similar to Bash's structure. ```denizen narrate "hello there!" targets:<[players]> ``` -------------------------------- ### Safe Exact-Same Object Comparison in Denizen Source: https://guide.denizenscript.com/_sources/guides/troubleshooting/common-mistakes.md This example illustrates a safe direct comparison between two objects that refer to the exact same entity. It's applicable when both objects are obtained from valid source tags, ensuring that identifier changes apply equally to both. ```dscript_blue - if <[target]> == : - run pay command logic ``` -------------------------------- ### Denizen Color Tags Example Source: https://guide.denizenscript.com/_sources/guides/first-steps/tags.md Illustrates the use of Denizen's color tags for text formatting. It shows various ways to apply color, including short codes, color names, and element-based coloring, highlighting Denizen's flexibility. ```Denizen <&7> <&color[gray]> ```