一键导入
wurst-manual
WurstScript language reference covering syntax, types, classes, modules, generics, lambdas, and all language features for Warcraft 3 modding
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
WurstScript language reference covering syntax, types, classes, modules, generics, lambdas, and all language features for Warcraft 3 modding
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Getting started with WurstScript for Warcraft 3 map development including project structure, first map, and basic spell creation
WurstScript community resources including example maps, libraries, frameworks, and project showcases for Warcraft 3 modding
WurstScript installation, project setup, build configuration, dependency management, and VSCode extension usage for Warcraft 3 modding
WurstScript standard library reference including closures, data structures, vectors, object editing, dummy units, and utility packages
WurstScript tutorials covering spell creation, legacy map migration, save/load systems, hot code reload, and advanced techniques
| name | wurst-manual |
| description | WurstScript language reference covering syntax, types, classes, modules, generics, lambdas, and all language features for Warcraft 3 modding |
WurstScript is an imperative, object-oriented, statically-typed, beginner-friendly programming language for Warcraft III modding. It compiles to both Jass and Lua.
WurstScript is statically typed with these basic types:
boolean b = true // true or false
int i = 1337 // integer without decimals
real r = 3.14 // floating point value
string s = "hello" // text
WurstScript uses indentation-based syntax (similar to Python). Use spaces or tabs consistently.
if condition
ifStatements
nextStatements
Newlines are ignored:
( or [), ], ., .., or begin,, +, *, -, div, /, mod, %, and, or, ?, :All code must be inside a package:
package MyPackage
import SomeOtherPackage
public int globalVar = 5
init
print("Package initialized")
public to export declarationsimport to access other packagesimport public to re-export importsinitlater for cyclic dependenciesfunction max(int a, int b) returns int
if a > b
return a
else
return b
function printMax(int a, int b)
print(max(a, b).toString())
constant x = 5 // immutable, type inferred
let x2 = 25 // immutable shorthand
var y = 5 // mutable
int z = 7 // explicit type
int array a // array
int array b = [1, 2, 3] // initialized array
// Arithmetic: +, -, *, /, div (int division), %, mod
// Boolean: and, or, not
// Comparison: <, <=, >, >=, ==, !=
// Ternary: condition ? ifTrue : ifFalse
// Cascade: obj..method() returns receiver
// Cast: expr castTo Type
// Instance check: expr instanceof Type
if x > y
print("greater")
else if x < y
print("less")
else
print("equal")
switch i
case 1
print("one")
case 2 | 3
print("two or three")
default
print("other")
while a > b
// while loop
for i = 0 to 10
// for loop
for i = 10 downto 0 step 2
// reverse with step
for u in someGroup
// iterate (keeps items)
for u from someGroup
// iterate and remove items
class Missile
vec2 pos
real speed
construct(vec2 pos, real speed)
this.pos = pos
this.speed = speed
function move()
pos += vec2(speed, 0)
ondestroy
flashEffect("explosion.mdx", pos)
// Usage
let m = new Missile(vec2(0, 0), 10)
m.move()
destroy m
class FireballMissile extends Missile
construct(vec2 pos)
super(pos, 20) // call parent constructor
override function move()
super.move()
createFireTrail()
class Counter
static int count = 0
static function increment()
count++
// Usage
Counter.increment()
print(Counter.count.toString())
private: only within classprotected: within package and subclassesabstract class GameObject
abstract function update()
function tick()
update()
class Unit extends GameObject
override function update()
// implementation required
interface Damageable
function takeDamage(real amount)
function isAlive() returns boolean // can have default implementation
return true
class Building implements Damageable
function takeDamage(real amount)
// must implement
Modules provide reusable functionality without inheritance hierarchy:
module Movable
vec2 pos
function move(vec2 delta)
pos += delta
class Unit
use Movable
// now has pos and move()
class Stack<T>
private LinkedList<T> items = new LinkedList<T>()
function push(T item)
items.add(item)
function pop() returns T
return items.pop()
// Usage
let intStack = new Stack<int>()
intStack.push(5)
function first<T>(LinkedList<T> list) returns T
return list.get(0)
// Lambda expression
let pred = (int x) -> x mod 2 == 0
// Type inference
let pred2 = x -> x mod 2 == 0
// Multi-line lambda block
doAfter(5.0) ->
print("5 seconds passed")
doSomething()
// Capturing variables (closure)
let threshold = 10
myList.filter(x -> x > threshold)
Add methods to existing types:
public function unit.kill()
SetUnitState(this, UNIT_STATE_LIFE, 0)
public function real.squared() returns real
return this * this
// Usage
myUnit.kill()
let area = radius.squared() * PI
Lightweight value types (no allocation):
tuple vec2(real x, real y)
let v = vec2(10, 20)
let sum = v.x + v.y
enum State
IDLE
MOVING
ATTACKING
let state = State.IDLE
switch state
case IDLE
print("idle")
case MOVING
print("moving")
case ATTACKING
print("attacking")
function sum(vararg int numbers) returns int
var total = 0
for n in numbers
total += n
return total
sum(1, 2, 3, 4, 5) // works with any number of args
@configurable public function getValue() returns int
return 5
// In config package:
@config public function getValue() returns int
return 10
@compiletime function generateData()
// runs at compile time
for i = 0 to 100
createUnit(i)
Generate WC3 objects in code:
@compiletime function createAbility()
new AbilityDefinitionFireBolt('A001')
..setName("Super Bolt")
..setDamage(1, 100)
..setCooldown(1, 10)
.. for chaininglet/var over explicit types