Skip to content

Syntax Reference

firesmasher-c6 edited this page Jun 20, 2026 · 2 revisions

Syntax Reference

Complete reference for all Coder scripting syntax and commands.


📖 Table of Contents

  1. Basic Commands
  2. Variables
  3. Control Flow
  4. Functions
  5. Data Types
  6. Operators
  7. Comments

Basic Commands

Broadcasting Messages

Send a message to ALL players on the server:

broadcast "Your message here"
broadcast "Welcome to {serverName}!"

Output: Message appears in chat for all players


Sending to Specific Players

Send message to specific player(s):

send "Message" to PlayerName
send "Admin alert!" to Admin
send "Welcome!" to Steve

Note: Player name is case-sensitive. Use exact username.


Console Logging

Log messages to server console:

console.log "Debug message"
console.log "Player count: {playerCount}"
 
# Multi-line console logging
console.log {
    This is a multi-line
    console message
    Very useful for debugging
}

Output: Message appears in server console only (not in-game)


Command Execution

Execute server commands:

execute command "say Hello everyone!" in console
execute command "give Steve diamond 64" in console
execute command "tp Steve 0 64 0" in console

Format: execute command "command_here" in console


Variables

Variable Declaration

Create and store values:

var playerCount = 5
var serverName = "My Awesome Server"
var version = "1.0"
var enabled = true

Variable Usage

Use variables in messages:

var players = 10
var maxPlayers = 20
 
broadcast "Players online: {players}/{maxPlayers}"
broadcast "Server: {serverName}"
console.log "Version: {version}"

Variable Types

Type Example Usage
String "Hello" Text messages, player names
Number 42, 3.14 Counts, durations, scores
Boolean true, false On/off flags, conditions
List [1, 2, 3] Multiple values

Example: Complete Script with Variables

var serverName = "Creative Hub"
var ownerName = "Admin"
var maxPlayers = 50
var version = "2.1"
 
broadcast "════════════════════════════"
broadcast "Welcome to {serverName}!"
broadcast "Owner: {ownerName}"
broadcast "Version: {version}"
broadcast "Max Players: {maxPlayers}"
broadcast "════════════════════════════"

Control Flow

If Statements

Execute code conditionally:

if playerCount is 0:
    broadcast "Server is empty!"

If-Else Statements

if playerCount is 0:
    broadcast "No players online"
else:
    broadcast "Players are online!"

If-Else If-Else Chains

if playerCount is 0:
    broadcast "Server is empty"
else if playerCount is 1:
    broadcast "Only 1 player online"
else if playerCount > 5:
    broadcast "Server is full!"
else:
    broadcast "Few players online"

Comparison Operators

if value is 10:           # Equal to
if value is not 10:       # Not equal
if value > 5:             # Greater than
if value < 20:            # Less than
if value >= 10:           # Greater or equal
if value <= 20:           # Less or equal
if enabled is true:       # Boolean check
if name contains "Steve": # String contains

Functions

Custom Functions

Define reusable code blocks:

function greetPlayer:
    broadcast "Welcome to the server!"
    broadcast "Have a great time!"
 
# Call the function
greetPlayer

Functions with Parameters

function welcome[playerName, welcome_message]:
    send "{welcome_message}" to {playerName}
    send "Thanks for playing!" to {playerName}
 
# Call with parameters
welcome[Steve, "Hello Steve!"]
welcome[Admin, "Welcome back!"]

Functions with Return Values

function getServerStatus:
    return "Server is running perfectly!"
 
var status = getServerStatus
broadcast "{status}"

Data Types

Strings

Text values enclosed in quotes:

var greeting = "Hello World"
var message = "Multi-word message here"
broadcast "This is a string: {greeting}"

String Operations:

var text = "Hello"
var combined = "{text} World"  # Concatenation
 
broadcast "Length: {length of combined}"
broadcast "Uppercase: {uppercase of combined}"
broadcast "Lowercase: {lowercase of combined}"

Numbers

Integer and decimal values:

var count = 42
var decimal = 3.14
var negative = -10
 
var sum = count + 100
var product = count * 2
broadcast "Sum: {sum}"

Booleans

True or false values:

var enabled = true
var disabled = false
 
if enabled is true:
    broadcast "Feature is enabled!"

Lists/Arrays

Multiple values in one variable:

var numbers = [1, 2, 3, 4, 5]
var names = ["Steve", "Alex", "Admin"]
 
broadcast "First number: {numbers[0]}"
broadcast "First name: {names[0]}"

Operators

Arithmetic Operators

var a = 10
var b = 3
 
var add = a + b          # 13
var subtract = a - b     # 7
var multiply = a * b     # 30
var divide = a / b       # 3.33
var modulo = a % b       # 1 (remainder)
var power = a ^ b        # 1000 (10^3)

