• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

tut

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183

Wurst Introduction

By @Chaosy

Intent

This guide is meant as a collection hub to the resources to get started. This includes but is not limited to:​
  • FAQ
  • Installation
  • Project Overview
  • Syntax preview
It is not meant to teach someone how to write Wurst but rather to inspire someone to try it out.​
This tutorial will assume that you have basic knowledge of coding in any language, including GUI.​

Quick FAQ

What is wurst?​
A compiled language like vjass, this means it uses an external program to translate code into pure jass.​

Can I use GUI/JASS/VJASS parallel with wurst?​
GUI and JASS works fine. VJASS is more complicated. Workaround here.​

What tools do you need?​


Why would I use Wurst over vjass/zinc etc?

In short, it is personal preference but objectively Wurst has more capabilities.​
A more in depth discussion for vjass users can be found here

Getting Started

716595229fc280f31757253815b37a32.png
The folder contains a bunch of other files.​

wurstlang.org said:
/_build Contains dynamically generated content and shouldn’t be touched by the user, except for copying the compiled map.
/.vscode Contains a settings.json file that links vscode to the wurst tools. You can add additional project-wide configuration here.​
/imports All files inside this folder will be imported into your map upon saving, retaining paths.​
/wurst All files in this folder that end with .wurst, .jurst, .j will be parsed as code.​
.gitignore Useful template if you want to make your wurst project a git repo as well​
ExampleMap.w3x An example tft map containing a Bloodmage​
wurst_run.args Defines a set of flags to use when running a map from VSCode​
wurst.build Contains project build information​
wurst.dependencies Generated file that links libraries. Shouldn’t be touched.​
wurst/Hello.wurst Demo package​


Open the generated project folder with Visual Studio Code and open the Hello.wurst inside the wurst folder.​
The file will look like this:​
51f6b7d6766624e13daed0d1b1350478.png
Before starting to write code it might be smart to test launching the map so you do not confuse a code error with some other potential issue. Make sure you install the Wurst extension as described here.​
Hint: Press F1 to type.​
RunMap.png
Tip: After selecting it once you can easily launch the map in the future by. F1 > enter > enter​

Actually Coding

The current Hello.wurst contains three parts.​
  • Package name
  • Comment
  • Code
The package name MUST be in each .wurst file and MUST be named the same as the file name. Hello in this case.​
The comment is optional and can be removed.​
Comments are always colored green (by default) and are started by // or /* and ended with */​
init is a special function which makes the code inside it run when the map starts. Similarly to onInit in vjass. In this case, the message "Hello World" will be written.​
For total newbies you can try to edit the message to type something else.​
Hint: Be very mindful of the indent as it determines which block you are writing in and will cause errors.​

Code Syntax Example

This is not meant as a perfect code example, but simply to display the syntax which is the main reason I use it personally as I think it is very clean.​
Alternatively, you could copy>paste this code to get a working piece of example code.​
Last edited:
Top