|
6 | 6 | type: fa |
7 | 7 | name: fa-paper-plane |
8 | 8 | color: green |
9 | | -sections: |
10 | | - - /start/prerequisites |
11 | | - - /start/install_vscode |
12 | | - - /start/install_wurst |
13 | 9 | --- |
14 | 10 |
|
15 | 11 | WurstScript is a programming language and modding toolkit working in unison to create awesome Warcraft 3 maps. |
16 | 12 | In this guide we will show you how to install WurstScript and set up your first project. |
| 13 | + |
| 14 | +## Prerequisites |
| 15 | + |
| 16 | +WurstScript and its related tools require Java 11+ to run. Editor support is provided via a VSCode extension. |
| 17 | + |
| 18 | +### Download JRE |
| 19 | + |
| 20 | +[_ _{: .fa .fa-download} Download Java from Adoptium](https://adoptium.net/?variant=openjdk11){: .btn .btn-orange} |
| 21 | + |
| 22 | +Download the Java Runtime appropriate for your system and follow the installation procedure. |
| 23 | + |
| 24 | +Once finished, continue to the next step. |
| 25 | + |
| 26 | +### Verify Java Installation |
| 27 | + |
| 28 | +Many tasks rely on a environment variable called **JAVA_HOME** which might not have been set by the installer. |
| 29 | +To verify your installation, open a command prompt and enter `java -version`. |
| 30 | + |
| 31 | +A valid installation will return something like this: |
| 32 | + |
| 33 | +```powershell |
| 34 | +> java -version |
| 35 | +openjdk version "11.0.17" 2022-10-18 |
| 36 | +OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8) |
| 37 | +OpenJDK 64-Bit Server VM Temurin-11.0.17+8 (build 11.0.17+8, mixed mode) |
| 38 | +``` |
| 39 | + |
| 40 | +The major version should be `11` or higher. If it is lower, you must update your Java installation. |
| 41 | + |
| 42 | +If you get an error or get a lower versions displayed, even though you installed a newer one, your **JAVA_HOME** is either missing or configured wrong. |
| 43 | + |
| 44 | +Refer to this [_ _{: .fa .fa-external-link-square} Windows tutorial](https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html) in order to setup your **JAVA_HOME** correctly. |
| 45 | + |
| 46 | +Once you have setup Java correctly, continue by installing VSCode. |
| 47 | + |
| 48 | +## Install Wurstscript |
| 49 | + |
| 50 | +Now we will setup a Wurst compiler environment and create a project using the the WurstSetup, also known as `grill`. |
| 51 | + |
| 52 | +[_ _{: .fa .fa-download} Download WurstSetup](https://grill.wurstlang.org/hudson/job/WurstSetup/lastSuccessfulBuild/artifact/downloads/WurstSetup.jar){: .btn .btn-green} |
| 53 | + |
| 54 | +The Wurstsetup can be used either from the commandline or as a graphical application. |
| 55 | + |
| 56 | +## Commandline |
| 57 | + |
| 58 | +Usage by invoking `grill` via the commandline is recommended and provides a similar user experience to tools such as `npm`, `maven`. etc. To use the setup from the commandline you need to complete the initial installation once. |
| 59 | +After that you can invoke `grill` from your commandline. |
| 60 | + |
| 61 | +### Initial installation |
| 62 | + |
| 63 | +For the first time you have to run the .jar file directly, because the executable hasn't been installed yet. |
| 64 | + |
| 65 | +`java -jar WurstSetup.jar install wurstscript` |
| 66 | + |
| 67 | +Now you need to add the `~/.wurst` folder to your PATH environment variable, so you can use it from the commandline. |
| 68 | +Refer to this [tutorial](https://www.java.com/en/download/help/path.xml). On Windows 10, the result should look like this: |
| 69 | + |
| 70 | +{: .img-responsive} |
| 71 | + |
| 72 | +The `grill` command should now be recognized by your terminal of choice. |
| 73 | + |
| 74 | +{: .img-responsive} |
| 75 | + |
| 76 | +If not, a restart might be required. |
| 77 | + |
| 78 | +### Updating the Compiler |
| 79 | + |
| 80 | +Use the special `wurstscript` keyword to install or update wurst on your system for the current user. |
| 81 | + |
| 82 | +`grill install wurstscript` |
| 83 | + |
| 84 | +### Create a Wurst Project |
| 85 | + |
| 86 | +Use `generate` to create new projects. The project will be generated in a folder inside your current location with the name provided. |
| 87 | + |
| 88 | +`grill generate my-wurst-project` |
| 89 | + |
| 90 | +### Open in VSCode |
| 91 | + |
| 92 | +After you finished installation and project setup, you can open the project's root folder in VSCode. |
| 93 | + |
| 94 | +`code my-wurst-project` |
| 95 | + |
| 96 | +{: .answer} |
| 97 | + |
| 98 | +_ _{: .fa .fa-exclamation-circle} Make sure you are opening the project's root folder (contains wurst.build file) using `File -> Open Folder` |
| 99 | + |
| 100 | +Once the project is opened, you can click the `Hello.wurst` file on the left to activate the Wurst plugin. The code should compile and the setup should be done. Using VSCode's command console (`F1`) you can execute wurst commands such as running or building your map. |
| 101 | + |
| 102 | +If you are new to WurstScript but not new to programming, you probably want to continue with the [_ _{: .fa .fa-external-link-square} Beginner's Guide](tutorials/wurstbeginner.html) |
| 103 | + |
| 104 | +### Installing and Updating a project |
| 105 | + |
| 106 | +Run the `install` command to update your project's dependencies, or to initially setup a fresly cloned project to work on your machine. |
| 107 | + |
| 108 | +`grill install` |
| 109 | + |
| 110 | +### Adding dependencies |
| 111 | + |
| 112 | +To add a new dependency, run the `install` command with a second parameter that points to a git repo. |
| 113 | + |
| 114 | +`grill install https://github.com/Frotty/wurst-astar-jps` |
| 115 | + |
| 116 | +## Graphical User Interface |
| 117 | + |
| 118 | +By running the `WurstSetup.jar` without any arguments or simply by double-clicking, you can alternatively use the deprecated, graphical user interface. |
| 119 | + |
| 120 | +{: .img-responsive} |
0 commit comments