Comparison Operators

if 5 > 3:               # Greater than
    broadcast "True!"
 
if 5 < 10:              # Less than
    broadcast "True!"
 
if 5 >= 5:              # Greater or equal
    broadcast "True!"
 
if 10 <= 20:            # Less or equal
    broadcast "True!"
 
if value is 42:         # Equal
    broadcast "Found it!"
 
if value is not 0:      # Not equal
    broadcast "Non-zero!"

Logical Operators

var a = true
var b = false
 
if a and b:             # Both must be true
    broadcast "Both true"
 
if a or b:              # At least one true
    broadcast "One or both true"
 
if not a:               # Opposite of value
    broadcast "a is false"

String Operators

var text = "Hello World"
 
if text contains "World":
    broadcast "Found it!"
 
if text starts with "Hello":
    broadcast "Greeting detected!"
 
if text ends with "World":
    broadcast "Ends with World!"

Comments

Lines that are ignored by Coder. Useful for documentation.

Single-Line Comments

# This is a comment
var count = 5  # This is also a comment
 
# Broadcast a welcome message
broadcast "Welcome!"

Multi-Line Comments

#
# This is a multi-line comment
# It spans across multiple lines
# Very useful for documentation
#
 
broadcast "Code continues here"

Good Comments

# Check if server needs restart
if uptimeHours > 24:
    broadcast "Server restart in 1 hour!"
    
# Store player information
var playerStats = {
    name: "Steve",
    level: 42,
    joined: "2026-01-15"
}

Advanced Features

Delays and Timing

# Delay in ticks (20 ticks = 1 second)
delay 20
broadcast "This message appears after 1 second"
 
# Or use time units
wait 1s    # 1 second
wait 2m    # 2 minutes
wait 5t    # 5 ticks

Repeating Tasks

# Run code every X time
every 30s:
    broadcast "This runs every 30 seconds"
 
every 5m:
    console.log "5 minutes have passed!"

Loops

# Loop through numbers
for i from 1 to 5:
    broadcast "Count: {i}"
 
# Loop through list
for player in playerList:
    send "Hello!" to {player}

Complete Example Script

Putting it all together:

# Daily Server Announcement Script
# Version 2.0
 
var serverName = "Creative Central"
var ownerName = "Administrator"
var version = "2.0"
var playerLimit = 50
 
# Function to show header
function showHeader:
    broadcast "═══════════════════════════════════"
 
# Function to show footer
function showFooter:
    broadcast "═══════════════════════════════════"
 
# Main announcement
showHeader
broadcast "Welcome to {serverName}!"
broadcast "Owner: {ownerName}"
broadcast "Version: {version}"
showFooter
 
# Check player count
var onlinePlayers = 5
if onlinePlayers > 20:
    broadcast "⚠️  Server is getting full!"
    broadcast "Current: {onlinePlayers}/{playerLimit}"
else:
    broadcast "✅ Server status: Normal"
    broadcast "Players online: {onlinePlayers}"
 
# Schedule reminder every 10 minutes
every 10m:
    broadcast "Visit {serverName} website for rules!"

📚 Next Steps


Ready to script! Start creating amazing scripts with Coder! 🚀

📚 Coder Wiki


🚀 GETTING STARTED

Essential Pages


📖 CORE DOCUMENTATION

Language & Syntax

Addons


🎯 BY SKILL LEVEL

👶 Beginner

  1. Quick Start
  2. Syntax Reference (basic section)
  3. Copy examples from FAQ 🎯 Intermediate
  4. Master Syntax Reference
  5. Learn all Commands
  6. Explore CodeDSL addon 🏆 Advanced
  7. Deep dive CoderJSLoader
  8. Custom command development
  9. Performance optimization tips

🔗 EXTERNAL LINKS

Official Resources

Resource Link
GitHub Repository
Downloads Releases
Modrinth Download
SpigotMC Download

Community

Channel Link
Discord Join Server
Issues Bug Reports
Discussions Q&A

📊 VERSION INFO

Current: v1.7.4
Released: June 19, 2026
Status: ✅ Active Development

Supported Servers:

  • Paper 1.21 - 26.2
  • Java 21+

💡 QUICK TIPS

📌 New to Coder? Start with Quick Start

📌 Looking for a command? Check Commands

📌 Need examples? Browse Syntax Reference

📌 Can't find answer? Try FAQ


🆘 SUPPORT

Having issues?

  1. Check FAQ
  2. Review Installation Guide
  3. Create GitHub Issue
  4. Ask on Discord

🤝 CONTRIBUTE

Help improve Coder!


Clone this wiki locally