
DFScript
DFScript is a client-side mod for the DiamondFire server that enables custom scripting capabilities directly within the game. This project represents an evolution and improvement over the previously discontinued CodeUtilities mod.
Mod Capabilities
The mod adds a scripting system that allows creating event-based code similar to what's used on DiamondFire, but executed on the client side. Events and actions represent simple client-side activities that can automate various processes.
For example, you can create a script that plays a sound when receiving a message mentioning the player's name, or automatically adds the @ symbol before sent messages.
Working with Scripts
To access the scripts menu, use the /scripts
command. An interface will open displaying all installed scripts, where you can enable/disable, delete, edit, and upload scripts.
Creating a new script is done through the /script
command by selecting the "New Script" option. After naming the script, it will appear in the main menu with the following available actions:
- Editing: Adding parameters and code to the script
- Uploading: Publishing the script for other players to use (without code modification capability)
- Deletion: Complete removal of the script
- Toggling: Enabling/disabling script execution (red - active, green - disabled)
Interface Controls
- Left Click: Used for clicking buttons, adding code to scripts, editing code block parameters, and selecting text fields
- Right Click: Opens context menu for code blocks with options to delete, insert code before or after the block
- Escape: Return to previous menu
- Scroll: Moving up and down through menus
Code Creation and Editing
Code can only be edited in your own scripts. Downloaded scripts can be deleted, enabled/disabled, and their settings changed, but the code remains inaccessible for editing.
All scripts start with an event, and when triggered, the code executes from top to bottom. Most code blocks require parameters for proper execution. Value types include:
- Client Values: Data related to the client (selected hotbar slot, item in hand, last received message)
- Config Values: Settings added to the script that users can change without accessing the code
Safety and Management
If you create a script that violates DiamondFire rules (such as spam), immediately leave the server. A button will appear in the top left corner of the multiplayer screen to disable scripts. Disabled scripts can be edited to fix issues.
Downloading Scripts
The script addition menu provides a catalog of scripts created by other players with search functionality. Scripts with a star have been verified and are safe to use. Unverified scripts may be dangerous and cause unwanted client actions.
Commands and Files
All DFScript commands start with /scripts
:
/scripts
- opens the main scripts menu/scripts recursion (number)
- changes the number of events that can trigger in one tick/scripts reload
- reloads all scripts/scripts vars (script name)
- shows values of all variables in the selected script
Script files are located in the %appdata%.minecraft\DFScript\Scripts
folder in JSON format. Backup is performed by copying JSON files.